diff --git a/noxfile.py b/noxfile.py index 1fc09ca..14897d5 100644 --- a/noxfile.py +++ b/noxfile.py @@ -31,7 +31,6 @@ import tempfile import typing as t import nox -from nox.sessions import Session from packaging import version as pkg_version @@ -140,7 +139,7 @@ os.makedirs(tempfile.tempdir, exist_ok=True) @nox.session(name="format", python=MAIN_PYTHON) -def format_code(session: Session) -> None: +def format_code(session: nox.Session) -> None: """Format source files with `autoflake`, `black`, `flynt`, `isort`, and `ruff`. If no extra arguments are provided, all source files are formatted. @@ -175,7 +174,7 @@ def format_code(session: Session) -> None: @nox.session(name="lint", python=MAIN_PYTHON) -def lint_code(session: Session) -> None: +def lint_code(session: nox.Session) -> None: """Lint source files with `flake8`, `isort`, `mypy`, and `ruff`. If no extra arguments are provided, all source files are linted. @@ -233,7 +232,7 @@ def lint_code(session: Session) -> None: @nox.session(name="test", python=MAIN_PYTHON) -def test_code(session: Session) -> None: +def test_code(session: nox.Session) -> None: """Run the unit and integration tests with `pytest`. If no extra arguments are provided, the entire test suite @@ -271,7 +270,7 @@ def test_code(session: Session) -> None: @nox.session(name="doctest", python=MAIN_PYTHON) -def test_docstrings(session: Session) -> None: +def test_docstrings(session: nox.Session) -> None: """Test the code snippets in the docstrings with `xdoctest`. By default, all docstrings in the package are checked. @@ -296,7 +295,7 @@ def test_docstrings(session: Session) -> None: @nox.session(name="docs", python=MAIN_PYTHON) -def build_docs(session: Session) -> None: +def build_docs(session: nox.Session) -> None: """Build the documentation with `sphinx`. Also, verify that all external links work. @@ -320,7 +319,7 @@ def build_docs(session: Session) -> None: @nox.session(name="venv", python=MAIN_PYTHON, venv_backend="none") -def create_develop_environment(session: Session) -> None: +def create_develop_environment(session: nox.Session) -> None: """Set up the local develop environment in ".venv". All dependency groups and extras are installed @@ -350,7 +349,7 @@ def create_develop_environment(session: Session) -> None: @nox.session(name="deps-audit", python=MAIN_PYTHON, reuse_venv=False) -def audit_pinned_dependencies(session: Session) -> None: +def audit_pinned_dependencies(session: nox.Session) -> None: """Check dependencies for vulnerabilities with `pip-audit`. The dependencies are all those pinned in the uv.lock file. @@ -394,7 +393,7 @@ def audit_pinned_dependencies(session: Session) -> None: @nox.session(name="deps-lock", python=MAIN_PYTHON, venv_backend="none") -def lock_dependencies(session: Session) -> None: +def lock_dependencies(session: nox.Session) -> None: """Lock dependencies in pyproject.toml into uv.lock. Convenience task to run after manual changes of dependencies @@ -414,7 +413,7 @@ def lock_dependencies(session: Session) -> None: @nox.session(name="deps-upgrade", python=MAIN_PYTHON, venv_backend="none") -def upgrade_dependencies(session: Session) -> None: +def upgrade_dependencies(session: nox.Session) -> None: """Pin dependencies in uv.lock to their latest MINOR/PATCH versions. The allowed versions are the ranges in the pyproject.toml file. @@ -447,7 +446,7 @@ def upgrade_dependencies(session: Session) -> None: @nox.session(name="deps-upgrade-check", python=MAIN_PYTHON) -def check_dependency_upgrades(session: Session) -> None: +def check_dependency_upgrades(session: nox.Session) -> None: """Check the dependencies in uv.lock for upgrades. This task checks if upgrades are available for the PyPI @@ -465,7 +464,7 @@ def check_dependency_upgrades(session: Session) -> None: @nox.session(name="init-project", python=MAIN_PYTHON, venv_backend="none") -def initialize_project(session: Session) -> None: +def initialize_project(session: nox.Session) -> None: """Install the `pre-commit` hooks and configure `git blame`.""" # .pre-commit-config.yaml sets the hook types via "default_install_hook_types" session.run("uv", "run", "pre-commit", "install") @@ -481,7 +480,7 @@ def initialize_project(session: Session) -> None: @nox.session(name="clean-cwd", python=MAIN_PYTHON, venv_backend="none") -def clean_cwd(session: Session) -> None: +def clean_cwd(session: nox.Session) -> None: """Remove (almost) all glob patterns listed in git's ignore file. Compared to `git clean -X`, never remove local environment variables @@ -540,7 +539,7 @@ def _expand(*patterns: str) -> cabc.Generator[pathlib.Path, None, None]: yield path.resolve() -def do_not_accept_arguments(session: Session, *, raise_error: bool = True) -> None: +def do_not_accept_arguments(session: nox.Session, *, raise_error: bool = True) -> None: """Do not accept any `session.posargs`.""" if session.posargs: msg = 'be run without any positional arguments behind the "--"' @@ -551,7 +550,7 @@ def do_not_accept_arguments(session: Session, *, raise_error: bool = True) -> No session.warn(f"Should {msg}") -def do_not_reuse(session: Session, *, raise_error: bool = True) -> None: +def do_not_reuse(session: nox.Session, *, raise_error: bool = True) -> None: """Do not reuse a session with the "-r" or "-R" flags.""" if session._runner.venv._reused: msg = 'be run without the "-r" and "-R" flags' @@ -562,7 +561,7 @@ def do_not_reuse(session: Session, *, raise_error: bool = True) -> None: session.warn(f"Should {msg}") -def start(session: Session) -> None: +def start(session: nox.Session) -> None: """Show generic info about a session.""" if session.posargs: session.debug(f"Received extra arguments: {session.posargs}") @@ -597,7 +596,7 @@ def start(session: Session) -> None: def install_pinned( - session: Session, + session: nox.Session, *packages_or_pip_args: str, **kwargs: t.Any, ) -> None: @@ -634,7 +633,7 @@ def install_pinned( ) -def skip_install(session: Session) -> bool: +def skip_install(session: nox.Session) -> bool: """Installations may be skipped if a virtual environment can be reused. Skipping package installations must be requested with the "-R" flag.