-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpyproject.toml
More file actions
267 lines (251 loc) · 7.81 KB
/
Copy pathpyproject.toml
File metadata and controls
267 lines (251 loc) · 7.81 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
[build-system]
requires = ["setuptools>=77.0.3"]
build-backend = "setuptools.build_meta"
[project]
name = "coreax"
dynamic = ["version"]
description = "Jax coreset algorithms."
readme = "README.md"
requires-python = ">=3.10"
keywords = [
"coreset",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Typing :: Typed",
]
license = "Apache-2.0"
license-files = ["LICENSE"]
authors = [
{name = "GCHQ", email = "oss@gchq.gov.uk"},
]
dependencies = [
# NOTE: lower bounds are the lowest supported version when using the 'lowest'
# resolution mode of uv on the latest supported version of Python - the bounds
# are only sharp for the latest supported Python version.
"equinox>=0.11.11",
"flax>=0.10.0",
"jax>=0.4.38",
"jaxopt>=0.8.4",
"jaxtyping>=0.2.31",
"optax>=0.1.5",
"scikit-learn>=1.5.0",
"tqdm>=4.27",
"typing-extensions>=4.12",
]
[dependency-groups]
# All tools for a developer including those for running pylint
dev = [
# These dependencies are constrained more tightly as they're only used by package
# developers, so compatibility is less of a concern
{include-group = "doc"},
{include-group = "test"},
"pre-commit>=4.2.0",
"pylint>=4.0.4",
"pyright>=1.1.408",
]
# Compile documentation
doc = [
"furo>=2024",
"sphinx>=7",
"sphinx-autodoc-typehints>=2",
"sphinxcontrib-bibtex>=2",
"sphobjinv>=2.1.0",
]
# Run unit tests with coverage assessment
test = [
{include-group = "benchmark"},
"beartype>=0.19",
"pytest>=9",
"pytest-cov>=6",
"pytest-xdist>=3.2.0",
"scipy>=1.14.1",
]
# Benchmarking - runs very similar code to examples with same dependencies plus more
benchmark = [
{include-group = "example"},
"torch>=2.5",
"torchvision>=0.21",
"umap-learn>=0.5.7", # Earlier versions are incompatible.
# Required for umap-learn - we constrain this so dependency solvers don't
# erroneously backtrack.
"llvmlite>=0.40.0",
]
# Example scripts
example = [
"imageio>=2.19.4",
"matplotlib>=3.9.0",
"numpy>=2",
"opencv-python-headless>=4.10.0.84", # WARNING: Incompatible with other versions of opencv
]
[tool.uv]
# Exclude packages published less than 14 days ago from dependency resolution as a
# supply-chain security measure.
exclude-newer = "14 days"
# Provide lower bounds for transitive packages when using '--resolution lowest'. There
# are a lot of packages here as some of our dependencies don't provide lower bounds.
# These 'doc' dependency group is not constrained by this.
constraint-dependencies = [
# Unconstrained (only specified to suppress uv warnings)
"beautifulsoup4>0",
"future>0",
"msgpack>0",
"orbax-checkpoint>=0,!=0.11.33; sys_platform == 'win32'",
"orbax-checkpoint>=0; sys_platform != 'win32'",
"sphinx-basic-ng>0",
"sphinxcontrib-applehelp>0",
"sphinxcontrib-devhelp>0",
"sphinxcontrib-jsmath>0",
"sphinxcontrib-qthelp>0",
"tomli>0",
"webencodings>0",
# Constrained to the required lower-bounds on our highest supported Python version.
"absl-py>=1.0.0", # via optax
"attrs>=18.1.0", # via rich via flax
"chex>=0.1.84", # via optax
"dm-tree>=0.1.8", # via chex via optax
"fsspec>=0.5.0", # via torch
"identify>=1.5.10", # via pre-commit
"isort>=5.1.0", # via pylint
"joblib>=1.4.0", # via sklearn
"ml-dtypes>=0.4.1", # via jax
"mpmath>=1.2.1", # via torch
"networkx>=1.3", # via torch
"numba>=0.61.0", # via umap-learn
"opt-einsum>=3.2.0", # via jax
"pillow>=11.0.0", # via torchvision
"pybtex>=0.22.0", # via sphinxcontrib-bibtex
"pynndescent>=0.5.13", # via umap
"pyparsing>=3.0.8", # via matplotlib
"python-dateutil>=2.9.0", # via matplotlib
"pyyaml>=6.0.1", # via flax
"setuptools>=5.0", # via torch
"six>=1.16.0", # via absl-py via flax
"tensorstore>=0.1.70", # via flax
]
# Ensure we get the latest package versions available for each Python version
environments = [
"python_version>='3.14'",
"python_version=='3.13.*'",
"python_version=='3.12.*'",
"python_version=='3.11.*'",
"python_version=='3.10.*'",
]
[project.urls]
Documentation = "https://coreax.readthedocs.io/en/latest/"
Repository = "https://github.com/gchq/coreax"
Issues = "https://github.com/gchq/coreax/issues"
Changelog = "https://github.com/gchq/coreax/blob/main/CHANGELOG.md"
[tool.setuptools]
packages = [
"coreax",
"coreax.kernels",
"coreax.solvers",
]
[tool.setuptools.dynamic]
version = {attr = "coreax.__version__"}
[tool.pyright]
exclude = [
# Exclude snippets for documentation as most variables not properly defined
"documentation/source/snippets",
# Exclusions that would have been generated automatically if this section weren't
# specified
"**/node_modules",
"**/__pycache__",
"**/.*",
]
venvPath = "."
venv = ".venv"
[tool.pytest.ini_options]
minversion = "9.0"
filterwarnings = [
"error",
"ignore::ImportWarning:umap",
"ignore::DeprecationWarning:jaxopt",
]
[tool.ruff]
src = [".", "examples"]
[tool.ruff.lint]
preview = true
select = [
"B", # flake8-bugbear
"C90", # McCabe
"D", # pydocstyle
"E", # pycodestyle [error]
"F", # pyflakes
"G010", # logging-warn
"I", # isort
"N", # pep8-naming
"PGH005", # invalid-mock-access
"PL", # pylint
"S102", # exec-builtin
"S307", # suspicious-eval-usage
"TD", # flake8-todo
"UP", # pyupgrade
"W", # pycodestyle [warning]
]
ignore = [
# Incompatible with ruff format
"D206", # indent-with-spaces
"E111", # indentation-with-invalid-multiple
"E114", # indentation-with-invalid-multiple-comment
"E117", # over-indented
"W191", # tab-indentation
# Incompatible with other pydocstyle rules
"D203", # one-blank-line-before-class
"D212", # multi-line-summary-first-line
# Incompatible with jaxtyping
"F722", # forward-annotation-syntax-error
# Opinionated ignores
"PLR6301", # no-self-use (opinionated)
"TD002", # missing-todo-author (opinionated)
]
[tool.ruff.lint.per-file-ignores]
"documentation/source/conf.py" = [
"E402", # Allow module imports not at the top of the file - conf.py does weird
# things with imports that necessitate this
]
"documentation/source/snippets/*" = [
"D100", # Allow missing module docstring - these are snippets, not full modules
"F821", # Allow undefined names - the snippets are *snippets*, not complete code
]
"examples/*" = [
"PLR0914", # Ignore "too many locals"
"PLR0915", # Ignore "too many statements"
# In both cases, the example code is meant to be more verbose so it's easier to
# understand and can serve as its own documentation.
]
"tests/*" = [
"D200", # Allow "one-line docstring not on one line" - test docstrings can be
# quite long, so sometimes the extra six characters are really needed
"PLR0904", # Ignore "too many public methods" - test classes are really just
# namespaces, so the usual concerns here don't apply
]
[tool.ruff.lint.pylint]
max-args = 10
max-locals = 20
allow-dunder-method-names = ["__check_init__", "__jax_array__"]
[tool.ruff.lint.isort]
combine-as-imports = true
force-wrap-aliases = true
[tool.coverage.run]
command_line = "-m pytest tests/unit --cov"
branch = true
relative_files = true
source = ["coreax"]
[tool.coverage.report]
show_missing = true
sort = "Cover"
exclude_also = [
"pass",
"raise RuntimeError",
"if TYPE_CHECKING:",
"raise$",
"\\.\\.\\.",
]