Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up lint and ci #418

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
36 changes: 11 additions & 25 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -155,8 +142,7 @@ filterwarnings = [
# From tornado.netutil.bind_sockets
"module:unclosed <socket.socket:ResourceWarning",
# From jupyter_client
"module:datetime.datetime.utcfromtimestamp:DeprecationWarning",
"module:datetime.datetime.utcnow:DeprecationWarning",
"module:datetime.datetime.utc:DeprecationWarning",
]

[tool.coverage.report]
Expand Down Expand Up @@ -280,4 +266,4 @@ relative_files = true
source = ["jupyterlab_server"]

[tool.repo-review]
ignore = ["PY007", "PP308", "GH102", "PC140"]
ignore = ["PY007", "GH102"]
Loading