From 7d2f9fbba6c73deab5913729604310aa1ad324fe Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 4 Nov 2023 16:46:28 -0500 Subject: [PATCH 1/4] clean up lint handling --- .github/workflows/tests.yml | 2 +- .pre-commit-config.yaml | 9 +++++++++ pyproject.toml | 18 +++++------------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0e830581..6c7206d3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -73,7 +73,7 @@ jobs: - name: Run Linters run: | hatch run typing:test - hatch run lint:style + hatch run lint:build pipx run 'validate-pyproject[all]' pyproject.toml pipx run doc8 --max-line-length=200 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 12f2648f..ece3a06e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,6 +50,15 @@ repos: - id: codespell args: ["-L", "sur,nd"] + - repo: https://github.com/pre-commit/mirrors-mypy + rev: "v1.6.1" + hooks: + - id: mypy + files: "^traitlets" + stages: [manual] + args: ["--install-types", "--non-interactive"] + additional_dependencies: ["argcomplete>=3.1"] + - repo: https://github.com/pre-commit/pygrep-hooks rev: "v1.10.0" hooks: diff --git a/pyproject.toml b/pyproject.toml index 6e944824..8718897e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,24 +70,16 @@ test = "python -m pytest -vv --cov traitlets --cov-branch --cov-report term-miss nowarn = "test -W default {args}" [tool.hatch.envs.typing] -features = ["test"] +dependencies = ["pre-commit"] +detached = true [tool.hatch.envs.typing.scripts] -test = "mypy --install-types --non-interactive {args}" +test = "pre-commit run --all-files --hook-stage manual mypy" [tool.hatch.envs.lint] -dependencies = ["mdformat>0.7", "ruff==0.1.3"] +dependencies = ["pre-commit"] detached = true [tool.hatch.envs.lint.scripts] -style = [ - "ruff {args:.}", - "ruff format {args:.}", - "mdformat --check {args:docs *.md}" -] -fmt = [ - "ruff --fix {args:.}", - "ruff format {args:.}", - "mdformat {args:docs *.md}" -] +build = ["pre-commit run --all-files ruff"] [tool.mypy] files = "traitlets" From fdaf2095d69a869b78783397989232196b4cf049 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 4 Nov 2023 16:47:11 -0500 Subject: [PATCH 2/4] update sp-repo-review --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8718897e..22d3acf6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -227,4 +227,4 @@ unfixable = [ "traitlets/*__init__.py" = ["F401", "F403"] [tool.repo-review] -ignore = ["PY007", "PP308", "GH102", "PC140", "MY101"] +ignore = ["PY007", "PP308", "GH102"] From a84d48d7ad395bca9ccdf7477acc7fd001617609 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 4 Nov 2023 16:48:50 -0500 Subject: [PATCH 3/4] update repo-review config --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 22d3acf6..7b9dde16 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,7 +97,7 @@ minversion = "6.0" xfail_strict = true log_cli_level = "info" addopts = [ - "-raXs", "--durations=10", "--color=yes", "--doctest-modules", + "-ra", "-Xs", "--durations=10", "--color=yes", "--doctest-modules", "--showlocals", "--strict-markers", "--strict-config", "--ignore=examples/docs/configs" ] @@ -227,4 +227,4 @@ unfixable = [ "traitlets/*__init__.py" = ["F401", "F403"] [tool.repo-review] -ignore = ["PY007", "PP308", "GH102"] +ignore = ["PY007"] From 04b03d90a69722596c96e864c274a67be808d4ed Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 4 Nov 2023 19:49:42 -0500 Subject: [PATCH 4/4] fix pytest config --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7b9dde16..856f3557 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,7 +97,7 @@ minversion = "6.0" xfail_strict = true log_cli_level = "info" addopts = [ - "-ra", "-Xs", "--durations=10", "--color=yes", "--doctest-modules", + "-ra", "--durations=10", "--color=yes", "--doctest-modules", "--showlocals", "--strict-markers", "--strict-config", "--ignore=examples/docs/configs" ]