Skip to content

Commit fbe5a7b

Browse files
authored
👷 build(pre-commit): update (#475)
Signed-off-by: nstarman <[email protected]>
1 parent 44cc2ff commit fbe5a7b

27 files changed

+130
-137
lines changed

‎.pre-commit-config.yaml‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ default_stages: [pre-commit, pre-push]
77

88
repos:
99
- repo: https://github.com/commitizen-tools/commitizen
10-
rev: v4.2.2
10+
rev: v4.10.0
1111
hooks:
1212
- id: commitizen
1313
additional_dependencies: [cz-conventional-gitmoji]
@@ -17,12 +17,12 @@ repos:
1717
- id: check-useless-excludes
1818

1919
- repo: https://github.com/scientific-python/cookie
20-
rev: 2025.01.22
20+
rev: 2025.11.21
2121
hooks:
2222
- id: sp-repo-review
2323

2424
- repo: https://github.com/pre-commit/pre-commit-hooks
25-
rev: "v5.0.0"
25+
rev: "v6.0.0"
2626
hooks:
2727
- id: check-added-large-files
2828
- id: check-case-conflict
@@ -44,38 +44,38 @@ repos:
4444
- id: rst-inline-touching-normal
4545

4646
- repo: https://github.com/python-jsonschema/check-jsonschema
47-
rev: "0.34.1"
47+
rev: "0.35.0"
4848
hooks:
4949
- id: check-dependabot
5050
- id: check-github-workflows
5151
- id: check-readthedocs
5252

5353
- repo: https://github.com/astral-sh/ruff-pre-commit
54-
rev: "v0.9.7"
54+
rev: "v0.14.8"
5555
hooks:
5656
# Run the linter
57-
- id: ruff
57+
- id: ruff-check
5858
types_or: [python, pyi, jupyter]
5959
args: ["--fix", "--show-fixes"]
6060
# Run the formatter
6161
- id: ruff-format
6262
types_or: [python, pyi, jupyter]
6363

6464
- repo: https://github.com/adamchainz/blacken-docs
65-
rev: "1.19.1"
65+
rev: "1.20.0"
6666
hooks:
6767
- id: blacken-docs
6868
additional_dependencies: [black==24.*]
6969

7070
- repo: https://github.com/rbubley/mirrors-prettier
71-
rev: "v3.5.2"
71+
rev: "v3.7.4"
7272
hooks:
7373
- id: prettier
7474
types_or: [yaml, markdown, html, css, scss, javascript, json]
7575
args: [--prose-wrap=always]
7676

7777
- repo: https://github.com/pre-commit/mirrors-mypy
78-
rev: "v1.15.0"
78+
rev: "v1.19.0"
7979
hooks:
8080
- id: mypy
8181
files: src
@@ -91,7 +91,7 @@ repos:
9191
- id: codespell
9292

9393
- repo: https://github.com/abravalheri/validate-pyproject
94-
rev: "v0.23"
94+
rev: "v0.24.1"
9595
hooks:
9696
- id: validate-pyproject
9797
# additional_dependencies: ["validate-pyproject-schema-store[all]"]

‎noxfile.py‎

Lines changed: 51 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,71 @@
1-
"""Nox sessions."""
1+
#!/usr/bin/env -S uv run --script # noqa: EXE001
2+
# /// script
3+
# dependencies = ["nox"]
4+
# ///
25
# pylint: disable=import-error
6+
"""Nox sessions."""
37

48
import argparse
59
import shutil
610
from pathlib import Path
711

812
import nox
13+
from nox_uv import session
914

1015
DIR = Path(__file__).parent.resolve()
1116

1217
nox.needs_version = ">=2024.3.2"
13-
nox.options.sessions = [
14-
# Linting
15-
"lint",
16-
"pylint",
17-
# Testing
18-
"tests",
19-
"tests_benchmark",
20-
# Documentation
21-
"docs",
22-
"build_api_docs",
23-
]
2418
nox.options.default_venv_backend = "uv"
2519

2620

2721
# =============================================================================
2822
# Linting
2923

3024

31-
@nox.session(venv_backend="uv")
32-
def lint(session: nox.Session, /) -> None:
25+
session(uv_groups=["lint"], reuse_venv=True)
26+
27+
28+
def lint(s: nox.Session, /) -> None:
3329
"""Run the linter."""
34-
precommit(session) # reuse pre-commit session
35-
pylint(session) # reuse pylint session
30+
precommit(s) # reuse pre-commit session
31+
pylint(s) # reuse pylint session
3632

3733

38-
@nox.session
39-
def precommit(session: nox.Session) -> None:
34+
@session(uv_groups=["lint"], reuse_venv=True)
35+
def precommit(s: nox.Session, /) -> None:
4036
"""Run the linter."""
41-
session.run_install(
42-
"uv",
43-
"sync",
44-
"--group=lint",
45-
f"--python={session.virtualenv.location}",
46-
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
47-
)
48-
session.run("pre-commit", "run", "--all-files", *session.posargs)
37+
s.run("pre-commit", "run", "--all-files", *s.posargs)
4938

5039

51-
@nox.session(venv_backend="uv")
52-
def pylint(session: nox.Session, /) -> None:
40+
@session(uv_groups=["lint"], reuse_venv=True)
41+
def pylint(s: nox.Session, /) -> None:
5342
"""Run PyLint."""
54-
session.run_install(
55-
"uv",
56-
"sync",
57-
"--group=lint",
58-
f"--python={session.virtualenv.location}",
59-
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
60-
)
61-
session.run("pylint", "coordinax", *session.posargs)
43+
s.install(".", "pylint")
44+
s.run("pylint", "quaxed", *s.posargs)
6245

6346

6447
# =============================================================================
6548
# Testing
6649

6750

68-
@nox.session(venv_backend="uv")
69-
def tests(session: nox.Session, /) -> None:
51+
@session(uv_groups=["test"], reuse_venv=True)
52+
def pytest(s: nox.Session, /) -> None:
7053
"""Run the unit and regular tests."""
71-
session.run_install(
72-
"uv",
73-
"sync",
74-
"--group=test",
75-
f"--python={session.virtualenv.location}",
76-
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
77-
)
78-
session.run("pytest", *session.posargs)
54+
s.run("pytest", *s.posargs)
7955

8056

81-
@nox.session
82-
def tests_benckmark(session: nox.Session, /) -> None:
57+
@session(uv_groups=["test"], reuse_venv=True)
58+
def benchmark(s: nox.Session, /) -> None:
8359
"""Run the benchmarks."""
84-
session.run_install(
85-
"uv",
86-
"sync",
87-
"--group=test",
88-
f"--python={session.virtualenv.location}",
89-
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
90-
)
91-
session.run("pytest", "tests/benchmark", "--codspeed", *session.posargs)
60+
s.run("pytest", "tests/benchmark", "--codspeed", *s.posargs)
9261

9362

9463
# =============================================================================
9564
# Documentation
9665

9766

98-
@nox.session(reuse_venv=True)
99-
def docs(session: nox.Session) -> None:
67+
@session(uv_groups=["docs"], reuse_venv=True)
68+
def docs(s: nox.Session, /) -> None:
10069
"""Build the docs. Pass "--serve" to serve. Pass "-b linkcheck" to check links."""
10170
parser = argparse.ArgumentParser()
10271
parser.add_argument("--serve", action="store_true", help="Serve after building")
@@ -108,26 +77,26 @@ def docs(session: nox.Session) -> None:
10877
)
10978
parser.add_argument("--offline", action="store_true", help="run in offline mode")
11079
parser.add_argument("--output-dir", dest="output_dir", default="_build")
111-
args, posargs = parser.parse_known_args(session.posargs)
80+
args, posargs = parser.parse_known_args(s.posargs)
11281

11382
if args.builder != "html" and args.serve:
114-
session.error("Must not specify non-HTML builder with --serve")
83+
s.error("Must not specify non-HTML builder with --serve")
11584

11685
offline_command = ["--offline"] if args.offline else []
11786

118-
session.run_install(
87+
s.run_install(
11988
"uv",
12089
"sync",
12190
"--group=docs",
122-
f"--python={session.virtualenv.location}",
91+
f"--python={s.virtualenv.location}",
12392
"--active",
12493
*offline_command,
125-
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
94+
env={"UV_PROJECT_ENVIRONMENT": s.virtualenv.location},
12695
)
127-
session.chdir("docs")
96+
s.chdir("docs")
12897

12998
if args.builder == "linkcheck":
130-
session.run(
99+
s.run(
131100
"sphinx-build",
132101
"-b",
133102
"linkcheck",
@@ -149,17 +118,17 @@ def docs(session: nox.Session) -> None:
149118
)
150119

151120
if args.serve:
152-
session.run("sphinx-autobuild", *shared_args)
121+
s.run("sphinx-autobuild", *shared_args)
153122
else:
154-
session.run("sphinx-build", "--keep-going", *shared_args)
123+
s.run("sphinx-build", "--keep-going", *shared_args)
155124

156125

157-
@nox.session
158-
def build_api_docs(session: nox.Session) -> None:
126+
@session(uv_groups=["docs"], reuse_venv=True)
127+
def build_api_docs(s: nox.Session, /) -> None:
159128
"""Build (regenerate) API docs."""
160-
session.install("sphinx")
161-
session.chdir("docs")
162-
session.run(
129+
s.install("sphinx")
130+
s.chdir("docs")
131+
s.run(
163132
"sphinx-apidoc",
164133
"-o",
165134
"api/",
@@ -173,12 +142,18 @@ def build_api_docs(session: nox.Session) -> None:
173142
# =============================================================================
174143

175144

176-
@nox.session
177-
def build(session: nox.Session) -> None:
145+
@session(uv_groups=["build"], reuse_venv=True)
146+
def build(s: nox.Session, /) -> None:
178147
"""Build an SDist and wheel."""
179148
build_path = DIR.joinpath("build")
180149
if build_path.exists():
181150
shutil.rmtree(build_path)
182151

183-
session.install("build")
184-
session.run("python", "-m", "build")
152+
s.install("build")
153+
s.run("python", "-m", "build")
154+
155+
156+
################################################################################
157+
158+
if __name__ == "__main__":
159+
nox.main()

‎pyproject.toml‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"Development Status :: 3 - Alpha",
1616
"Intended Audience :: Science/Research",
1717
"Intended Audience :: Developers",
18-
"License :: OSI Approved :: MIT License",
1918
"Operating System :: OS Independent",
2019
"Programming Language :: Python",
2120
"Programming Language :: Python :: 3",
@@ -38,7 +37,7 @@
3837
"plum-dispatch>=2.5.7",
3938
"quax>=0.2.1",
4039
"quax-blocks>=0.4.0",
41-
"quaxed>=0.10.2",
40+
"quaxed>=0.10.4",
4241
"typing-extensions>=4.13.2",
4342
"unxt>=1.7.3",
4443
"wadler-lindig>=0.1.6",
@@ -87,7 +86,10 @@ build-backend = "hatchling.build"
8786
lint = [
8887
"pylint>=3.3.2",
8988
]
90-
nox = ["nox>=2024.10.9"]
89+
nox = [
90+
"nox>=2024.10.9",
91+
"nox-uv",
92+
]
9193
test = [
9294
"hypothesis[numpy]>=6.112.2",
9395
"pytest>=8.3.3",
@@ -226,7 +228,7 @@ skip = ["uv.lock"]
226228
"ignore:Explicitly requested dtype <class 'jax.numpy\\.float64'> requested in astype is not available",
227229
"ignore:jax\\.core\\.pp_eqn_rules is deprecated:DeprecationWarning",
228230
]
229-
log_cli_level = "INFO"
231+
log_level = "INFO"
230232
minversion = "8.3"
231233
testpaths = ["README", "src/", "docs/", "tests/"]
232234
norecursedirs = [

‎src/coordinax/_src/distances/base.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def distance(self) -> "AbstractDistance": # TODO: more specific type
3232
Distance(Array(1., dtype=float32, ...), unit='kpc')
3333
3434
"""
35-
from coordinax.distance import Distance
35+
from coordinax.distance import Distance # noqa: PLC0415
3636

3737
return Distance.from_(self)
3838

@@ -56,7 +56,7 @@ def distance_modulus(self) -> "AbstractDistance":
5656
DistanceModulus(Array(10., dtype=float32), unit='mag')
5757
5858
"""
59-
from coordinax.distance import DistanceModulus
59+
from coordinax.distance import DistanceModulus # noqa: PLC0415
6060

6161
return DistanceModulus.from_(self)
6262

@@ -85,7 +85,7 @@ def parallax(self) -> "AbstractDistance": # TODO: more specific type
8585
True
8686
8787
"""
88-
from coordinax.angle import Parallax
88+
from coordinax.angle import Parallax # noqa: PLC0415
8989

9090
return Parallax.from_(self)
9191

‎src/coordinax/_src/frames/register_ops.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from coordinax._src.operators import AbstractOperator
1010

1111

12-
@AbstractOperator.__call__.dispatch # type: ignore[misc]
12+
@AbstractOperator.__call__.dispatch # type: ignore[untyped-decorator]
1313
def call(self: AbstractOperator, x: Coordinate, /) -> Coordinate:
1414
"""Apply the operator to a coordinate.
1515

‎src/coordinax/_src/operators/base.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def __or__(self, other: "AbstractOperator") -> "coordinax.ops.Pipe":
198198
Pipe((Identity(), GalileanRotation(rotation=i32[3,3]), Identity()))
199199
200200
"""
201-
from .pipe import Pipe
201+
from .pipe import Pipe # noqa: PLC0415
202202

203203
if isinstance(other, Pipe):
204204
return other.__ror__(self)

‎src/coordinax/_src/operators/boost.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def inverse(self) -> "VelocityBoost":
107107

108108
# -----------------------------------------------------
109109

110-
@AbstractOperator.__call__.dispatch # type: ignore[misc]
110+
@AbstractOperator.__call__.dispatch # type: ignore[untyped-decorator]
111111
def __call__(self: "VelocityBoost", p: AbstractVel, /) -> AbstractVel:
112112
"""Apply the boost to the coordinates.
113113

0 commit comments

Comments
 (0)