Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
295 lines (265 loc) · 10.1 KB
/
Copy pathpyproject.toml
File metadata and controls
295 lines (265 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
[build-system]
# wget is used to download the MOA jar file
# stubgenj is used to generate the Python stub files for the MOA classes
requires = ["hatchling", "wget", "stubgenj", "invoke"]
# Build system: https://hatch.pypa.io
# The main reason I chose hatch is its support for plugins allowing us to
# download the MOA jar file before the build starts.
build-backend = "hatchling.build"
[project]
name = "capymoa"
dynamic = ['version']
description = "Python wrapper for MOA to allow efficient use of existing algorithms with a more modern API."
readme = "README.md"
license = "BSD-3-Clause"
license-files = ["LICENSE"]
homepage = "https://capymoa.org"
repository = "https://github.com/adaptive-machine-learning/CapyMOA"
authors = [
{name="Heitor Murilo Gomes", email="hmugomes@gmail.com"},
{name="Anton Lee", email="anton.lee@vuw.ac.nz"},
{name="Nuwan Gunasekara"},
{name="Marco Heyden"},
{name="Yibin Sun"},
{name="Guilherme Weigert Cassales"}
]
keywords = [
"MOA",
"Machine Learning",
"Data Stream",
"Online Learning",
"Stream Learning",
"Data Stream Mining",
"Data Mining",
"Incremental Learning",
"Concept Drift",
"Concept Evolution",
"Concept Shift",
"Big Data",
"Data Science",
]
long_description_content_type = "text/markdown"
requires-python = ">=3.11"
# Defines the pip packages that are required by this package. These should be
# as permissive as possible, since capymoa should collaborate with other
# packages.
# The '~=' operator is used to specify compatible releases: newer features or bug fixes
# within the same major version are allowed.
# For example: ~= 2.2 is >= 2.2, == 2.*.*
# See: https://packaging.python.org/en/latest/specifications/version-specifiers/#compatible-release
dependencies = [
"deprecated~=1.3",
"jpype1~=1.7,!=1.7.0",
"matplotlib~=3.10",
"numpy~=2.2",
"pandas~=2.2",
"scikit-learn~=1.8",
"scipy~=1.14",
"seaborn~=0.13",
"tqdm~=4.67",
# `typing_extensions.override` is used across the core modules. It used to
# arrive transitively via torch; now that torch is an optional extra it has
# to be declared explicitly.
"typing-extensions~=4.10",
]
[project.optional-dependencies]
# PyTorch is optional: it is only needed by the deep-learning parts of CapyMOA
# (capymoa.ocl, capymoa.core.torch.ann, capymoa.stream.torch, the Batch* learners,
# Autoencoder and ABCD's feature extraction). Keeping it out of the default
# install avoids pulling the CUDA stack (~2.9 GB on Linux) on `pip install capymoa`.
torch=[
"torch~=2.9",
"torchvision~=0.24",
]
# Same spec as `torch`, but routed to the CPU-only wheel index via
# [tool.uv.sources] below. Only affects `uv sync`; `pip install capymoa[torch-cpu]`
# is identical to `capymoa[torch]`.
torch-cpu=[
"torch~=2.9",
"torchvision~=0.24",
]
# Development dependencies. Deliberately does not pull in `torch`/`torch-cpu`:
# combine with one of those extras explicitly (e.g. `--extra dev --extra torch-cpu`)
# when a torch-backed test run is needed.
dev=[
"commitizen~=3.24",
"invoke~=3.0",
"jupyter~=1.1",
# Notebooks are stored as Jupytext `py:percent` scripts (see `notebooks/*/*.py`);
# `invoke docs.nb` uses this to regenerate the `.ipynb` files nbmake needs.
"jupytext==1.19.5",
"nbmake~=1.5",
"pytest-cov~=7.0",
"pytest-timeout~=2.4",
"pytest-xdist~=3.8",
"pytest~=9.0",
# Pinned to a single minor: `astral-sh/ruff-action` (the Code Style gate) reads this spec
# as >=0.16,<0.17, while pip/uv apply PEP 440 and admit patch bumps. An explicit range keeps
# the lint gate and dev installs on the same ruff. Bumping is a deliberate change.
"ruff>=0.16,<0.17",
"stubgenj~=0.2",
"wget~=3.2",
]
doc=[
"jupytext==1.19.5", # Reads the notebooks' `py:percent` source format
"myst-nb~=1.4", # Sphinx extension: parses MyST + Jupytext notebooks
"pydata-sphinx-theme~=0.19", # Theme for the documentation; has built-in sphinx-copybutton styling
"sphinx-copybutton~=0.5", # Adds a copy button to code blocks
"sphinx-llm~=1.1", # Generates llms.txt/markdown pages for LLM consumption
"sphinx-reredirects~=1.1", # Generates redirect stubs for moved/renamed doc pages
"sphinx_design~=0.7", # Sphinx extension for design elements
"sphinx~=8.1", # Documentation generator
"sphinxcontrib-programoutput~=0.20", # Output of commands in the documentation
]
[project.urls]
Documentation = "https://capymoa.org"
Source = "https://github.com/adaptive-machine-learning/CapyMOA"
[tool.uv]
# `torch` and `torch-cpu` declare the same version spec but resolve from
# different indexes (see [tool.uv.sources]); requesting both at once is
# nonsensical, so reject it instead of silently picking one.
conflicts = [
[ { extra = "torch" }, { extra = "torch-cpu" } ],
]
[tool.uv.sources]
# Only the `torch-cpu` extra is routed to the CPU-only index, and only on
# Linux -- the platform where the default PyPI wheel pulls the CUDA stack.
# On Windows/macOS `torch-cpu` falls through to the default index, same as
# plain `torch` would.
torch = [{ index = "pytorch-cpu", extra = "torch-cpu", marker = "platform_system == 'Linux'" }]
torchvision = [{ index = "pytorch-cpu", extra = "torch-cpu", marker = "platform_system == 'Linux'" }]
[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true
[tool.pytest.ini_options]
addopts = [
"--import-mode=importlib",
# pytest and jpype can raise irrelevant warnings and segfault when faulthandler is used.
# https://github.com/jpype-project/jpype/issues/561
"-p no:faulthandler"
]
# Fail fast on any single test/doctest that runs unexpectedly long, so slow
# additions are caught immediately instead of silently inflating CI time.
# CI runs with --cov, which roughly 5x's the runtime of instance-heavy tests
# (e.g. anomaly detector tests), so this needs generous headroom over local,
# uninstrumented timings.
timeout = 90
timeout_method = "thread"
pythonpath = ["src"]
testpaths = ["tests", "src"]
norecursedirs = [
"docs/*"
]
markers = [
"torch: tests that require PyTorch to run"
]
[tool.hatch]
[tool.hatch.version]
path = "src/capymoa/__about__.py"
[tool.hatch.build.targets.wheel]
# Defines the directories included in the wheel package
packages = ["src/capymoa", "src/moa-stubs", "src/com-stubs"]
artifacts = ["src/capymoa/jar/moa.jar", "src/capymoa/jar/Home.class"]
# _nbmock.py only exists to support running the docs notebooks in CI/local
# dev; it has no use at runtime and shouldn't ship to end users.
exclude = ["src/capymoa/_nbmock.py"]
# src/moa-stubs and src/com-stubs are included in the git ignore file
# that hatch inherits. To include them anyway we need to set ignore-vcs to true.
ignore-vcs = true
[tool.hatch.build.targets.sdist]
# Defines the directories included in the source distribution package (sdist).
packages = ["src/capymoa", "src/moa-stubs", "src/com-stubs"]
artifacts = ["src/capymoa/jar/moa.jar", "src/capymoa/jar/Home.class"]
# src/moa-stubs and src/com-stubs are included in the git ignore file
# that hatch inherits. To include them anyway we need to set ignore-vcs to true.
ignore-vcs = true
[tool.hatch.build.hooks.custom]
# Ensures that the MOA jar file is downloaded and the Java stubs are
# generated before the build starts. See hatch_build.py.
path = "tools/hatch_build.py"
[tool.semantic_release]
assets = []
commit_message = "chore(version): increment version to {version}"
commit_parser = "angular"
logging_use_named_masks = false
major_on_zero = true
allow_zero_version = true
tag_format = "v{version}"
# Find and replace version variables in the following files
version_variables = [
"src/capymoa/__about__.py:__version__",
"docker/.env:CAPYMOA_VERSION"
]
[tool.semantic_release.branches.main]
match = "(main|master)"
prerelease_token = "rc"
prerelease = false
[tool.semantic_release.changelog]
template_dir = "templates"
changelog_file = "CHANGELOG.md"
exclude_commit_patterns = []
[tool.semantic_release.changelog.environment]
block_start_string = "{%"
block_end_string = "%}"
variable_start_string = "{{"
variable_end_string = "}}"
comment_start_string = "{#"
comment_end_string = "#}"
trim_blocks = false
lstrip_blocks = false
newline_sequence = "\n"
keep_trailing_newline = false
extensions = []
autoescape = true
[tool.semantic_release.commit_author]
env = "GIT_COMMIT_AUTHOR"
default = "semantic-release <semantic-release>"
[tool.semantic_release.commit_parser_options]
allowed_tags = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "style", "refactor", "test"]
minor_tags = ["feat"]
patch_tags = ["fix", "perf"]
default_bump_level = 0
[tool.semantic_release.remote]
name = "origin"
type = "github"
ignore_token_for_push = false
insecure = false
[tool.semantic_release.publish]
dist_glob_patterns = ["dist/*"]
upload_to_vcs_release = true
# Configuration for the formatter
[tool.ruff]
target-version = "py311"
extend-exclude = [
# Notebooks stored as Jupytext `py:percent` scripts. They rely on the
# Jupyter/IPython runtime (e.g. the `display()` builtin, top-level
# expression auto-printing) rather than being run as plain scripts, so
# linting/formatting them as such produces false positives.
"notebooks",
]
[tool.ruff.lint]
# Docstring rules: public classes, functions and `__init__` need a docstring
# (D101, D103, D107) and every parameter needs a `:param` entry (D417).
extend-select = ["D101", "D103", "D107", "D417"]
ignore = [
# Require a `tz` argument on `datetime.now()`. Every current call site
# uses `datetime.now()` to stamp human-readable filenames/log lines with
# local wall-clock time (e.g. experiment output filenames); there's no
# timezone-sensitive computation involved, so forcing tz-awareness would
# just complicate call sites without fixing a real bug.
"DTZ005",
]
[tool.ruff.lint.per-file-ignores]
# Docstring rules apply to the library only.
"!src/**" = ["D"]
[tool.coverage.report]
exclude_also = [
'pass',
]
[tool.coverage.run]
omit = [
# omit pytorch-generated files in /tmp
# https://stackoverflow.com/a/79415891
"/tmp/*"
]