Skip to content

Commit deaf46f

Browse files
authored
Clean up lint and add downstream tests (#64)
* clean up * fixup * update test matrix
1 parent 33703d9 commit deaf46f

File tree

4 files changed

+74
-25
lines changed

4 files changed

+74
-25
lines changed

.github/workflows/downstream.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Test downstream projects
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
concurrency:
9+
group: downstream-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
jupyter_client:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Base Setup
20+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
21+
22+
- name: Run Test
23+
uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
24+
with:
25+
package_name: jupyter_client
26+
27+
jupyter_server:
28+
runs-on: ubuntu-latest
29+
timeout-minutes: 15
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
33+
- uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
34+
with:
35+
package_name: jupyter_server
36+
37+
downstream_check: # This job does nothing and is only used for the branch protection
38+
if: always()
39+
needs:
40+
- jupyter_server
41+
- jupyter_client
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Decide whether the needed jobs succeeded or failed
45+
uses: re-actors/alls-green@release/v1
46+
with:
47+
jobs: ${{ toJSON(needs) }}

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
os: [ubuntu-latest, windows-latest, macos-latest]
20-
python-version: ["3.8", "3.11"]
20+
python-version: ["3.8", "3.12"]
2121
include:
2222
- os: windows-latest
2323
python-version: "3.9"
2424
- os: ubuntu-latest
25-
python-version: "pypy-3.8"
25+
python-version: "pypy-3.9"
2626
- os: ubuntu-latest
27-
python-version: "3.7"
27+
python-version: "3.8"
2828
- os: macos-latest
2929
python-version: "3.10"
3030
steps:
@@ -67,7 +67,7 @@ jobs:
6767
- name: Run Linters
6868
run: |
6969
hatch run typing:test
70-
hatch run lint:style
70+
hatch run lint:build
7171
pipx run interrogate -v .
7272
pipx run doc8 --max-line-length=200 --ignore-path=docs/source/other/full-config.rst
7373

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,21 @@ repos:
4848
- id: codespell
4949
args: ["-L", "sur,nd"]
5050

51+
- repo: https://github.com/pre-commit/mirrors-mypy
52+
rev: "v1.6.1"
53+
hooks:
54+
- id: mypy
55+
files: pytest_jupyter
56+
stages: [manual]
57+
args: ["--install-types", "--non-interactive"]
58+
additional_dependencies:
59+
[
60+
"pytest>=7",
61+
"jupyter_client>=8.5",
62+
"jupyter_server>=2.9",
63+
"ipykernel>=6.26",
64+
]
65+
5166
- repo: https://github.com/pre-commit/pygrep-hooks
5267
rev: "v1.10.0"
5368
hooks:

pyproject.toml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies = [
3030
"pytest",
3131
"jupyter_core"
3232
]
33-
requires-python = ">=3.7"
33+
requires-python = ">=3.8"
3434

3535

3636
[project.optional-dependencies]
@@ -90,28 +90,16 @@ test = "coverage run -m pytest {args}"
9090
nowarn = "test -W default {args}"
9191

9292
[tool.hatch.envs.typing]
93-
features = ["test", "server", "client"]
94-
dependencies = ["mypy>=1.6.0"]
93+
dependencies = ["pre-commit"]
94+
detached = true
9595
[tool.hatch.envs.typing.scripts]
96-
test = "mypy --install-types --non-interactive {args:.}"
96+
test = "pre-commit run --all-files --hook-stage manual mypy"
9797

9898
[tool.hatch.envs.lint]
99-
dependencies = [
100-
"mdformat>0.7",
101-
"ruff==0.1.3",
102-
]
99+
dependencies = ["pre-commit"]
103100
detached = true
104101
[tool.hatch.envs.lint.scripts]
105-
style = [
106-
"ruff {args:.}",
107-
"ruff format {args:.}",
108-
"mdformat --check {args:docs *.md}"
109-
]
110-
fmt = [
111-
"ruff --fix {args:.}",
112-
"ruff format {args:.}",
113-
"mdformat {args:docs *.md}"
114-
]
102+
build = ["pre-commit run --all-files ruff"]
115103

116104
[tool.jupyter-releaser.options]
117105
post-version-spec = "dev"
@@ -133,8 +121,7 @@ timeout_method = "thread"
133121
filterwarnings= [
134122
# Fail on warnings
135123
"error",
136-
# From jupyter_events
137-
"module:jsonschema.RefResolver is deprecated as of:DeprecationWarning",
124+
"module:datetime.datetime.utc:DeprecationWarning",
138125
]
139126

140127
[tool.coverage.report]
@@ -217,4 +204,4 @@ fail-under=100
217204
exclude = ["docs", "tests"]
218205

219206
[tool.repo-review]
220-
ignore = ["PY007", "PP308", "GH102", "PC140"]
207+
ignore = ["PY007", "PP308", "GH102"]

0 commit comments

Comments
 (0)