diff --git a/.github/workflows/reusable-rr-tests.yml b/.github/workflows/reusable-rr-tests.yml index 9ba13e35..bf7a9a14 100644 --- a/.github/workflows/reusable-rr-tests.yml +++ b/.github/workflows/reusable-rr-tests.yml @@ -28,11 +28,10 @@ jobs: python-version: ${{ matrix.python-version }} allow-prereleases: true - - name: Install package - run: python -m pip install .[test,cli] + - uses: astral-sh/setup-uv@v6 - name: Test package - run: python -m pytest -ra + run: uv run pytest -ra env: PYTHONWARNDEFAULTENCODING: 1 @@ -57,11 +56,13 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.13" + + - uses: astral-sh/setup-uv@v6 - name: Rerender README run: | - pipx run nox -s readme + uvx nox -s readme git diff --exit-code pylint: @@ -72,5 +73,11 @@ jobs: with: fetch-depth: 0 + - uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - uses: astral-sh/setup-uv@v6 + - name: Run pylint - run: pipx run nox[uv] -s rr_pylint -- --output-format=github + run: uvx nox -s rr_pylint -- --output-format=github diff --git a/noxfile.py b/noxfile.py index 56ec46d1..2b51efb9 100644 --- a/noxfile.py +++ b/noxfile.py @@ -24,10 +24,11 @@ import nox -nox.needs_version = ">=2024.3.2" +nox.needs_version = ">=2025.2.9" nox.options.sessions = ["rr_lint", "rr_tests", "rr_pylint", "readme"] nox.options.default_venv_backend = "uv|virtualenv" + DIR = Path(__file__).parent.resolve() with DIR.joinpath("cookiecutter.json").open() as f: BACKENDS = json.load(f)["backend"] @@ -178,7 +179,7 @@ def diff_files(p1: Path, p2: Path) -> bool: return same -@nox.session() +@nox.session(default=False) @nox.parametrize("vcs", [False, True], ids=["novcs", "vcs"]) @nox.parametrize("backend", BACKENDS, ids=BACKENDS) def lint(session: nox.Session, backend: str, vcs: bool) -> None: @@ -198,7 +199,7 @@ def lint(session: nox.Session, backend: str, vcs: bool) -> None: ) -@nox.session +@nox.session(default=False) @nox.parametrize("backend", BACKENDS, ids=BACKENDS) def autoupdate(session: nox.Session, backend: str) -> None: session.install("cookiecutter", "pre-commit") @@ -212,7 +213,7 @@ def autoupdate(session: nox.Session, backend: str) -> None: session.run("git", "diff", "--exit-code", external=True) -@nox.session() +@nox.session(default=False) @nox.parametrize("vcs", [False, True], ids=["novcs", "vcs"]) @nox.parametrize("backend", BACKENDS, ids=BACKENDS) def tests(session: nox.Session, backend: str, vcs: bool) -> None: @@ -236,7 +237,7 @@ def tests(session: nox.Session, backend: str, vcs: bool) -> None: assert version == expected_version, f"{version=} != {expected_version=}" -@nox.session() +@nox.session(default=False) @nox.parametrize("vcs", [False, True], ids=["novcs", "vcs"]) @nox.parametrize("backend", ("poetry", "pdm", "hatch"), ids=("poetry", "pdm", "hatch")) def native(session: nox.Session, backend: str, vcs: bool) -> None: @@ -257,7 +258,7 @@ def native(session: nox.Session, backend: str, vcs: bool) -> None: session.run(backend, "run", "pytest") -@nox.session() +@nox.session(default=False) @nox.parametrize("vcs", [False, True], ids=["novcs", "vcs"]) @nox.parametrize("backend", BACKENDS, ids=BACKENDS) def dist(session: nox.Session, backend: str, vcs: bool) -> None: @@ -305,7 +306,7 @@ def dist(session: nox.Session, backend: str, vcs: bool) -> None: wheel.rename(dist / wheel.stem) -@nox.session(name="nox") +@nox.session(name="nox", default=False) @nox.parametrize("vcs", [False, True], ids=["novcs", "vcs"]) @nox.parametrize("backend", BACKENDS, ids=BACKENDS) def nox_session(session: nox.Session, backend: str, vcs: bool) -> None: @@ -322,7 +323,7 @@ def nox_session(session: nox.Session, backend: str, vcs: bool) -> None: session.run("nox") -@nox.session() +@nox.session(default=False) def compare_copier(session): # Copier 9.5.0 broke `--data` # Copier 9.7.0/9.7.1 broke everything @@ -342,7 +343,7 @@ def compare_copier(session): session.error(f"{backend} {vcs=} files are not the same!") -@nox.session() +@nox.session(default=False) def compare_cruft(session): session.install("cookiecutter", "cruft") @@ -375,7 +376,7 @@ def compare_cruft(session): GHA_VERS = re.compile(r"[\s\-]+uses: (.*?)@([^\s]+)") -@nox.session(reuse_venv=True) +@nox.session(reuse_venv=True, default=False) def pc_bump(session: nox.Session) -> None: """ Bump the pre-commit versions. @@ -439,7 +440,7 @@ def get_latest_version_tag(repo: str, old_version: str) -> dict[str, Any] | None return None -@nox.session(venv_backend="none") +@nox.session(venv_backend="none", default=False) def gha_bump(session: nox.Session) -> None: """ Bump the GitHub Actions. @@ -484,7 +485,7 @@ def readme(session: nox.Session) -> None: session.run("cog", "-P", *args, "README.md") -@nox.session(reuse_venv=True) +@nox.session(reuse_venv=True, default=False) def rr_run(session: nox.Session) -> None: """ Run sp-repo-review. @@ -519,19 +520,18 @@ def rr_tests(session: nox.Session) -> None: """ Run the unit and regular tests for sp-repo-review. """ - session.install("-e.[test,cli]") + pyproject = nox.project.load_toml() + test_deps = nox.project.dependency_groups(pyproject, "test") + + session.install("-e.[cli]", *test_deps) session.run("pytest", *session.posargs, env={"PYTHONWARNDEFAULTENCODING": "1"}) -@nox.session(reuse_venv=True) +@nox.session(reuse_venv=True, default=False) def rr_build(session: nox.Session) -> None: """ Build an SDist and wheel for sp-repo-review. """ - build_p = DIR.joinpath("build") - if build_p.exists(): - shutil.rmtree(build_p) - session.install("build") session.run("python", "-m", "build") diff --git a/pyproject.toml b/pyproject.toml index e0331c2e..6f23da22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ authors = [ ] description = "Review repos for compliance to the Scientific-Python development guidelines" requires-python = ">=3.10" -license-expression = 'BSD-3-Clause' +license = 'BSD-3-Clause' classifiers = [ "Development Status :: 4 - Beta", "Environment :: Console", @@ -40,13 +40,6 @@ dependencies = [ cli = [ "repo-review[cli]", ] -test = [ - "pytest >=7", - "repo-review >=0.10.6", -] -dev = [ - "pytest >=7", -] pyproject = [ "validate-pyproject-schema-store[all]", ] @@ -82,6 +75,16 @@ setupcfg = "sp_repo_review.checks.setupcfg:setupcfg" [project.entry-points."repo_review.families"] scikit-hep = "sp_repo_review.families:get_families" +[dependency-groups] +dev = [ + { include-group = "test" }, + "repo-review[cli]", + "validate-pyproject-schema-store[all]", +] +test = [ + "pytest >=7", + "repo-review >=0.10.6", +] [tool.hatch] version.source = "vcs"