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: v7.4.2
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: v7.4.3
Choose a head ref
  • 2 commits
  • 4 files changed
  • 3 contributors

Commits on Oct 19, 2022

  1. Backport PR #858 on branch 7.x (Defer creation of ready future) (#859)

    Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
    meeseeksmachine and blink1073 authored Oct 19, 2022
    Copy the full SHA
    aa549b2 View commit details
  2. Publish 7.4.3

    SHA256 hashes:
    
    jupyter_client-7.4.3-py3-none-any.whl: 8845e3f5a339734b1ecc21d2100638aa1c7a145e356a31845f155cda5b624b1c
    
    jupyter_client-7.4.3.tar.gz: 4fa2514cdb54dd9fbdcf7d7e4c5c3c8a973028168a8b4fc097b6aef625be13b0
    blink1073 committed Oct 19, 2022
    Copy the full SHA
    8978d52 View commit details
Showing with 36 additions and 20 deletions.
  1. +16 −2 CHANGELOG.md
  2. +1 −1 jupyter_client/_version.py
  3. +16 −14 jupyter_client/manager.py
  4. +3 −3 pyproject.toml
18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,22 @@

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

## 7.4.3

([Full Changelog](https://github.com/jupyter/jupyter_client/compare/v7.4.2...aa549b27d3622b1c381275777785f84dd3d5253d))

### Bugs fixed

- Defer creation of ready future [#858](https://github.com/jupyter/jupyter_client/pull/858) ([@blink1073](https://github.com/blink1073))

### Contributors to this release

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

[@meeseeksmachine](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3Ameeseeksmachine+updated%3A2022-10-11..2022-10-19&type=Issues)

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

## 7.4.2

([Full Changelog](https://github.com/jupyter/jupyter_client/compare/v7.4.1...0a45cc41e4ce73911e4367eddc1f0001a8431fc0))
@@ -16,8 +32,6 @@

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

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

## 7.4.1

([Full Changelog](https://github.com/jupyter/jupyter_client/compare/v7.4.0...0d87835d82d485aa3e870a63e76768bf439c3fe4))
2 changes: 1 addition & 1 deletion jupyter_client/_version.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
from typing import List
from typing import Union

__version__ = "7.4.2"
__version__ = "7.4.3"

# Build up version_info tuple for backwards compatibility
pattern = r'(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)'
30 changes: 16 additions & 14 deletions jupyter_client/manager.py
Original file line number Diff line number Diff line change
@@ -55,6 +55,16 @@ class _ShutdownStatus(Enum):
F = t.TypeVar('F', bound=t.Callable[..., t.Any])


def _get_future() -> t.Union[Future, CFuture]:
"""Get an appropriate Future object"""
try:
asyncio.get_running_loop()
return Future()
except RuntimeError:
# No event loop running, use concurrent future
return CFuture()


def in_pending_state(method: F) -> F:
"""Sets the kernel to a pending state by
creating a fresh Future for the KernelManager's `ready`
@@ -65,12 +75,8 @@ def in_pending_state(method: F) -> F:
@functools.wraps(method)
async def wrapper(self, *args, **kwargs):
# Create a future for the decorated method
if self._attempted_start:
try:
self._ready = Future()
except RuntimeError:
# No event loop running, use concurrent future
self._ready = CFuture()
if self._attempted_start or not self._ready:
self._ready = _get_future()
try:
# call wrapped method, await, and set the result or exception.
out = await method(self, *args, **kwargs)
@@ -92,19 +98,13 @@ class KernelManager(ConnectionFileMixin):
This version starts kernels with Popen.
"""

_ready: t.Union[Future, CFuture]
_ready: t.Optional[t.Union[Future, CFuture]]

def __init__(self, *args, **kwargs):
super().__init__(**kwargs)
self._shutdown_status = _ShutdownStatus.Unset
self._attempted_start = False
# Create a place holder future.
try:
asyncio.get_running_loop()
self._ready = Future()
except RuntimeError:
# No event loop running, use concurrent future
self._ready = CFuture()
self._ready = None

_created_context: Bool = Bool(False)

@@ -189,6 +189,8 @@ def _default_cache_ports(self) -> bool:
@property
def ready(self) -> t.Union[CFuture, Future]:
"""A future that resolves when the kernel process has started for the first time"""
if not self._ready:
self._ready = _get_future()
return self._ready

@property
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "jupyter_client"
version = "7.4.2"
version = "7.4.3"
description = "Jupyter protocol implementation and client libraries"
keywords = [ "Interactive", "Interpreter", "Shell", "Web",]
classifiers = [
@@ -51,7 +51,7 @@ Homepage = "https://jupyter.org"
test = [
"codecov",
"coverage",
"ipykernel>=6.5",
"ipykernel>=6.12",
"ipython",
"mypy",
"pre-commit",
@@ -93,7 +93,7 @@ skip = ["check-links"]
ignore = [".mailmap", "*.yml", "*.yaml"]

[tool.tbump.version]
current = "7.4.2"
current = "7.4.3"
regex = '''
(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
((?P<channel>a|b|rc|.dev)(?P<release>\d+))?