-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpyproject.toml
More file actions
569 lines (525 loc) · 19.6 KB
/
Copy pathpyproject.toml
File metadata and controls
569 lines (525 loc) · 19.6 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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
[project]
authors = [
{ name = "Coordinax Devs", email = "nstarman@users.noreply.github.com" },
{ name = "Nathaniel Starkman", email = "nstarman@users.noreply.github.com" },
{ name = "Adrian Price-Whelan", email = "adrn@users.noreply.github.com" },
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering",
"Typing :: Typed",
]
dependencies = [
"astropy>=7.0.0",
"beartype>=0.21.0",
"coordinaxs.api>=0.24",
"dataclassish>=0.9.0",
"equinox>=0.13.8",
# >=0.7.2 is unxt 2.0.2's own floor, not a preference; 0.6.x cannot resolve
# alongside it. `jnp.asarray` only routes through `Quantity.__array__` from
# jax 0.10, so between 0.7.2 and 0.9 it still rejects a Quantity outright --
# strip explicitly rather than relying on the coercion in that range.
"jax>=0.7.2",
"jaxlib>=0.7.2",
"jaxtyping>=0.3.3",
"optional-dependencies>=0.5.0",
"optype>=0.17.0",
"plum>=2.8.0; python_version < '3.14'",
"plum>=2.9.0; python_version >= '3.14'",
"quax>=0.4.2",
"quax-blocks>=0.5.0",
"quaxed>=0.10.5",
"typing-extensions>=4.13.2",
"zeroth>=1.2.0",
# 2.0.2 makes `np.asarray(Quantity)` raise rather than silently drop the
# unit. Relied upon: dropping a unit yields a number in the wrong dimension
# that looks entirely plausible.
"unxt>=2.0.2",
"unxts.linalg>=2.0.6",
"wadler-lindig>=0.1.6",
"xmmutablemap>=0.1",
]
description = "Coordinates in JAX"
dynamic = ["version"]
license = "MIT"
license-files = ["LICENSE"]
name = "coordinax"
readme = "README.md"
requires-python = ">=3.12"
[project.optional-dependencies]
astro = ["coordinaxs.astro>=0.24"]
benchmark = ["pytest-benchmark>=5.2.3", "pytest-codspeed>=5.0.3"]
curveframes = ["coordinaxs.curveframes>=0.24"]
interop-astropy = ["coordinaxs.interop.astropy>=0.24"]
parametric = ["unxts.parametric>=2.0"]
workspace = [
"coordinaxs.api>=0.24",
"coordinaxs.astro>=0.24",
"coordinaxs.curveframes>=0.24",
"coordinaxs.hypothesis>=0.24",
"coordinaxs.interop.astropy>=0.24",
]
[project.urls]
"Bug Tracker" = "https://github.com/GalacticDynamics/coordinax/issues"
Changelog = "https://github.com/GalacticDynamics/coordinax/releases"
Discussions = "https://github.com/GalacticDynamics/coordinax/discussions"
Homepage = "https://github.com/GalacticDynamics/coordinax"
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling", "hatch-vcs"]
[dependency-groups]
api = ["griffe>=1.5.0"]
build = ["build>=1.3.0"]
dev = [
"cz-conventional-gitmoji>=0.6.1",
{ include-group = "api" },
{ include-group = "build" },
{ include-group = "docs" },
{ include-group = "ide" },
{ include-group = "lint" },
{ include-group = "nox" },
{ include-group = "test-all" },
]
docs = [
"jaxmore>=0.3.0",
"jupyter-cache>=1.0.0",
"jupytext>=1.16.4",
"matplotlib>=3.11.0",
"myst-nb>=1.1.2",
"myst_parser>=0.13",
"pytz>=2024.2", # for copyright date
"sphinx-autobuild>=2024.9.3",
"sphinx-book-theme==1.1.3",
"sphinx-prompt>=1.8.0",
"sphinx-tippy>=0.4.3",
"sphinx>=7.0",
"sphinx_autodoc_typehints>=3.0.0",
"sphinx_copybutton>=0.5.2",
"sphinx_design>=0.6.1",
"sphinx_togglebutton>=0.3.2",
"sphinxext-opengraph>=0.9.1",
"sphinxext-rediraffe>=0.2.7",
]
ide = ["ipykernel>=7.1.0", "jaxmore>=0.2.0"]
lint = ["prek>=0.4.0", "pylint>=3.3.2", "ty>=0.0.19"]
nox = ["nox>=2024.10.9", "nox-uv>=0.6.3"]
test = [
"coordinaxs.curveframes>=0.24",
"coordinaxs.hypothesis>=0.24",
"hypothesis[numpy]>=6.151.6",
"jaxmore>=0.2.0",
"pytest>=8.3.3",
"pytest-arraydiff>=0.6.1",
"pytest-cov>=6.2.1",
"pytest-env>=1.1.5",
"pytest-github-actions-annotate-failures>=0.3.0",
# `-n auto` asks xdist for the *physical* core count, and xdist can only
# answer that with psutil -- without it both `auto` and `logical` fall
# through to the OS's own count (`os.sched_getaffinity` on Linux, else
# `os.cpu_count`), which counts hyperthreads. That is the oversubscription
# in #817. Declared here so CI, which syncs only `nox`+`test`, actually
# gets it; it arrived transitively via the `ide` group before, which CI
# never installs.
"psutil>=5.9",
"pytest-xdist>=3.6.1",
"sybil[pytest]>=8.0.0",
# the hypothesis annotation-strategy tests use ParametricQuantity["length"].
"unxts.parametric>=2.0",
]
test-all = [{ include-group = "test" }]
[tool.jupytext]
cell_metadata_filter = "tags,-all"
formats = "ipynb,md:myst"
notebook_metadata_filter = "kernelspec,language_info,jupytext"
[tool.hatch]
build.hooks.vcs.version-file = "src/coordinax/_version.py"
build.hooks.vcs.version-file-template = """\
version: str = {version!r}
version_tuple: tuple[int, int, int] | tuple[int, int, int, str, str]
version_tuple = {version_tuple!r}
"""
build.targets.wheel.packages = ["src/coordinax"]
version.source = "vcs"
[tool.hatch.version.raw-options]
local_scheme = "no-local-version"
[tool.hatch.version.raw-options.scm.git]
describe_command = [
"git",
"describe",
"--dirty",
"--tags",
"--long",
"--match",
"coordinax-v*",
]
[tool.codespell]
ignore-words-list = "precessed,precessing"
skip = ["uv.lock"]
[tool.repo-review]
ignore = [
"PC140", # ty is run via prek, not pre-commit
"PC901", # custom autoupdate_commit_msg set in .pre-commit-config.yaml
"PC902", # custom autofix_commit_msg set in .pre-commit-config.yaml
"PC903", # autoupdate_schedule set in .pre-commit-config.yaml
]
[tool.commitizen]
name = "cz_gitmoji"
[tool.coverage]
run.source = ["coordinax", "coordinaxs"]
[tool.coverage.report]
exclude_also = [
# Have to re-enable the standard pragma
'pragma: no cover',
# Ignore type-checking stuff
'if typing.TYPE_CHECKING:',
'if TYPE_CHECKING:',
'\.\.\.',
# Ignore contents of abstract methods
'@abc.abstractmethod',
'@abstractmethod',
]
[tool.mypy]
disable_error_code = [
"no-redef", # for plum-dispatch
"name-defined", # for jaxtyping
]
disallow_incomplete_defs = false
disallow_untyped_defs = false
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
explicit_package_bases = true
files = [
"src/coordinax",
"packages/coordinaxs.api/src/coordinaxs/api",
"packages/coordinaxs.astro/src/coordinaxs/astro",
"packages/coordinaxs.astro/src/coordinaxs/hypothesis/astro",
"packages/coordinaxs.curveframes/src/coordinaxs/curveframes",
"packages/coordinaxs.curveframes/src/coordinaxs/hypothesis/curveframes",
"packages/coordinaxs.hypothesis/src/coordinaxs/hypothesis",
"packages/coordinaxs.interop.astropy/src/coordinaxs/interop/astropy",
]
mypy_path = "src:packages/coordinaxs.api/src:packages/coordinaxs.astro/src:packages/coordinaxs.curveframes/src:packages/coordinaxs.hypothesis/src:packages/coordinaxs.interop.astropy/src"
namespace_packages = true
python_version = "3.12"
strict = true
warn_return_any = false
warn_unreachable = true
warn_unused_configs = true
[[tool.mypy.overrides]]
disallow_incomplete_defs = true
disallow_untyped_defs = true
module = ["coordinax.*", "coordinaxs.*"]
[[tool.mypy.overrides]]
ignore_missing_imports = true
module = [
"array_api.*",
"quaxed.*",
"astropy.*",
"equinox.*",
"hypothesis.*",
"jax.*",
"coordinax.*",
"coordinaxs.*",
"jaxtyping.*",
"numpy.*",
"quax.*",
]
[tool.pylint]
ignore-paths = [".*/_version.py", "scratch/.*"]
max-module-lines = 2000
messages_control.disable = [
"abstract-method", # pylint doesn't like ABC hierarchies
"arguments-differ", # plum-dispatch
"cyclic-import", # broken?
"design",
"duplicate-code",
"import-outside-toplevel", # handled by ruff
"fixme",
"function-redefined", # plum-dispatch
"invalid-name", # handled by ruff
"invalid-overridden-method",
"invalid-unary-operand-type", # pylint doesn't understand dataclass fields
"isinstance-second-argument-not-valid-type", # pylint doesn't understand classproperty objects
"line-too-long",
"missing-function-docstring", # TODO: resolve
"missing-kwoa", # plum-dispatch
"missing-module-docstring",
"no-member", # handled by mypy
"no-value-for-parameter", # pylint doesn't understand multiple dispatch
"not-a-mapping", # pylint doesn't understand dataclass fields
"not-an-iterable", # pylint doesn't understand dataclass fields
"property-with-parameters", # Cannot have defined parameters for properties
"protected-access", # handled by ruff
"redefined-builtin", # handled by ruff
"too-many-function-args", # plum-dispatch
"unexpected-keyword-arg", # plum-dispatch
"unnecessary-ellipsis", # I like my ellipses in ABCs and Protocols
"unnecessary-lambda", # jax uses lambdas frequently
"unnecessary-lambda-assignment", # jax uses lambdas frequently
"unsubscriptable-object", # handled by mypy
"unused-argument", # handled by ruff
"unused-wildcard-import", # handled by ruff
"wildcard-import", # handled by ruff
"wrong-import-position", # handled by ruff
"wrong-import-order", # handled by ruff
]
py-version = "3.12"
reports.output-format = "colorized"
similarities.ignore-imports = "yes"
[tool.pytest.ini_options]
addopts = [
"--arraydiff",
"--ignore-glob=*/coordinaxs.curveframes/docs/visualizing.md", # executed by the docs build (matplotlib), not sybil
"--import-mode=importlib",
"--showlocals",
"--strict-config",
"--strict-markers",
"-p no:doctest", # using sybil
"-ra", # Display extra test summary info for all outcomes
]
filterwarnings = [
"error",
"ignore:ast\\.Str is deprecated and will be removed in Python 3\\.14:DeprecationWarning", # from Sybil
"ignore:Attribute s is deprecated and will be removed in Python 3\\.14:DeprecationWarning", # from Sybil
"ignore:Explicitly requested dtype <class 'jax.numpy\\.float64'> requested in astype is not available",
"ignore:jax\\.main\\.get_aval is deprecated:DeprecationWarning",
"ignore:jax\\.main\\.pp_eqn_rules is deprecated:DeprecationWarning",
# hypothesis
"ignore:Do not use the `random` module inside strategies:hypothesis.errors.HypothesisDeprecationWarning",
# Old matplotlib (resolved by the check-oldest job) calls pyparsing APIs that
# newer pyparsing deprecates; pulled in transitively via unxt's mpl interop.
# Scoped to the matplotlib modules that emit them, and matched by message +
# the builtin DeprecationWarning base (which PyparsingDeprecationWarning
# subclasses) so the filter loads even where pyparsing is not installed.
"ignore:'\\w+' deprecated - use '\\w+':DeprecationWarning:matplotlib\\..*",
]
# Dump every thread's traceback for any test still running after 5 minutes,
# naming the file, line and test, then let the run continue. CI has repeatedly
# lost ubuntu runners to a stall that goes silent at 99% and produces no
# output at all, so there has been nothing to act on; the slowest legitimate
# test is ~80s, so this can only fire on a genuine stall. Works under xdist:
# the stuck worker dumps, the others carry on.
faulthandler_timeout = 300
log_level = "INFO"
markers = [
"network: marks tests that require a network connection (deselect with '-m not network')",
# Spawns a fresh interpreter, which must not compete with xdist workers that
# are each cold-importing the same JAX stack. Deselected from the parallel
# run and given its own serial step; see `test_jax_dtypes.py`.
"subprocess_heavy: marks tests that spawn their own interpreter",
# Applied in the root `conftest.py` to Sybil examples, so `--dist=loadgroup`
# keeps each document on one worker. Declared here as well as by xdist so
# that `-p no:xdist` does not trip `--strict-markers`.
"xdist_group: pins a test to a named xdist worker group",
]
minversion = "8.3"
norecursedirs = [
".*", # ignores .hypothesis, .git, etc.
"__pycache__",
"docs/_build",
"docs/packages", # symlinks to package docs, don't test twice
]
pythonpath = ["tests"] # for importable test utility modules
testpaths = [
"README.md",
"packages/coordinaxs.api/",
"skills/",
"src/",
"docs/",
"tests/",
"packages/coordinaxs.astro",
"packages/coordinaxs.curveframes",
"packages/coordinaxs.hypothesis/",
"packages/coordinaxs.interop.astropy/",
]
xfail_strict = true
[tool.pytest_env]
COORDINAX_ENABLE_RUNTIME_TYPECHECKING = "beartype.beartype"
JAX_ENABLE_X64 = "1"
[tool.ty]
environment.extra-paths = [
"packages/coordinaxs.api/src",
"packages/coordinaxs.astro/src",
"packages/coordinaxs.curveframes/src",
"packages/coordinaxs.hypothesis/src",
"packages/coordinaxs.interop.astropy/src",
]
[tool.ty.src]
exclude = [
"tests",
"**/tests",
"**/tests/**",
"**/test_*.py",
"**/*_test.py",
".venv",
".nox",
".tox",
]
[tool.ruff]
namespace-packages = [
"packages/coordinaxs.api/src/coordinaxs",
"packages/coordinaxs.astro/src/coordinaxs",
"packages/coordinaxs.astro/src/coordinaxs/hypothesis",
"packages/coordinaxs.curveframes/src/coordinaxs",
"packages/coordinaxs.curveframes/src/coordinaxs/hypothesis",
"packages/coordinaxs.hypothesis/src/coordinaxs",
"packages/coordinaxs.hypothesis/src/coordinaxs/hypothesis",
"packages/coordinaxs.interop.astropy/src/coordinaxs",
"packages/coordinaxs.interop.astropy/src/coordinaxs/interop",
]
[tool.ruff.format]
# Collapse a call or signature onto one line whenever it fits, instead of
# leaving it exploded because it happens to end in a trailing comma.
skip-magic-trailing-comma = true
[tool.ruff.lint]
extend-select = ["ALL"]
ignore = [
"A002", # Argument is shadowing a Python builtin
"ANN001", # Missing type annotation for `cls` in method
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
"ARG001", # Unused function argument # TODO: resolve
"B008", # Do not perform function calls in argument defaults
"B024", # X is an ABC, but it has no abstract methods or properties
"COM812", # <- for ruff.format
"D103", # Missing docstring in public function # TODO: resolve
"D105", # Missing docstring in magic method
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"E731", # Do not assign a lambda expression, use a def
"EM101", # Exception must not use a string literal, assign to variable first
"EM102", # Exception must not use an f-string literal, assign to variable
"ERA001", # Commented out code
"F722", # Syntax error in forward annotation <- jaxtyping
"F811", # redefinition of unused '...' <- plum-dispatch
"F821", # undefined name '...' <- jaxtyping
"FIX002", # Line contains TODO
"ISC001", # Conflicts with formatter
"N802", # Function name should be lowercase
"N803", # Argument name should be lowercase
"N806", # Variable in function should be lowercase
"PD", # Pandas
"PLR09", # Too many <...>
"PLR2004", # Magic value used in comparison
"PYI041", # Use `complex` instead of `int | complex` <- plum is more strict
"RUF003", # Comment contains ambiguous symbol
"RUF022", # `__all__` is not sorted
"SLF001", # private-member-access TODO: unignore this.
"TC001", # Move into a type-checking block
"TD002", # Missing author in TODO
"TD003", # Missing issue link on the line following this TODO
"TRY003", # Avoid specifying long messages outside the exception class
# PEP 695 type syntax is incompatible with the runtime type system here:
# `type` aliases become `TypeAliasType`, which beartype's door API and the
# runtime `__args__` introspection in charts do not support; generic-class
# conversion would also drop PEP 696 TypeVar defaults (which need py3.13).
"UP040", # non-pep695-type-alias
"UP046", # non-pep695-generic-class
]
[tool.ruff.lint.per-file-ignores]
"**/tests/**" = [
"ANN",
"ARG002", # Unused method argument
"ARG005", # Unused lambda argument
"D102",
"D401", # First line of docstring should be in imperative mood
"FBT001",
"INP001",
"N803",
"PLC0415", # tests may import inside functions (e.g. import-smoke tests)
"RUF002",
"S101",
"T20",
]
"__init__.py" = ["F403"]
"docs/conf.py" = ["A001", "INP001"]
"noxfile.py" = ["T20"]
"scripts/**" = ["INP001", "T20"] # CLI helpers; printing is their output
[tool.ruff.lint.flake8-import-conventions.aliases]
"coordinax" = "cx"
"coordinax.angles" = "cxa"
"coordinax.charts" = "cxc"
"coordinax.distances" = "cxd"
"coordinax.frames" = "cxf"
"coordinax.internal" = "cxi"
"coordinax.manifolds" = "cxm"
"coordinax.representations" = "cxr"
"coordinax.transforms" = "cxfm"
"coordinax.vectors" = "cxv"
"coordinaxs.api" = "cxapi"
"coordinaxs.astro" = "cxastro"
"coordinaxs.curveframes" = "cxfc"
"coordinaxs.hypothesis.angles" = "cxast"
"coordinaxs.hypothesis.astro" = "cxastrost"
"coordinaxs.hypothesis.charts" = "cxcst"
"coordinaxs.hypothesis.curveframes" = "cxfcst"
"coordinaxs.hypothesis.distances" = "cxdst"
"coordinaxs.hypothesis.main" = "cxst"
"coordinaxs.hypothesis.manifolds" = "cxmst"
"coordinaxs.hypothesis.representations" = "cxrst"
"coordinaxs.hypothesis.vectors" = "cxvst"
equinox = "eqx"
functools = "ft"
"jax.extend.core" = "jexc"
"jax.tree_util" = "jtu"
unxt = "u"
"unxts.linalg" = "ul"
[tool.ruff.lint.isort]
combine-as-imports = true
known-first-party = [
"dataclassish",
"optional_dependencies",
"quaxed",
"unxt",
"unxts",
"xmmutablemap",
]
known-local-folder = ["coordinax", "coordinaxs"]
section-order = [
"future",
"standard-library",
"typing",
"third-party",
"first-party",
"local-folder",
]
sections = { typing = [
"typing",
"typing_extensions",
"types",
"collections.abc",
"jaxtyping",
] }
split-on-trailing-comma = false
[tool.ty.rules]
invalid-argument-type = "ignore"
[tool.ty.terminal]
output-format = "concise"
[tool.unxts.unxt]
quantity.repr.named_unit = false
quantity.repr.short_arrays = "compact"
quantity.repr.use_short_name = true
quantity.str.named_unit = true
quantity.str.short_arrays = false
quantity.str.use_short_name = true
[tool.uv]
constraint-dependencies = [
"numpy<2.4.0", # Temporary constraint to restrict JAX version
"starlette>=1.0.1",
"tornado>=6.5.6",
]
[tool.uv.sources]
"coordinaxs.api" = { workspace = true }
"coordinaxs.astro" = { workspace = true }
"coordinaxs.curveframes" = { workspace = true }
"coordinaxs.hypothesis" = { workspace = true }
"coordinaxs.interop.astropy" = { workspace = true }
[tool.uv.workspace]
members = ["packages/*"]