chore: improvements to the noxfile

This commit is contained in:
Henry Schreiner
2021-07-15 22:44:39 -04:00
parent 64236303df
commit bed7c6980c
2 changed files with 17 additions and 11 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ repos:
- types-toml - types-toml
- id: mypy - id: mypy
name: mypy 3.7+ on bin/ name: mypy 3.7+ on bin/
files: ^(bin|docs)/.*py$ files: ^((bin|docs)/.*py|noxfile.py)$
args: ["--python-version=3.7", "--scripts-are-modules"] args: ["--python-version=3.7", "--scripts-are-modules"]
additional_dependencies: additional_dependencies:
- packaging>=21.0 - packaging>=21.0
+16 -10
View File
@@ -12,7 +12,7 @@ DIR = Path(__file__).parent.resolve()
@nox.session @nox.session
def tests(session): def tests(session: nox.Session) -> None:
""" """
Run the unit and regular tests. Run the unit and regular tests.
""" """
@@ -26,16 +26,16 @@ def tests(session):
@nox.session @nox.session
def lint(session): def lint(session: nox.Session) -> None:
""" """
Run the linter. Run the linter.
""" """
session.install("pre-commit") session.install("pre-commit")
session.run("pre-commit", "run", "--all-files") session.run("pre-commit", "run", "--all-files", *session.posargs)
@nox.session(python=PYTHON_ALL_VERSIONS) @nox.session(python=PYTHON_ALL_VERSIONS)
def update_constraints(session): def update_constraints(session: nox.Session) -> None:
""" """
Update the dependencies inplace. Update the dependencies inplace.
""" """
@@ -44,7 +44,7 @@ def update_constraints(session):
@nox.session @nox.session
def update_pins(session): def update_pins(session: nox.Session) -> None:
""" """
Update the python and docker pins version inplace. Update the python and docker pins version inplace.
""" """
@@ -54,16 +54,22 @@ def update_pins(session):
@nox.session @nox.session
def update_proj(session): def update_proj(session: nox.Session) -> None:
""" """
Update the README inplace. Update the README inplace.
""" """
session.install("-e", ".[bin]") session.install("-e", ".[bin]")
session.run("python", "bin/projects.py", "docs/data/projects.yml", "--readme=README.md") session.run(
"python",
"bin/projects.py",
"docs/data/projects.yml",
"--readme=README.md",
*session.posargs,
)
@nox.session @nox.session
def docs(session): def docs(session: nox.Session) -> None:
""" """
Build the docs. Build the docs.
""" """
@@ -73,13 +79,13 @@ def docs(session):
if "serve" in session.posargs: if "serve" in session.posargs:
session.run("mkdocs", "serve") session.run("mkdocs", "serve")
else: else:
print("Unrecognized args, use 'serve'") session.error("Unrecognized args, use 'serve'")
else: else:
session.run("mkdocs", "build") session.run("mkdocs", "build")
@nox.session @nox.session
def build(session): def build(session: nox.Session) -> None:
""" """
Build an SDist and wheel. Build an SDist and wheel.
""" """