Rename the nox session functions ...

... and add type hints
This commit is contained in:
Alexander Hess 2026-11-26 16:23:12 +01:00
commit 50d5b885bf
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -145,7 +145,7 @@ os.makedirs(tempfile.tempdir, exist_ok=True)
@nox.session(name='format', python=MAIN_PYTHON) @nox.session(name='format', python=MAIN_PYTHON)
def format_(session): def format_code(session: Session) -> None:
"""Format source files with autoflake, black, and isort. """Format source files with autoflake, black, and isort.
If no extra arguments are provided, all source files are formatted. If no extra arguments are provided, all source files are formatted.
@ -172,8 +172,8 @@ def format_(session):
session.run('isort', *locations) session.run('isort', *locations)
@nox.session(python=MAIN_PYTHON) @nox.session(name='lint', python=MAIN_PYTHON)
def lint(session): def lint_code(session: Session) -> None:
"""Lint source files with flake8 and mypy. """Lint source files with flake8 and mypy.
If no extra arguments are provided, all source files are linted. If no extra arguments are provided, all source files are linted.
@ -216,8 +216,8 @@ def lint(session):
session.log('No paths to be checked with mypy') session.log('No paths to be checked with mypy')
@nox.session(python=MAIN_PYTHON) @nox.session(name='test', python=MAIN_PYTHON)
def test(session): def test_code(session: Session) -> None:
"""Test the code base. """Test the code base.
Runs the unit and integration tests with pytest and Runs the unit and integration tests with pytest and
@ -325,8 +325,8 @@ def audit_pinned_dependencies(session: Session) -> None:
) )
@nox.session(python=MAIN_PYTHON) @nox.session(name='docs', python=MAIN_PYTHON)
def docs(session): def build_docs(session: Session) -> None:
"""Build the documentation with sphinx.""" """Build the documentation with sphinx."""
start(session) start(session)
@ -467,7 +467,7 @@ def _expand(*patterns: str) -> Generator[pathlib.Path, None, None]:
@nox.session(name='init-project', python=MAIN_PYTHON, venv_backend='none') @nox.session(name='init-project', python=MAIN_PYTHON, venv_backend='none')
def init_project(session): def initialize_project(session: Session) -> None:
"""Install the pre-commit hooks.""" """Install the pre-commit hooks."""
for type_ in ('pre-commit', 'pre-merge-commit', 'pre-push'): for type_ in ('pre-commit', 'pre-merge-commit', 'pre-push'):
session.run('uv', 'run', 'pre-commit', 'install', f'--hook-type={type_}') session.run('uv', 'run', 'pre-commit', 'install', f'--hook-type={type_}')