Skip to content

Commit c5129aa

Browse files
committed
config: update
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
1 parent 24f2e72 commit c5129aa

File tree

5 files changed

+1303
-135
lines changed

5 files changed

+1303
-135
lines changed

.github/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
changelog:
2+
exclude:
3+
authors:
4+
- dependabot
5+
- pre-commit-ci

.github/workflows/ci.yml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: CI
2+
23
permissions:
34
contents: read
45

@@ -19,26 +20,21 @@ env:
1920
FORCE_COLOR: 3
2021

2122
jobs:
22-
pre-commit:
23+
format:
2324
name: Format
2425
runs-on: ubuntu-latest
2526
steps:
2627
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
27-
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
28-
with:
29-
python-version: "3.x"
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v6.6.1
3030
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
31-
with:
32-
extra_args: --hook-stage manual --all-files
3331
- name: Run PyLint
34-
run: |
35-
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
36-
pipx run nox -s pylint
32+
run: uv run --group nox nox -s pylint -- --output-format=github
3733

3834
tests:
3935
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
4036
runs-on: ${{ matrix.runs-on }}
41-
needs: [pre-commit]
37+
needs: [format]
4238
strategy:
4339
fail-fast: false
4440
matrix:
@@ -52,17 +48,14 @@ jobs:
5248
steps:
5349
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5450

55-
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
51+
- name: Install uv
52+
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v6.6.1
5653
with:
5754
python-version: ${{ matrix.python-version }}
58-
allow-prereleases: true
59-
60-
- name: Install package
61-
run: python -m pip install .[test]
6255

6356
- name: Test package
6457
run: >-
65-
python -m pytest -ra --cov --cov-report=xml --cov-report=term
58+
uv run --group test pytest --cov --cov-report=xml --cov-report=term
6659
--durations=20
6760
6861
- name: Upload coverage report
@@ -73,7 +66,7 @@ jobs:
7366
status:
7467
name: CI Pass
7568
runs-on: ubuntu-latest
76-
needs: [pre-commit, tests]
69+
needs: [format, tests]
7770
if: always()
7871
steps:
7972
- name: All required jobs passed

noxfile.py

Lines changed: 66 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,94 @@
11
"""Nox configuration."""
2+
# pylint: disable=import-error
23

34
import shutil
45
from pathlib import Path
56

67
import nox
78

9+
nox.needs_version = ">=2024.3.2"
10+
nox.options.sessions = [
11+
# Linting
12+
"lint",
13+
"precommit",
14+
"pylint",
15+
# Testing
16+
"tests",
17+
]
18+
nox.options.default_venv_backend = "uv"
19+
20+
821
DIR = Path(__file__).parent.resolve()
922

10-
nox.needs_version = ">=2024.3.2"
11-
nox.options.sessions = ["lint", "pylint", "tests"]
12-
nox.options.default_venv_backend = "uv|virtualenv"
23+
# =============================================================================
24+
# Linting
1325

1426

15-
@nox.session
16-
def lint(session: nox.Session) -> None:
27+
@nox.session(venv_backend="uv")
28+
def lint(session: nox.Session, /) -> None:
1729
"""Run the linter."""
18-
session.install("pre-commit")
19-
session.run(
20-
"pre-commit",
21-
"run",
22-
"--all-files",
23-
"--show-diff-on-failure",
24-
*session.posargs,
30+
precommit(session) # reuse pre-commit session
31+
pylint(session) # reuse pylint session
32+
33+
34+
@nox.session(venv_backend="uv")
35+
def precommit(session: nox.Session, /) -> None:
36+
"""Run pre-commit."""
37+
session.run_install(
38+
"uv",
39+
"sync",
40+
"--group=lint",
41+
f"--python={session.virtualenv.location}",
42+
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
2543
)
44+
session.run("pre-commit", "run", "--all-files", *session.posargs)
2645

2746

28-
@nox.session
29-
def pylint(session: nox.Session) -> None:
47+
@nox.session(venv_backend="uv")
48+
def pylint(session: nox.Session, /) -> None:
3049
"""Run PyLint."""
31-
# This needs to be installed into the package environment, and is slower
32-
# than a pre-commit check
33-
session.install(".", "pylint")
34-
session.run("pylint", "zeroth", *session.posargs)
50+
session.run_install(
51+
"uv",
52+
"sync",
53+
"--group=lint",
54+
f"--python={session.virtualenv.location}",
55+
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
56+
)
57+
session.run("pylint", "unxt", *session.posargs)
3558

3659

37-
@nox.session
38-
def tests(session: nox.Session) -> None:
60+
# =============================================================================
61+
# Testing
62+
63+
64+
@nox.session(venv_backend="uv")
65+
def tests(session: nox.Session, /) -> None:
3966
"""Run the unit and regular tests."""
40-
session.install(".[test]")
67+
session.run_install(
68+
"uv",
69+
"sync",
70+
"--group=test",
71+
f"--python={session.virtualenv.location}",
72+
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
73+
)
4174
session.run("pytest", *session.posargs)
4275

4376

44-
@nox.session
45-
def build(session: nox.Session) -> None:
77+
# =============================================================================
78+
79+
80+
@nox.session(venv_backend="uv")
81+
def build(session: nox.Session, /) -> None:
4682
"""Build an SDist and wheel."""
4783
build_path = DIR.joinpath("build")
4884
if build_path.exists():
4985
shutil.rmtree(build_path)
5086

51-
session.install("build")
87+
session.run_install(
88+
"uv",
89+
"sync",
90+
"--group=build",
91+
f"--python={session.virtualenv.location}",
92+
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
93+
)
5294
session.run("python", "-m", "build")

pyproject.toml

Lines changed: 79 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,89 @@
1+
[project]
2+
name = "zeroth"
3+
dynamic = ["version"]
4+
description = "Efficiently get the index-0 element of an iterable."
5+
readme = "README.md"
6+
requires-python = ">=3.9"
7+
authors = [
8+
{ name = "Nathaniel Starkman", email = "nstarman@users.noreply.github.com" },
9+
]
10+
classifiers = [
11+
"Development Status :: 1 - Planning",
12+
"Intended Audience :: Developers",
13+
"Intended Audience :: Science/Research",
14+
"License :: OSI Approved :: MIT License",
15+
"Operating System :: OS Independent",
16+
"Programming Language :: Python :: 3 :: Only",
17+
"Programming Language :: Python :: 3",
18+
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python",
23+
"Topic :: Scientific/Engineering",
24+
"Typing :: Typed",
25+
]
26+
license.file = "LICENSE"
27+
dependencies = []
28+
29+
[project.urls]
30+
"Bug Tracker" = "https://github.com/GalacticDynamics/zeroth/issues"
31+
Changelog = "https://github.com/GalacticDynamics/zeroth/releases"
32+
Discussions = "https://github.com/GalacticDynamics/zeroth/discussions"
33+
Homepage = "https://github.com/GalacticDynamics/zeroth"
34+
35+
136
[build-system]
237
build-backend = "hatchling.build"
338
requires = ["hatch-vcs", "hatchling"]
439

540

6-
[project]
7-
authors = [
8-
{ name = "Nathaniel Starkman", email = "nstarman@users.noreply.github.com" },
9-
]
10-
classifiers = [
11-
"Development Status :: 1 - Planning",
12-
"Intended Audience :: Developers",
13-
"Intended Audience :: Science/Research",
14-
"License :: OSI Approved :: MIT License",
15-
"Operating System :: OS Independent",
16-
"Programming Language :: Python :: 3 :: Only",
17-
"Programming Language :: Python :: 3",
18-
"Programming Language :: Python :: 3.9",
19-
"Programming Language :: Python :: 3.10",
20-
"Programming Language :: Python :: 3.11",
21-
"Programming Language :: Python :: 3.12",
22-
"Programming Language :: Python",
23-
"Topic :: Scientific/Engineering",
24-
"Typing :: Typed",
25-
]
26-
dependencies = []
27-
description = "Efficiently get the index-0 element of an iterable."
28-
dynamic = ["version"]
29-
license.file = "LICENSE"
30-
name = "zeroth"
31-
readme = "README.md"
32-
requires-python = ">=3.9"
33-
34-
[project.optional-dependencies]
35-
dev = ["zeroth[docs,test]"]
36-
docs = [
37-
"furo>=2023.08.17",
38-
"myst_parser>=0.13",
39-
"sphinx>=7.0",
40-
"sphinx_autodoc_typehints",
41-
"sphinx_copybutton",
42-
]
43-
test = [
44-
"numpy",
45-
"optional_dependencies >= 0.3",
46-
"pytest >=6",
47-
"pytest-cov >=3",
48-
"pytest-github-actions-annotate-failures",
49-
"sybil",
50-
]
51-
52-
[project.urls]
53-
"Bug Tracker" = "https://github.com/GalacticDynamics/zeroth/issues"
54-
Changelog = "https://github.com/GalacticDynamics/zeroth/releases"
55-
Discussions = "https://github.com/GalacticDynamics/zeroth/discussions"
56-
Homepage = "https://github.com/GalacticDynamics/zeroth"
41+
[dependency-groups]
42+
dev = [
43+
"ipykernel>=6.29.5",
44+
"cz-conventional-gitmoji>=0.6.1",
45+
{ include-group = "build" },
46+
{ include-group = "docs" },
47+
{ include-group = "lint" },
48+
{ include-group = "nox" },
49+
{ include-group = "test" },
50+
]
51+
build = [
52+
"build>=1.3.0",
53+
]
54+
docs = [
55+
"furo>=2023.08.17",
56+
"myst_parser>=0.13",
57+
"sphinx>=7.0",
58+
"sphinx-autodoc-typehints>=2.3.0",
59+
"sphinx-copybutton>=0.5.2",
60+
]
61+
lint = [
62+
"pre-commit>=4.1.0",
63+
"pylint>=3.3.8",
64+
]
65+
nox = ["nox>=2024.10.9"]
66+
test = [
67+
"numpy>=2.0.2",
68+
"optional_dependencies>=0.3",
69+
"pytest>=8.4.2",
70+
"pytest-cov>=6.2.1",
71+
"pytest-github-actions-annotate-failures>=0.3.0",
72+
"sybil[pytest]>=9.2.0",
73+
]
5774

5875

5976
[tool.hatch]
60-
version.source = "vcs"
77+
build.hooks.vcs.version-file = "src/zeroth/_version.py"
78+
version.source = "vcs"
79+
80+
81+
[tool.codespell]
82+
skip = "uv.lock"
83+
6184

62-
[tool.hatch.envs.default]
63-
features = ["test"]
64-
scripts.test = "pytest {args}"
85+
[tool.commitizen]
86+
name = "cz_gitmoji"
6587

6688

6789
[tool.pytest.ini_options]
@@ -74,8 +96,8 @@
7496
]
7597
filterwarnings = ["error"]
7698
log_cli_level = "INFO"
77-
minversion = "6.0"
78-
testpaths = ["tests/", "docs", "src/"]
99+
minversion = "8.3"
100+
testpaths = ["src/", "tests/", "README.md", "docs"]
79101
xfail_strict = true
80102

81103

0 commit comments

Comments
 (0)