Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/reusable-rr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:
Expand All @@ -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
36 changes: 18 additions & 18 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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:
Expand All @@ -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")
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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")

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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")
19 changes: 11 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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]",
]
Expand Down Expand Up @@ -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"
Expand Down
Loading