diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 83ae6925..18c8b5f9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,10 +35,10 @@ jobs: - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - name: Run the tests - if: ${{ !startsWith(matrix.python-version, 'pypy') && !startsWith(matrix.python-version, '3.7') }} + if: ${{ !startsWith(matrix.python-version, 'pypy') }} run: hatch run cov:test - name: Run the tests on pypy - if: ${{ startsWith(matrix.python-version, 'pypy') || startsWith(matrix.python-version, '3.7') }} + if: ${{ startsWith(matrix.python-version, 'pypy') }} run: hatch run cov:nowarn - uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1 @@ -61,7 +61,7 @@ jobs: - name: Run Linters run: | hatch run typing:test - hatch run lint:style + hatch run lint:build pipx run interrogate -v . pipx run doc8 --max-line-length=200 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9fc2dc4d..261906cc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -57,6 +57,25 @@ repos: - id: rst-directive-colons - id: rst-inline-touching-normal + - repo: https://github.com/pre-commit/mirrors-mypy + rev: "v1.6.1" + hooks: + - id: mypy + files: "^jupyterlab_server" + stages: [manual] + args: ["--install-types", "--non-interactive"] + additional_dependencies: + [ + "traitlets>=5.3", + "jupyter_server>=2.9", + "openapi_core", + "json5", + "pytest", + "werkzeug", + "ruamel.yaml", + "importlib_metadata", + ] + - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.1.3 hooks: diff --git a/pyproject.toml b/pyproject.toml index f6e06905..3ad0248f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,37 +107,24 @@ dependencies = ["coverage", "pytest-cov"] test = "python -m pytest -vv --cov jupyterlab_server --cov-branch --cov-report term-missing:skip-covered {args}" nowarn = "test -W default {args}" -[tool.hatch.envs.typing] -features = ["test"] -dependencies = ["mypy>=1.6.1", "traitlets>=5.11.2", "jupyter_server>=2.8"] -[tool.hatch.envs.typing.scripts] -test = "mypy --install-types --non-interactive {args}" - [tool.hatch.envs.lint] -dependencies = [ - "mdformat>0.7", - "mdformat-gfm>=0.3.5", - "ruff==0.1.3" -] detached = true +dependencies = ["pre-commit"] [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.hatch.envs.typing] +dependencies = [ "pre-commit"] +detached = true +[tool.hatch.envs.typing.scripts] +test = "pre-commit run --all-files --hook-stage manual mypy" [tool.pytest.ini_options] minversion = "6.0" xfail_strict = true log_cli_level = "info" addopts = [ - "-raXs", "--durations=10", "--color=yes", "--doctest-modules", + "-ra", "--durations=10", "--color=yes", "--doctest-modules", "--showlocals", "--strict-markers", "--strict-config" ] testpaths = [ @@ -155,8 +142,7 @@ filterwarnings = [ # From tornado.netutil.bind_sockets "module:unclosed