Skip to content

Commit

Permalink
Run mypy with nox
Browse files Browse the repository at this point in the history
Add mypy, pre-commit, nox to dev/test deps
  • Loading branch information
mfisher87 committed Jun 19, 2024
1 parent 875a9f3 commit eebb6a3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
20 changes: 2 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,13 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
hooks:
- id: prettier
types_or: [yaml, html, css, scss, javascript, json]
args: [--prose-wrap=always]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.1"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format

# TODO: Run with nox
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.9.0"
hooks:
- id: mypy
files: src|tests
args: []
additional_dependencies:
- pytest

- repo: https://github.com/codespell-project/codespell
rev: "v2.2.6"
hooks:
Expand Down Expand Up @@ -85,4 +68,5 @@ repos:
hooks:
- id: check-dependabot
- id: check-github-workflows
- id: check-readthedocs
# TODO: Re-enable; falsely considers "tools" a required prop
# - id: check-readthedocs
8 changes: 7 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
DIR = Path(__file__).parent.resolve()

nox.needs_version = ">=2024.3.2"
nox.options.sessions = ["lint", "test"]
nox.options.sessions = ["lint", "typecheck", "test"]
nox.options.default_venv_backend = "uv|virtualenv"


Expand All @@ -22,6 +22,12 @@ def lint(session: nox.Session) -> None:
)


@nox.session
def typecheck(session: nox.Session) -> None:
session.install(".[test]")
session.run("mypy")


@nox.session
def test(session: nox.Session) -> None:
"""Run the unit and regular tests."""
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ aross-stations-db = "aross_stations_db.cli:cli"
test = [
"pytest >=6",
"pytest-cov >=3",
"mypy >=1.10",
]
dev = [
"pytest >=6",
"pytest-cov >=3",
"nox",
"pre-commit",
]
docs = [
"sphinx>=7.0",
Expand Down

0 comments on commit eebb6a3

Please sign in to comment.