Skip to content

Commit bc5d2d5

Browse files
authored
Drop 3.9, Start testing on 3.14 and 3.14-free-threaded, get tests passing again (#1076)
1 parent b0037a1 commit bc5d2d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+321
-221
lines changed

.github/workflows/downstream.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,6 @@ jobs:
3131
package_name: nbclient
3232
env_values: IPYKERNEL_CELL_NAME=\<IPY-INPUT\>
3333

34-
papermill:
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: papermill
43-
4434
nbconvert:
4535
runs-on: ubuntu-latest
4636
timeout-minutes: 15

.github/workflows/main.yml

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ defaults:
1313
run:
1414
shell: bash -eux {0}
1515

16+
env:
17+
HATCH_ENV: "cov"
18+
1619
jobs:
1720
check_release:
1821
runs-on: ubuntu-latest
@@ -39,8 +42,9 @@ jobs:
3942
matrix:
4043
os: [ubuntu-latest, windows-latest, macos-latest]
4144
python-version:
42-
- "3.9"
43-
- "3.13"
45+
- "3.10"
46+
- "3.14"
47+
- "3.14t"
4448
include:
4549
- os: windows-latest
4650
python-version: "3.12"
@@ -53,18 +57,28 @@ jobs:
5357
steps:
5458
- uses: actions/checkout@v4
5559
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
56-
- name: Run the tests
57-
if: ${{ !startsWith(matrix.python-version, 'pypy') && !startsWith(matrix.os, 'windows') }}
60+
61+
- name: disable warnings on pypy or windows
62+
if: ${{ startsWith(matrix.python-version, 'pypy') || startsWith(matrix.os, 'windows') }}
5863
run: |
59-
hatch run cov:test --cov-fail-under 75 || hatch run test:test --lf
60-
- name: Run the tests on pypy
64+
echo "PYTEST_ADDOPTS=${PYTEST_ADDOPTS:-} -W default" >> $GITHUB_ENV
65+
66+
- name: disable coverage on pypy
6167
if: ${{ startsWith(matrix.python-version, 'pypy') }}
6268
run: |
63-
hatch run test:nowarn || hatch run test:nowarn --lf
64-
- name: Run the tests on windows
65-
if: ${{ startsWith(matrix.os, 'windows') }}
69+
echo "HATCH_ENV=test" >> $GITHUB_ENV
70+
71+
- name: show env
72+
run: |
73+
hatch -e ${HATCH_ENV} run python -VV
74+
hatch -e ${HATCH_ENV} run pip freeze
75+
76+
- name: Run the tests
6677
run: |
67-
hatch run cov:nowarn || hatch run test:nowarn --lf
78+
hatch run ${HATCH_ENV}:test
79+
env:
80+
PYTHONTRACEMALLOC: "10"
81+
6882
- uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1
6983

7084
coverage:
@@ -116,9 +130,16 @@ jobs:
116130
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
117131
with:
118132
dependency_type: minimum
133+
python_version: "3.10"
134+
135+
- name: show env
136+
run: |
137+
hatch -e test run python -VV
138+
hatch -e test run pip freeze
139+
119140
- name: Run the unit tests
120141
run: |
121-
hatch -vv run test:nowarn || hatch run test:nowarn --lf
142+
hatch -vv run test:nowarn
122143
123144
test_prereleases:
124145
name: Test Prereleases
@@ -131,7 +152,7 @@ jobs:
131152
dependency_type: pre
132153
- name: Run the tests
133154
run: |
134-
hatch run test:nowarn || hatch run test:nowarn --lf
155+
hatch run test:nowarn
135156
136157
make_sdist:
137158
name: Make SDist
@@ -151,7 +172,7 @@ jobs:
151172
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
152173
- uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1
153174
with:
154-
test_command: pytest -vv || pytest -vv --lf
175+
test_command: pytest -vv
155176

156177
tests_check: # This job does nothing and is only used for the branch protection
157178
if: always()

.pre-commit-config.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44

55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.5.0
7+
rev: v6.0.0
88
hooks:
99
- id: check-case-conflict
1010
- id: check-ast
@@ -21,12 +21,12 @@ repos:
2121
- id: trailing-whitespace
2222

2323
- repo: https://github.com/python-jsonschema/check-jsonschema
24-
rev: 0.27.4
24+
rev: 0.34.0
2525
hooks:
2626
- id: check-github-workflows
2727

28-
- repo: https://github.com/executablebooks/mdformat
29-
rev: 0.7.17
28+
- repo: https://github.com/hukkin/mdformat
29+
rev: 0.7.22
3030
hooks:
3131
- id: mdformat
3232

@@ -37,23 +37,23 @@ repos:
3737
types_or: [yaml, html, json]
3838

3939
- repo: https://github.com/pre-commit/mirrors-mypy
40-
rev: "v1.13.0"
40+
rev: "v1.18.2"
4141
hooks:
4242
- id: mypy
4343
files: jupyter_client
4444
stages: [manual]
45-
args: ["--install-types", "--non-interactive", "--python-version=3.9"]
45+
args: ["--install-types", "--non-interactive"]
4646
additional_dependencies:
4747
["traitlets>=5.13", "ipykernel>=6.26", "jupyter_core>=5.3.2"]
4848

4949
- repo: https://github.com/adamchainz/blacken-docs
50-
rev: "1.16.0"
50+
rev: "1.20.0"
5151
hooks:
5252
- id: blacken-docs
5353
additional_dependencies: [black==23.7.0]
5454

5555
- repo: https://github.com/codespell-project/codespell
56-
rev: "v2.2.6"
56+
rev: "v2.4.1"
5757
hooks:
5858
- id: codespell
5959
args: ["-L", "sur,nd"]
@@ -66,16 +66,16 @@ repos:
6666
- id: rst-inline-touching-normal
6767

6868
- repo: https://github.com/astral-sh/ruff-pre-commit
69-
rev: v0.2.0
69+
rev: v0.14.0
7070
hooks:
71-
- id: ruff
71+
- id: ruff-check
7272
types_or: [python, jupyter]
7373
args: ["--fix", "--show-fixes"]
7474
- id: ruff-format
7575
types_or: [python, jupyter]
7676

7777
- repo: https://github.com/scientific-python/cookie
78-
rev: "2024.01.24"
78+
rev: "2025.10.01"
7979
hooks:
8080
- id: sp-repo-review
8181
additional_dependencies: ["repo-review[cli]"]

CHANGELOG.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -516,16 +516,16 @@ No merged PRs
516516

517517
### Maintenance and upkeep improvements
518518

519-
- \[pre-commit.ci\] pre-commit autoupdate [#824](https://github.com/jupyter/jupyter_client/pull/824) ([@pre-commit-ci](https://github.com/pre-commit-ci))
520-
- \[pre-commit.ci\] pre-commit autoupdate [#821](https://github.com/jupyter/jupyter_client/pull/821) ([@pre-commit-ci](https://github.com/pre-commit-ci))
521-
- \[pre-commit.ci\] pre-commit autoupdate [#820](https://github.com/jupyter/jupyter_client/pull/820) ([@pre-commit-ci](https://github.com/pre-commit-ci))
522-
- \[pre-commit.ci\] pre-commit autoupdate [#818](https://github.com/jupyter/jupyter_client/pull/818) ([@pre-commit-ci](https://github.com/pre-commit-ci))
523-
- \[pre-commit.ci\] pre-commit autoupdate [#816](https://github.com/jupyter/jupyter_client/pull/816) ([@pre-commit-ci](https://github.com/pre-commit-ci))
524-
- \[pre-commit.ci\] pre-commit autoupdate [#815](https://github.com/jupyter/jupyter_client/pull/815) ([@pre-commit-ci](https://github.com/pre-commit-ci))
525-
- \[pre-commit.ci\] pre-commit autoupdate [#812](https://github.com/jupyter/jupyter_client/pull/812) ([@pre-commit-ci](https://github.com/pre-commit-ci))
526-
- \[pre-commit.ci\] pre-commit autoupdate [#810](https://github.com/jupyter/jupyter_client/pull/810) ([@pre-commit-ci](https://github.com/pre-commit-ci))
527-
- \[pre-commit.ci\] pre-commit autoupdate [#809](https://github.com/jupyter/jupyter_client/pull/809) ([@pre-commit-ci](https://github.com/pre-commit-ci))
528-
- \[pre-commit.ci\] pre-commit autoupdate [#807](https://github.com/jupyter/jupyter_client/pull/807) ([@pre-commit-ci](https://github.com/pre-commit-ci))
519+
- [pre-commit.ci] pre-commit autoupdate [#824](https://github.com/jupyter/jupyter_client/pull/824) ([@pre-commit-ci](https://github.com/pre-commit-ci))
520+
- [pre-commit.ci] pre-commit autoupdate [#821](https://github.com/jupyter/jupyter_client/pull/821) ([@pre-commit-ci](https://github.com/pre-commit-ci))
521+
- [pre-commit.ci] pre-commit autoupdate [#820](https://github.com/jupyter/jupyter_client/pull/820) ([@pre-commit-ci](https://github.com/pre-commit-ci))
522+
- [pre-commit.ci] pre-commit autoupdate [#818](https://github.com/jupyter/jupyter_client/pull/818) ([@pre-commit-ci](https://github.com/pre-commit-ci))
523+
- [pre-commit.ci] pre-commit autoupdate [#816](https://github.com/jupyter/jupyter_client/pull/816) ([@pre-commit-ci](https://github.com/pre-commit-ci))
524+
- [pre-commit.ci] pre-commit autoupdate [#815](https://github.com/jupyter/jupyter_client/pull/815) ([@pre-commit-ci](https://github.com/pre-commit-ci))
525+
- [pre-commit.ci] pre-commit autoupdate [#812](https://github.com/jupyter/jupyter_client/pull/812) ([@pre-commit-ci](https://github.com/pre-commit-ci))
526+
- [pre-commit.ci] pre-commit autoupdate [#810](https://github.com/jupyter/jupyter_client/pull/810) ([@pre-commit-ci](https://github.com/pre-commit-ci))
527+
- [pre-commit.ci] pre-commit autoupdate [#809](https://github.com/jupyter/jupyter_client/pull/809) ([@pre-commit-ci](https://github.com/pre-commit-ci))
528+
- [pre-commit.ci] pre-commit autoupdate [#807](https://github.com/jupyter/jupyter_client/pull/807) ([@pre-commit-ci](https://github.com/pre-commit-ci))
529529

530530
### Contributors to this release
531531

@@ -544,7 +544,7 @@ No merged PRs
544544
### Maintenance and upkeep improvements
545545

546546
- Fix sphinx 5.0 support [#804](https://github.com/jupyter/jupyter_client/pull/804) ([@blink1073](https://github.com/blink1073))
547-
- \[pre-commit.ci\] pre-commit autoupdate [#799](https://github.com/jupyter/jupyter_client/pull/799) ([@pre-commit-ci](https://github.com/pre-commit-ci))
547+
- [pre-commit.ci] pre-commit autoupdate [#799](https://github.com/jupyter/jupyter_client/pull/799) ([@pre-commit-ci](https://github.com/pre-commit-ci))
548548

549549
### Contributors to this release
550550

@@ -576,9 +576,9 @@ No merged PRs
576576

577577
### Maintenance and upkeep improvements
578578

579-
- \[pre-commit.ci\] pre-commit autoupdate [#792](https://github.com/jupyter/jupyter_client/pull/792) ([@pre-commit-ci](https://github.com/pre-commit-ci))
579+
- [pre-commit.ci] pre-commit autoupdate [#792](https://github.com/jupyter/jupyter_client/pull/792) ([@pre-commit-ci](https://github.com/pre-commit-ci))
580580
- Use hatch backend [#789](https://github.com/jupyter/jupyter_client/pull/789) ([@blink1073](https://github.com/blink1073))
581-
- \[pre-commit.ci\] pre-commit autoupdate [#788](https://github.com/jupyter/jupyter_client/pull/788) ([@pre-commit-ci](https://github.com/pre-commit-ci))
581+
- [pre-commit.ci] pre-commit autoupdate [#788](https://github.com/jupyter/jupyter_client/pull/788) ([@pre-commit-ci](https://github.com/pre-commit-ci))
582582
- Use flit build backend [#781](https://github.com/jupyter/jupyter_client/pull/781) ([@blink1073](https://github.com/blink1073))
583583

584584
### Contributors to this release
@@ -599,7 +599,7 @@ No merged PRs
599599
### Maintenance and upkeep improvements
600600

601601
- Allow bot PRs to be automatically labeled [#784](https://github.com/jupyter/jupyter_client/pull/784) ([@blink1073](https://github.com/blink1073))
602-
- \[pre-commit.ci\] pre-commit autoupdate [#783](https://github.com/jupyter/jupyter_client/pull/783) ([@pre-commit-ci](https://github.com/pre-commit-ci))
602+
- [pre-commit.ci] pre-commit autoupdate [#783](https://github.com/jupyter/jupyter_client/pull/783) ([@pre-commit-ci](https://github.com/pre-commit-ci))
603603

604604
### Contributors to this release
605605

@@ -617,8 +617,8 @@ No merged PRs
617617

618618
### Maintenance and upkeep improvements
619619

620-
- \[pre-commit.ci\] pre-commit autoupdate [#773](https://github.com/jupyter/jupyter_client/pull/773) ([@pre-commit-ci](https://github.com/pre-commit-ci))
621-
- \[pre-commit.ci\] pre-commit autoupdate [#770](https://github.com/jupyter/jupyter_client/pull/770) ([@pre-commit-ci](https://github.com/pre-commit-ci))
620+
- [pre-commit.ci] pre-commit autoupdate [#773](https://github.com/jupyter/jupyter_client/pull/773) ([@pre-commit-ci](https://github.com/pre-commit-ci))
621+
- [pre-commit.ci] pre-commit autoupdate [#770](https://github.com/jupyter/jupyter_client/pull/770) ([@pre-commit-ci](https://github.com/pre-commit-ci))
622622
- Improve mypy config [#769](https://github.com/jupyter/jupyter_client/pull/769) ([@blink1073](https://github.com/blink1073))
623623
- Clean up pre-commit [#768](https://github.com/jupyter/jupyter_client/pull/768) ([@blink1073](https://github.com/blink1073))
624624

@@ -635,7 +635,7 @@ No merged PRs
635635
### Maintenance and upkeep improvements
636636

637637
- Include py.typed file [#766](https://github.com/jupyter/jupyter_client/pull/766) ([@blink1073](https://github.com/blink1073))
638-
- \[pre-commit.ci\] pre-commit autoupdate [#765](https://github.com/jupyter/jupyter_client/pull/765) ([@pre-commit-ci](https://github.com/pre-commit-ci))
638+
- [pre-commit.ci] pre-commit autoupdate [#765](https://github.com/jupyter/jupyter_client/pull/765) ([@pre-commit-ci](https://github.com/pre-commit-ci))
639639
- More Cleanup [#764](https://github.com/jupyter/jupyter_client/pull/764) ([@blink1073](https://github.com/blink1073))
640640

641641
### Contributors to this release
@@ -713,7 +713,7 @@ No merged PRs
713713

714714
### Documentation improvements
715715

716-
- \[DOC\] improve kernel provisioner doc [#730](https://github.com/jupyter/jupyter_client/pull/730) ([@abzymeinsjtu](https://github.com/abzymeinsjtu))
716+
- [DOC] improve kernel provisioner doc [#730](https://github.com/jupyter/jupyter_client/pull/730) ([@abzymeinsjtu](https://github.com/abzymeinsjtu))
717717
- add changelog for message spec [#525](https://github.com/jupyter/jupyter_client/pull/525) ([@minrk](https://github.com/minrk))
718718

719719
### Contributors to this release

jupyter_client/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Client-side implementations of the Jupyter protocol"""
2+
23
from ._version import __version__, protocol_version, protocol_version_info, version_info
34
from .asynchronous import AsyncKernelClient
45
from .blocking import BlockingKernelClient

jupyter_client/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The version information for jupyter client."""
2+
23
import re
34
from typing import Union
45

jupyter_client/adapter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Adapters for Jupyter msg spec versions."""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
import json
@@ -194,7 +195,7 @@ def object_info_request(self, msg: dict[str, Any]) -> dict[str, Any]:
194195
content = msg["content"]
195196
code = content["code"]
196197
cursor_pos = content["cursor_pos"]
197-
line, _ = code_to_line(code, cursor_pos)
198+
_line, _ = code_to_line(code, cursor_pos)
198199

199200
new_content = msg["content"] = {}
200201
new_content["oname"] = extract_oname_v4(code, cursor_pos)

jupyter_client/asynchronous/client.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Implements an async kernel client"""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
from __future__ import annotations
@@ -33,7 +34,7 @@ class AsyncKernelClient(KernelClient):
3334
raising :exc:`queue.Empty` if no message arrives within ``timeout`` seconds.
3435
"""
3536

36-
context = Instance(zmq.asyncio.Context) # type:ignore[arg-type]
37+
context = Instance(zmq.asyncio.Context) # type:ignore[assignment]
3738

3839
def _context_default(self) -> zmq.asyncio.Context:
3940
self._created_context = True
@@ -51,11 +52,11 @@ def _context_default(self) -> zmq.asyncio.Context:
5152
wait_for_ready = KernelClient._async_wait_for_ready
5253

5354
# The classes to use for the various channels
54-
shell_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[arg-type]
55-
iopub_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[arg-type]
56-
stdin_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[arg-type]
57-
hb_channel_class = Type(HBChannel) # type:ignore[arg-type]
58-
control_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[arg-type]
55+
shell_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[assignment]
56+
iopub_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[assignment]
57+
stdin_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[assignment]
58+
hb_channel_class = Type(HBChannel) # type:ignore[assignment]
59+
control_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[assignment]
5960

6061
_recv_reply = KernelClient._async_recv_reply
6162

jupyter_client/blocking/client.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
Useful for test suites and blocking terminal interfaces.
44
"""
5+
56
# Copyright (c) Jupyter Development Team.
67
# Distributed under the terms of the Modified BSD License.
78
from __future__ import annotations
@@ -48,11 +49,11 @@ class BlockingKernelClient(KernelClient):
4849
wait_for_ready = run_sync(KernelClient._async_wait_for_ready)
4950

5051
# The classes to use for the various channels
51-
shell_channel_class = Type(ZMQSocketChannel) # type:ignore[arg-type]
52-
iopub_channel_class = Type(ZMQSocketChannel) # type:ignore[arg-type]
53-
stdin_channel_class = Type(ZMQSocketChannel) # type:ignore[arg-type]
54-
hb_channel_class = Type(HBChannel) # type:ignore[arg-type]
55-
control_channel_class = Type(ZMQSocketChannel) # type:ignore[arg-type]
52+
shell_channel_class = Type(ZMQSocketChannel) # type:ignore[assignment]
53+
iopub_channel_class = Type(ZMQSocketChannel) # type:ignore[assignment]
54+
stdin_channel_class = Type(ZMQSocketChannel) # type:ignore[assignment]
55+
hb_channel_class = Type(HBChannel) # type:ignore[assignment]
56+
control_channel_class = Type(ZMQSocketChannel) # type:ignore[assignment]
5657

5758
_recv_reply = run_sync(KernelClient._async_recv_reply)
5859

0 commit comments

Comments
 (0)