Skip to content

Commit 82f3e2a

Browse files
authored
Clean up lint and add downstream checks (#373)
1 parent 5596d75 commit 82f3e2a

File tree

4 files changed

+98
-16
lines changed

4 files changed

+98
-16
lines changed

.github/workflows/downstream.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
ipykernel:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 15
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
19+
- uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
20+
with:
21+
package_name: ipykernel
22+
23+
nbclient:
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 15
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
29+
- uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
30+
with:
31+
package_name: nbclient
32+
env_values: IPYKERNEL_CELL_NAME=\<IPY-INPUT\>
33+
34+
nbconvert:
35+
runs-on: ubuntu-latest
36+
timeout-minutes: 15
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
40+
- uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
41+
with:
42+
package_name: nbconvert
43+
package_spec: pip install -e ".[test]"
44+
45+
jupyter_server:
46+
runs-on: ubuntu-latest
47+
timeout-minutes: 15
48+
steps:
49+
- uses: actions/checkout@v4
50+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
51+
- uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
52+
with:
53+
package_name: jupyter_server
54+
55+
jupyter_client:
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v4
60+
61+
- name: Base Setup
62+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
63+
64+
- name: Run Test
65+
uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
66+
with:
67+
package_name: jupyter_client
68+
69+
downstreams_check: # This job does nothing and is only used for the branch protection
70+
if: always()
71+
needs:
72+
- ipykernel
73+
- nbclient
74+
- nbconvert
75+
- jupyter_server
76+
- jupyter_client
77+
runs-on: ubuntu-latest
78+
steps:
79+
- name: Decide whether the needed jobs succeeded or failed
80+
uses: re-actors/alls-green@release/v1
81+
with:
82+
jobs: ${{ toJSON(needs) }}

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
- name: Run Linters
113113
run: |
114114
hatch run typing:test
115-
hatch run lint:style
115+
hatch run lint:build
116116
pipx run interrogate -v .
117117
pipx run doc8 --max-line-length=200
118118

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ repos:
4444
- id: blacken-docs
4545
additional_dependencies: [black==23.7.0]
4646

47+
- repo: https://github.com/pre-commit/mirrors-mypy
48+
rev: "v1.6.1"
49+
hooks:
50+
- id: mypy
51+
files: jupyter_core
52+
stages: [manual]
53+
args: ["--install-types", "--non-interactive"]
54+
additional_dependencies: ["traitlets>=5.13", "platformdirs>=3.11"]
55+
4756
- repo: https://github.com/codespell-project/codespell
4857
rev: "v2.2.6"
4958
hooks:

pyproject.toml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,25 +88,16 @@ test = "python -m pytest -vv --cov jupyter_core --cov-branch --cov-report term-m
8888
nowarn = "test -W default {args}"
8989

9090
[tool.hatch.envs.typing]
91-
features = ["test"]
92-
dependencies = ["mypy~=1.6.0", "traitlets>=5.13.0"]
91+
dependencies = ["pre-commit"]
92+
detached = true
9393
[tool.hatch.envs.typing.scripts]
94-
test = "mypy --install-types --non-interactive {args}"
94+
test = "pre-commit run --all-files --hook-stage manual mypy"
9595

9696
[tool.hatch.envs.lint]
97-
dependencies = ["mdformat>0.7", "ruff==0.1.3"]
97+
dependencies = ["pre-commit"]
9898
detached = true
9999
[tool.hatch.envs.lint.scripts]
100-
style = [
101-
"ruff {args:.}",
102-
"ruff format {args:.}",
103-
"mdformat --check {args:*.md}"
104-
]
105-
fmt = [
106-
"ruff --fix {args:.}",
107-
"ruff format {args:.}",
108-
"mdformat {args:*.md}"
109-
]
100+
build = ["pre-commit run --all-files ruff"]
110101

111102
[tool.mypy]
112103
files = "jupyter_core"
@@ -219,4 +210,4 @@ toplevel = ["jupyter_core/", "jupyter.py"]
219210
ignore = ["W002"]
220211

221212
[tool.repo-review]
222-
ignore = ["PY007", "PP308", "GH102", "PC140"]
213+
ignore = ["PY007", "PP308", "GH102"]

0 commit comments

Comments
 (0)