Skip to content

Commit

Permalink
chore: read dep groups in noxfile
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Nov 3, 2024
1 parent fb2a4c1 commit f9d716f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.1
rev: v0.7.2
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down
10 changes: 7 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ def install_and_run(session: nox.Session, script: str, *args: str, **kwargs: Any
return session.run("python", script, *args, **kwargs)


def dep_group(group: str) -> list[str]:
return nox.project.load_toml("pyproject.toml")["dependency-groups"][group] # type: ignore[no-any-return]


@nox.session
def tests(session: nox.Session) -> None:
"""
Run the unit and regular tests.
"""
session.install("-e.[test]")
session.install("-e.", *dep_group("test"))
if session.posargs:
session.run("pytest", *session.posargs)
else:
Expand Down Expand Up @@ -123,7 +127,7 @@ def update_pins(session: nox.Session) -> None:
"""
Update the python, docker and virtualenv pins version inplace.
"""
session.install("-e.[bin]")
session.install("-e.", *dep_group("bin"))
session.run("python", "bin/update_pythons.py", "--force")
session.run("python", "bin/update_docker.py")
session.run("python", "bin/update_virtualenv.py", "--force")
Expand Down Expand Up @@ -166,7 +170,7 @@ def docs(session: nox.Session) -> None:
"""
Build the docs. Will serve unless --non-interactive
"""
session.install("-e.[docs]")
session.install("-e.", *dep_group("docs"))
session.run("mkdocs", "serve" if session.interactive else "build", "--strict", *session.posargs)


Expand Down

0 comments on commit f9d716f

Please sign in to comment.