Skip to content

Commit 33d2009

Browse files
authored
Clean up lint and ci (#418)
1 parent 150482a commit 33d2009

File tree

3 files changed

+33
-28
lines changed

3 files changed

+33
-28
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ jobs:
3535
- name: Base Setup
3636
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
3737
- name: Run the tests
38-
if: ${{ !startsWith(matrix.python-version, 'pypy') && !startsWith(matrix.python-version, '3.7') }}
38+
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
3939
run: hatch run cov:test
4040
- name: Run the tests on pypy
41-
if: ${{ startsWith(matrix.python-version, 'pypy') || startsWith(matrix.python-version, '3.7') }}
41+
if: ${{ startsWith(matrix.python-version, 'pypy') }}
4242
run: hatch run cov:nowarn
4343
- uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1
4444

@@ -61,7 +61,7 @@ jobs:
6161
- name: Run Linters
6262
run: |
6363
hatch run typing:test
64-
hatch run lint:style
64+
hatch run lint:build
6565
pipx run interrogate -v .
6666
pipx run doc8 --max-line-length=200
6767

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,25 @@ repos:
5757
- id: rst-directive-colons
5858
- id: rst-inline-touching-normal
5959

60+
- repo: https://github.com/pre-commit/mirrors-mypy
61+
rev: "v1.6.1"
62+
hooks:
63+
- id: mypy
64+
files: "^jupyterlab_server"
65+
stages: [manual]
66+
args: ["--install-types", "--non-interactive"]
67+
additional_dependencies:
68+
[
69+
"traitlets>=5.3",
70+
"jupyter_server>=2.9",
71+
"openapi_core",
72+
"json5",
73+
"pytest",
74+
"werkzeug",
75+
"ruamel.yaml",
76+
"importlib_metadata",
77+
]
78+
6079
- repo: https://github.com/astral-sh/ruff-pre-commit
6180
rev: v0.1.3
6281
hooks:

pyproject.toml

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -107,37 +107,24 @@ dependencies = ["coverage", "pytest-cov"]
107107
test = "python -m pytest -vv --cov jupyterlab_server --cov-branch --cov-report term-missing:skip-covered {args}"
108108
nowarn = "test -W default {args}"
109109

110-
[tool.hatch.envs.typing]
111-
features = ["test"]
112-
dependencies = ["mypy>=1.6.1", "traitlets>=5.11.2", "jupyter_server>=2.8"]
113-
[tool.hatch.envs.typing.scripts]
114-
test = "mypy --install-types --non-interactive {args}"
115-
116110
[tool.hatch.envs.lint]
117-
dependencies = [
118-
"mdformat>0.7",
119-
"mdformat-gfm>=0.3.5",
120-
"ruff==0.1.3"
121-
]
122111
detached = true
112+
dependencies = ["pre-commit"]
123113
[tool.hatch.envs.lint.scripts]
124-
style = [
125-
"ruff {args:.}",
126-
"ruff format {args:.}",
127-
"mdformat --check {args:docs *.md}"
128-
]
129-
fmt = [
130-
"ruff --fix {args:.}",
131-
"ruff format {args:.}",
132-
"mdformat {args:docs *.md}"
133-
]
114+
build = "pre-commit run --all-files ruff"
115+
116+
[tool.hatch.envs.typing]
117+
dependencies = [ "pre-commit"]
118+
detached = true
119+
[tool.hatch.envs.typing.scripts]
120+
test = "pre-commit run --all-files --hook-stage manual mypy"
134121

135122
[tool.pytest.ini_options]
136123
minversion = "6.0"
137124
xfail_strict = true
138125
log_cli_level = "info"
139126
addopts = [
140-
"-raXs", "--durations=10", "--color=yes", "--doctest-modules",
127+
"-ra", "--durations=10", "--color=yes", "--doctest-modules",
141128
"--showlocals", "--strict-markers", "--strict-config"
142129
]
143130
testpaths = [
@@ -155,8 +142,7 @@ filterwarnings = [
155142
# From tornado.netutil.bind_sockets
156143
"module:unclosed <socket.socket:ResourceWarning",
157144
# From jupyter_client
158-
"module:datetime.datetime.utcfromtimestamp:DeprecationWarning",
159-
"module:datetime.datetime.utcnow:DeprecationWarning",
145+
"module:datetime.datetime.utc:DeprecationWarning",
160146
]
161147

162148
[tool.coverage.report]
@@ -280,4 +266,4 @@ relative_files = true
280266
source = ["jupyterlab_server"]
281267

282268
[tool.repo-review]
283-
ignore = ["PY007", "PP308", "GH102", "PC140"]
269+
ignore = ["PY007", "GH102"]

0 commit comments

Comments
 (0)