Skip to content

Commit

Permalink
fix(ci): errors with mypy in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
engeir committed Dec 7, 2023
1 parent 7b195f6 commit 3d6dcf3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 27 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pip==23.0
nox==2022.11.21
nox-poetry==1.0.2
poetry==1.2.2
virtualenv==20.19.0
pip==23.2.1
nox==2023.4.22
nox-poetry==1.0.3
poetry==1.7.1
virtualenv==20.16.6
35 changes: 16 additions & 19 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

package = "ncdump_rich"
python_versions = ["3.11", "3.10", "3.9"]
nox.needs_version = ">= 2021.6.6"
nox.needs_version = ">= 2023.4.22"
nox.options.sessions = (
"pre-commit",
"mypy",
"black",
"ruff",
"tests",
"typeguard",
"xdoctest",
Expand All @@ -45,11 +45,11 @@ def install_with_constraints(session: Session, *args: str, **kwargs: Any) -> Non
Parameters
----------
session: Session
session : Session
The Session object.
args: str
*args : str
Command-line arguments for pip.
kwargs: Any
**kwargs : Any
Additional keyword arguments for Session.install.
"""
with tempfile.NamedTemporaryFile() as requirements:
Expand All @@ -76,7 +76,8 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
Parameters
----------
session: The Session object.
session : Session
The Session object.
"""
if session.bin is None:
return
Expand Down Expand Up @@ -124,17 +125,13 @@ def precommit(session: Session) -> None:
"""Lint using pre-commit."""
args = session.posargs or ["run", "--all-files", "--show-diff-on-failure"]
session.install(
"black",
"darglint",
"flake8",
"flake8-bandit",
"flake8-bugbear",
"flake8-docstrings",
"flake8-rst-docstrings",
"pep8-naming",
"ruff",
"pydoclint",
"mypy",
"pytest",
"pre-commit",
"pre-commit-hooks",
"reorder-python-imports",
"xdoctest",
)
session.run("pre-commit", *args)
if args and args[0] == "install":
Expand All @@ -153,11 +150,11 @@ def mypy(session: Session) -> None:


@session(python=python_versions)
def black(session: Session) -> None:
"""Format using black."""
def ruff(session: Session) -> None:
"""Format using ruff."""
args = session.posargs or ["src", "tests", "docs/conf.py"]
session.install("black")
session.run("black", *args)
session.install("ruff")
session.run("ruff", *args)


@session(python=python_versions)
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ pretty = true
show_column_numbers = true
show_error_codes = true
show_error_context = true
strict = true
strict_equality = true
strict_optional = true
warn_no_return = true
Expand Down Expand Up @@ -180,11 +179,10 @@ docstring-quotes = "double"
numpy = "np"
scipy = "sp"
xarray = "xr"
paper1_code = "core"

[tool.ruff.isort]
case-sensitive = true
known-local-folder = ["src", "paper1_code"]
known-local-folder = ["src", "ncdump_rich"]

[tool.isort]
multi_line_output = 3
Expand Down
1 change: 1 addition & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import netCDF4
import pytest
from click.testing import CliRunner

from ncdump_rich import __main__


Expand Down

0 comments on commit 3d6dcf3

Please sign in to comment.