Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jupyter/jupyter_client
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v8.4.0
Choose a base ref
...
head repository: jupyter/jupyter_client
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v8.5.0
Choose a head ref
  • 4 commits
  • 33 files changed
  • 3 contributors

Commits on Oct 15, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    05e88b1 View commit details

Commits on Oct 23, 2023

  1. Allow to update kernels env in between restart. (#987)

    This allow to update the running env of kernels.
    
    This will allow resolves some inconsistencies between kernel restart, and actually
    stopping and starting a kernel session.
    
    In parsley via a few lines in Jupyter Server in update_session, this
    will let us update the `__session__` which is supposed to reflect some
    information about the current session, and help correct
    ipython/ipykernel#1102 where renaming a notebook is not reflected in the
    kernel unless you manually stop/start the session, or restart the
    server.
    Carreau authored Oct 23, 2023

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    49dbf0f View commit details

Commits on Oct 25, 2023

  1. Enable strict typing (#984)

    * Use strict typing
    
    * fix imports
    
    * ignore pep585 and 604 typing changes
    blink1073 authored Oct 25, 2023
    Copy the full SHA
    ff94e31 View commit details
  2. Publish 8.5.0

    SHA256 hashes:
    
    jupyter_client-8.5.0-py3-none-any.whl: c3877aac7257ec68d79b5c622ce986bd2a992ca42f6ddc9b4dd1da50e89f7028
    
    jupyter_client-8.5.0.tar.gz: e8754066510ce456358df363f97eae64b50860f30dc1fe8c6771440db3be9a63
    blink1073 committed Oct 25, 2023
    Copy the full SHA
    d044eb5 View commit details
23 changes: 21 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,27 @@

<!-- <START NEW CHANGELOG ENTRY> -->

## 8.5.0

([Full Changelog](https://github.com/jupyter/jupyter_client/compare/v8.4.0...ff94e310c2af3546f2f9384e6b35fd11c3d09a71))

### Enhancements made

- Allow to update kernels env in between restart. [#987](https://github.com/jupyter/jupyter_client/pull/987) ([@Carreau](https://github.com/Carreau))

### Maintenance and upkeep improvements

- Enable strict typing [#984](https://github.com/jupyter/jupyter_client/pull/984) ([@blink1073](https://github.com/blink1073))
- Update typings for mypy 1.6 [#983](https://github.com/jupyter/jupyter_client/pull/983) ([@blink1073](https://github.com/blink1073))

### Contributors to this release

([GitHub contributors page for this release](https://github.com/jupyter/jupyter_client/graphs/contributors?from=2023-10-11&to=2023-10-25&type=c))

[@blink1073](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3Ablink1073+updated%3A2023-10-11..2023-10-25&type=Issues) | [@Carreau](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3ACarreau+updated%3A2023-10-11..2023-10-25&type=Issues)

<!-- <END NEW CHANGELOG ENTRY> -->

## 8.4.0

([Full Changelog](https://github.com/jupyter/jupyter_client/compare/v8.3.1...74044393230e70134f68e664f2ef19fab92b7774))
@@ -22,8 +43,6 @@

[@blink1073](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3Ablink1073+updated%3A2023-08-29..2023-10-11&type=Issues) | [@dependabot](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3Adependabot+updated%3A2023-08-29..2023-10-11&type=Issues) | [@ellert](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3Aellert+updated%3A2023-08-29..2023-10-11&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3Apre-commit-ci+updated%3A2023-08-29..2023-10-11&type=Issues)

<!-- <END NEW CHANGELOG ENTRY> -->

## 8.3.1

([Full Changelog](https://github.com/jupyter/jupyter_client/compare/v8.3.0...b4f7d947fae55a4fe59a27df0830a9a78dcd4e12))
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
import os.path as osp
import shutil

from sphinx.util import logging # type:ignore[import]
from sphinx.util import logging # type:ignore[import-not-found]

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -51,7 +51,7 @@ def filter(self, record: pylogging.LogRecord) -> bool:
# End of a workaround

try:
import enchant # type:ignore[import] # noqa
import enchant # type:ignore[import-not-found] # noqa

extensions += ["sphinxcontrib.spelling"]
except ImportError:
@@ -329,7 +329,7 @@ def filter(self, record: pylogging.LogRecord) -> bool:
intersphinx_mapping = {'ipython': ('http://ipython.readthedocs.io/en/stable/', None)}


def setup(app):
def setup(app: object) -> None:
HERE = osp.abspath(osp.dirname(__file__))
dest = osp.join(HERE, 'changelog.md')
shutil.copy(osp.join(HERE, '..', 'CHANGELOG.md'), dest)
2 changes: 1 addition & 1 deletion jupyter_client/_version.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
import re
from typing import List, Union

__version__ = "8.4.0"
__version__ = "8.5.0"

# Build up version_info tuple for backwards compatibility
pattern = r'(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)'
7 changes: 5 additions & 2 deletions jupyter_client/asynchronous/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"""Implements an async kernel client"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations

import typing as t

import zmq.asyncio
from traitlets import Instance, Type
@@ -9,10 +12,10 @@
from ..client import KernelClient, reqrep


def wrapped(meth, channel):
def wrapped(meth: t.Callable, channel: str) -> t.Callable:
"""Wrap a method on a channel and handle replies."""

def _(self, *args, **kwargs):
def _(self: AsyncKernelClient, *args: t.Any, **kwargs: t.Any) -> t.Any:
reply = kwargs.pop("reply", False)
timeout = kwargs.pop("timeout", None)
msg_id = meth(self, *args, **kwargs)
8 changes: 6 additions & 2 deletions jupyter_client/blocking/client.py
Original file line number Diff line number Diff line change
@@ -4,17 +4,21 @@
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations

import typing as t

from traitlets import Type

from ..channels import HBChannel, ZMQSocketChannel
from ..client import KernelClient, reqrep
from ..utils import run_sync


def wrapped(meth, channel):
def wrapped(meth: t.Callable, channel: str) -> t.Callable:
"""Wrap a method on a channel and handle replies."""

def _(self, *args, **kwargs):
def _(self: BlockingKernelClient, *args: t.Any, **kwargs: t.Any) -> t.Any:
reply = kwargs.pop("reply", False)
timeout = kwargs.pop("timeout", None)
msg_id = meth(self, *args, **kwargs)
2 changes: 1 addition & 1 deletion jupyter_client/channels.py
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ def __init__(
context: t.Optional[zmq.Context] = None,
session: t.Optional[Session] = None,
address: t.Union[t.Tuple[str, int], str] = "",
):
) -> None:
"""Create the heartbeat monitor thread.
Parameters
14 changes: 7 additions & 7 deletions jupyter_client/channelsabc.py
Original file line number Diff line number Diff line change
@@ -8,17 +8,17 @@ class ChannelABC(metaclass=abc.ABCMeta):
"""A base class for all channel ABCs."""

@abc.abstractmethod
def start(self):
def start(self) -> None:
"""Start the channel."""
pass

@abc.abstractmethod
def stop(self):
def stop(self) -> None:
"""Stop the channel."""
pass

@abc.abstractmethod
def is_alive(self):
def is_alive(self) -> bool:
"""Test whether the channel is alive."""
pass

@@ -32,20 +32,20 @@ class HBChannelABC(ChannelABC):
"""

@abc.abstractproperty
def time_to_dead(self):
def time_to_dead(self) -> float:
pass

@abc.abstractmethod
def pause(self):
def pause(self) -> None:
"""Pause the heartbeat channel."""
pass

@abc.abstractmethod
def unpause(self):
def unpause(self) -> None:
"""Unpause the heartbeat channel."""
pass

@abc.abstractmethod
def is_beating(self):
def is_beating(self) -> bool:
"""Test whether the channel is beating."""
pass
4 changes: 2 additions & 2 deletions jupyter_client/client.py
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ def _context_default(self) -> zmq.Context:
# flag for whether execute requests should be allowed to call raw_input:
allow_stdin: bool = True

def __del__(self):
def __del__(self) -> None:
"""Handle garbage collection. Destroy context if applicable."""
if (
self._created_context
@@ -511,7 +511,7 @@ async def _async_execute_interactive(
if output_hook is None and "IPython" in sys.modules:
from IPython import get_ipython

ip = get_ipython()
ip = get_ipython() # type:ignore[no-untyped-call]
in_kernel = getattr(ip, "kernel", False)
if in_kernel:
output_hook = partial(
41 changes: 27 additions & 14 deletions jupyter_client/clientabc.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,13 @@
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
from __future__ import annotations

import abc
from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
from .channelsabc import ChannelABC

# -----------------------------------------------------------------------------
# Main kernel client class
@@ -24,64 +30,71 @@ class KernelClientABC(metaclass=abc.ABCMeta):
"""

@abc.abstractproperty
def kernel(self):
def kernel(self) -> Any:
pass

@abc.abstractproperty
def shell_channel_class(self):
def shell_channel_class(self) -> type[ChannelABC]:
pass

@abc.abstractproperty
def iopub_channel_class(self):
def iopub_channel_class(self) -> type[ChannelABC]:
pass

@abc.abstractproperty
def hb_channel_class(self):
def hb_channel_class(self) -> type[ChannelABC]:
pass

@abc.abstractproperty
def stdin_channel_class(self):
def stdin_channel_class(self) -> type[ChannelABC]:
pass

@abc.abstractproperty
def control_channel_class(self):
def control_channel_class(self) -> type[ChannelABC]:
pass

# --------------------------------------------------------------------------
# Channel management methods
# --------------------------------------------------------------------------

@abc.abstractmethod
def start_channels(self, shell=True, iopub=True, stdin=True, hb=True, control=True):
def start_channels(
self,
shell: bool = True,
iopub: bool = True,
stdin: bool = True,
hb: bool = True,
control: bool = True,
) -> None:
"""Start the channels for the client."""
pass

@abc.abstractmethod
def stop_channels(self):
def stop_channels(self) -> None:
"""Stop the channels for the client."""
pass

@abc.abstractproperty
def channels_running(self):
def channels_running(self) -> bool:
"""Get whether the channels are running."""
pass

@abc.abstractproperty
def shell_channel(self):
def shell_channel(self) -> ChannelABC:
pass

@abc.abstractproperty
def iopub_channel(self):
def iopub_channel(self) -> ChannelABC:
pass

@abc.abstractproperty
def stdin_channel(self):
def stdin_channel(self) -> ChannelABC:
pass

@abc.abstractproperty
def hb_channel(self):
def hb_channel(self) -> ChannelABC:
pass

@abc.abstractproperty
def control_channel(self):
def control_channel(self) -> ChannelABC:
pass
Loading