Skip to content
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
664c75a
start testing on 3.14 and 3.14-free-threaded
Carreau Oct 8, 2025
80f729b
mark xfail on free-threaded
Carreau Oct 9, 2025
7a565ac
remove mambaforge variant
Carreau Oct 9, 2025
92c22d4
remove papermill (unmaintained)
Carreau Oct 9, 2025
d2b430c
Also drop 3.9 and cleanup conditional code
Carreau Oct 9, 2025
7d374f9
fix pre-commit after bump to 3.10
Carreau Oct 9, 2025
51ea989
bump min in github action
Carreau Oct 9, 2025
93064d8
update pre-commit
Carreau Oct 9, 2025
5d6b47f
fix all pre-commit issues
Carreau Oct 11, 2025
c0e7704
skip failint tests on 3.14
Carreau Oct 13, 2025
6301e78
remove all ignored types comments
Carreau Oct 13, 2025
35e77ba
fix mypy lints
Carreau Oct 13, 2025
2f42590
fix some min
Carreau Oct 13, 2025
ffdb3b8
try to skip min test
Carreau Oct 13, 2025
8812c1e
bump min as min_versin test are failing
Carreau Oct 15, 2025
70ea317
skip tcp test
Carreau Oct 15, 2025
1c9139a
bump pytest jupyter
Carreau Oct 15, 2025
e99a846
memoryview.contiguous is safe
minrk Oct 15, 2025
e4665ef
need tornado 6.4.1 for
minrk Oct 15, 2025
fcc627b
don't run tests twice on failure
minrk Oct 15, 2025
8843b77
try to do better at closing event loops
minrk Oct 15, 2025
7f7c69e
only close loop if there is one to close
minrk Oct 15, 2025
043876b
debug: show tracemalloc for unclosed resources
minrk Oct 15, 2025
2eefaa5
simplify selecting nowarn/nocover in tests
minrk Oct 15, 2025
e9e4493
show minimum versions env
minrk Oct 15, 2025
9533d15
stop skipping test_input_request
minrk Oct 15, 2025
fe77c35
cleanup more unclosed sockets
minrk Oct 15, 2025
40412b0
try to make sure hatch uses our python
minrk Oct 15, 2025
b28b7f4
increase test timeout
minrk Oct 15, 2025
b5dc28b
increase some test timeouts
minrk Oct 15, 2025
79c616b
back to 100s
minrk Oct 15, 2025
33d6483
client: destroy created context in stop_channels
minrk Oct 15, 2025
ff0e5e7
increase per-test timeout in test_kernelmanager
minrk Oct 15, 2025
7040d28
increase timeouts in test_multikernelmanager, test_client
minrk Oct 15, 2025
f86d0af
set linger when destroying client
minrk Oct 15, 2025
d4fbcdb
try to cleanup a lot of leftover contexts
minrk Oct 15, 2025
ccb9642
restore tests_check to unblock branch protection
minrk Oct 16, 2025
8986ce3
revert default nowarn for debug
minrk Oct 16, 2025
6b6de4c
Apply suggestion from @Carreau
minrk Oct 16, 2025
31453ce
set linger in destroy so it exits eventually
minrk Oct 16, 2025
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
10 changes: 0 additions & 10 deletions .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ jobs:
package_name: nbclient
env_values: IPYKERNEL_CELL_NAME=\<IPY-INPUT\>

papermill:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
with:
package_name: papermill

nbconvert:
runs-on: ubuntu-latest
timeout-minutes: 15
Expand Down
47 changes: 34 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ defaults:
run:
shell: bash -eux {0}

env:
HATCH_ENV: "cov"

jobs:
check_release:
runs-on: ubuntu-latest
Expand All @@ -39,8 +42,9 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version:
- "3.9"
- "3.13"
- "3.10"
- "3.14"
- "3.14t"
include:
- os: windows-latest
python-version: "3.12"
Expand All @@ -53,18 +57,28 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Run the tests
if: ${{ !startsWith(matrix.python-version, 'pypy') && !startsWith(matrix.os, 'windows') }}

- name: disable warnings on pypy or windows
if: ${{ startsWith(matrix.python-version, 'pypy') || startsWith(matrix.os, 'windows') }}
run: |
hatch run cov:test --cov-fail-under 75 || hatch run test:test --lf
- name: Run the tests on pypy
echo "PYTEST_ADDOPTS=${PYTEST_ADDOPTS:-} -W default" >> $GITHUB_ENV

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want this to be permanent ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is not a change, it simplifies the 3 different test invocations below by setting the options before using the same pytest invocation.

- name: disable coverage on pypy
if: ${{ startsWith(matrix.python-version, 'pypy') }}
run: |
hatch run test:nowarn || hatch run test:nowarn --lf
- name: Run the tests on windows
if: ${{ startsWith(matrix.os, 'windows') }}
echo "HATCH_ENV=test" >> $GITHUB_ENV

- name: show env
run: |
hatch -e ${HATCH_ENV} run python -VV
hatch -e ${HATCH_ENV} run pip freeze

- name: Run the tests
run: |
hatch run cov:nowarn || hatch run test:nowarn --lf
hatch run ${HATCH_ENV}:test
env:
PYTHONTRACEMALLOC: "10"

- uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1

coverage:
Expand Down Expand Up @@ -116,9 +130,16 @@ jobs:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
dependency_type: minimum
python_version: "3.10"

- name: show env
run: |
hatch -e test run python -VV
hatch -e test run pip freeze

- name: Run the unit tests
run: |
hatch -vv run test:nowarn || hatch run test:nowarn --lf
hatch -vv run test:nowarn

test_prereleases:
name: Test Prereleases
Expand All @@ -131,7 +152,7 @@ jobs:
dependency_type: pre
- name: Run the tests
run: |
hatch run test:nowarn || hatch run test:nowarn --lf
hatch run test:nowarn

make_sdist:
name: Make SDist
Expand All @@ -151,7 +172,7 @@ jobs:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1
with:
test_command: pytest -vv || pytest -vv --lf
test_command: pytest -vv

tests_check: # This job does nothing and is only used for the branch protection
if: always()
Expand Down
22 changes: 11 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v6.0.0
hooks:
- id: check-case-conflict
- id: check-ast
Expand All @@ -21,12 +21,12 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.4
rev: 0.34.0
hooks:
- id: check-github-workflows

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
- repo: https://github.com/hukkin/mdformat
rev: 0.7.22
hooks:
- id: mdformat

Expand All @@ -37,23 +37,23 @@ repos:
types_or: [yaml, html, json]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.13.0"
rev: "v1.18.2"
hooks:
- id: mypy
files: jupyter_client
stages: [manual]
args: ["--install-types", "--non-interactive", "--python-version=3.9"]
args: ["--install-types", "--non-interactive"]
additional_dependencies:
["traitlets>=5.13", "ipykernel>=6.26", "jupyter_core>=5.3.2"]

- repo: https://github.com/adamchainz/blacken-docs
rev: "1.16.0"
rev: "1.20.0"
hooks:
- id: blacken-docs
additional_dependencies: [black==23.7.0]

- repo: https://github.com/codespell-project/codespell
rev: "v2.2.6"
rev: "v2.4.1"
hooks:
- id: codespell
args: ["-L", "sur,nd"]
Expand All @@ -66,16 +66,16 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
rev: v0.14.0
hooks:
- id: ruff
- id: ruff-check
types_or: [python, jupyter]
args: ["--fix", "--show-fixes"]
- id: ruff-format
types_or: [python, jupyter]

- repo: https://github.com/scientific-python/cookie
rev: "2024.01.24"
rev: "2025.10.01"
hooks:
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"]
36 changes: 18 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,16 +516,16 @@ No merged PRs

### Maintenance and upkeep improvements

- \[pre-commit.ci\] pre-commit autoupdate [#824](https://github.com/jupyter/jupyter_client/pull/824) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- \[pre-commit.ci\] pre-commit autoupdate [#821](https://github.com/jupyter/jupyter_client/pull/821) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- \[pre-commit.ci\] pre-commit autoupdate [#820](https://github.com/jupyter/jupyter_client/pull/820) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- \[pre-commit.ci\] pre-commit autoupdate [#818](https://github.com/jupyter/jupyter_client/pull/818) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- \[pre-commit.ci\] pre-commit autoupdate [#816](https://github.com/jupyter/jupyter_client/pull/816) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- \[pre-commit.ci\] pre-commit autoupdate [#815](https://github.com/jupyter/jupyter_client/pull/815) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- \[pre-commit.ci\] pre-commit autoupdate [#812](https://github.com/jupyter/jupyter_client/pull/812) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- \[pre-commit.ci\] pre-commit autoupdate [#810](https://github.com/jupyter/jupyter_client/pull/810) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- \[pre-commit.ci\] pre-commit autoupdate [#809](https://github.com/jupyter/jupyter_client/pull/809) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- \[pre-commit.ci\] pre-commit autoupdate [#807](https://github.com/jupyter/jupyter_client/pull/807) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- [pre-commit.ci] pre-commit autoupdate [#824](https://github.com/jupyter/jupyter_client/pull/824) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- [pre-commit.ci] pre-commit autoupdate [#821](https://github.com/jupyter/jupyter_client/pull/821) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- [pre-commit.ci] pre-commit autoupdate [#820](https://github.com/jupyter/jupyter_client/pull/820) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- [pre-commit.ci] pre-commit autoupdate [#818](https://github.com/jupyter/jupyter_client/pull/818) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- [pre-commit.ci] pre-commit autoupdate [#816](https://github.com/jupyter/jupyter_client/pull/816) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- [pre-commit.ci] pre-commit autoupdate [#815](https://github.com/jupyter/jupyter_client/pull/815) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- [pre-commit.ci] pre-commit autoupdate [#812](https://github.com/jupyter/jupyter_client/pull/812) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- [pre-commit.ci] pre-commit autoupdate [#810](https://github.com/jupyter/jupyter_client/pull/810) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- [pre-commit.ci] pre-commit autoupdate [#809](https://github.com/jupyter/jupyter_client/pull/809) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- [pre-commit.ci] pre-commit autoupdate [#807](https://github.com/jupyter/jupyter_client/pull/807) ([@pre-commit-ci](https://github.com/pre-commit-ci))

### Contributors to this release

Expand All @@ -544,7 +544,7 @@ No merged PRs
### Maintenance and upkeep improvements

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

### Contributors to this release

Expand Down Expand Up @@ -576,9 +576,9 @@ No merged PRs

### Maintenance and upkeep improvements

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

### Contributors to this release
Expand All @@ -599,7 +599,7 @@ No merged PRs
### Maintenance and upkeep improvements

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

### Contributors to this release

Expand All @@ -617,8 +617,8 @@ No merged PRs

### Maintenance and upkeep improvements

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

Expand All @@ -635,7 +635,7 @@ No merged PRs
### Maintenance and upkeep improvements

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

### Contributors to this release
Expand Down Expand Up @@ -713,7 +713,7 @@ No merged PRs

### Documentation improvements

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

### Contributors to this release
Expand Down
1 change: 1 addition & 0 deletions jupyter_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Client-side implementations of the Jupyter protocol"""

from ._version import __version__, protocol_version, protocol_version_info, version_info
from .asynchronous import AsyncKernelClient
from .blocking import BlockingKernelClient
Expand Down
1 change: 1 addition & 0 deletions jupyter_client/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The version information for jupyter client."""

import re
from typing import Union

Expand Down
3 changes: 2 additions & 1 deletion jupyter_client/adapter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Adapters for Jupyter msg spec versions."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import json
Expand Down Expand Up @@ -194,7 +195,7 @@ def object_info_request(self, msg: dict[str, Any]) -> dict[str, Any]:
content = msg["content"]
code = content["code"]
cursor_pos = content["cursor_pos"]
line, _ = code_to_line(code, cursor_pos)
_line, _ = code_to_line(code, cursor_pos)

new_content = msg["content"] = {}
new_content["oname"] = extract_oname_v4(code, cursor_pos)
Expand Down
13 changes: 7 additions & 6 deletions jupyter_client/asynchronous/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implements an async kernel client"""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
Expand Down Expand Up @@ -33,7 +34,7 @@ class AsyncKernelClient(KernelClient):
raising :exc:`queue.Empty` if no message arrives within ``timeout`` seconds.
"""

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

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

# The classes to use for the various channels
shell_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[arg-type]
iopub_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[arg-type]
stdin_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[arg-type]
hb_channel_class = Type(HBChannel) # type:ignore[arg-type]
control_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[arg-type]
shell_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[assignment]
iopub_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[assignment]
stdin_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[assignment]
hb_channel_class = Type(HBChannel) # type:ignore[assignment]
control_channel_class = Type(AsyncZMQSocketChannel) # type:ignore[assignment]

_recv_reply = KernelClient._async_recv_reply

Expand Down
11 changes: 6 additions & 5 deletions jupyter_client/blocking/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Useful for test suites and blocking terminal interfaces.
"""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
Expand Down Expand Up @@ -48,11 +49,11 @@ class BlockingKernelClient(KernelClient):
wait_for_ready = run_sync(KernelClient._async_wait_for_ready)

# The classes to use for the various channels
shell_channel_class = Type(ZMQSocketChannel) # type:ignore[arg-type]
iopub_channel_class = Type(ZMQSocketChannel) # type:ignore[arg-type]
stdin_channel_class = Type(ZMQSocketChannel) # type:ignore[arg-type]
hb_channel_class = Type(HBChannel) # type:ignore[arg-type]
control_channel_class = Type(ZMQSocketChannel) # type:ignore[arg-type]
shell_channel_class = Type(ZMQSocketChannel) # type:ignore[assignment]
iopub_channel_class = Type(ZMQSocketChannel) # type:ignore[assignment]
stdin_channel_class = Type(ZMQSocketChannel) # type:ignore[assignment]
hb_channel_class = Type(HBChannel) # type:ignore[assignment]
control_channel_class = Type(ZMQSocketChannel) # type:ignore[assignment]

_recv_reply = run_sync(KernelClient._async_recv_reply)

Expand Down
Loading