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-server/jupyter_server
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.0a1
Choose a base ref
...
head repository: jupyter-server/jupyter_server
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bd1e7d70b64716097c6b064b2fd5dc67e23d2320
Choose a head ref
  • 14 commits
  • 11 files changed
  • 7 contributors

Commits on Jun 7, 2022

  1. Bump to 2.1.0.dev0

    Zsailer committed Jun 7, 2022
    Copy the full SHA
    a9efcb7 View commit details

Commits on Jun 8, 2022

  1. Fix sphinx 5.0 support (#865)

    * fix sphinx 5.0 support
    
    * [pre-commit.ci] auto fixes from pre-commit.com hooks
    
    for more information, see https://pre-commit.ci
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    blink1073 and pre-commit-ci[bot] authored Jun 8, 2022
    Copy the full SHA
    83a1669 View commit details

Commits on Jun 13, 2022

  1. [pre-commit.ci] pre-commit autoupdate (#866)

    updates:
    - [github.com/pre-commit/pre-commit-hooks: v4.2.0 → v4.3.0](pre-commit/pre-commit-hooks@v4.2.0...v4.3.0)
    - [github.com/pre-commit/mirrors-mypy: v0.960 → v0.961](pre-commit/mirrors-mypy@v0.960...v0.961)
    - [github.com/asottile/pyupgrade: v2.32.1 → v2.34.0](asottile/pyupgrade@v2.32.1...v2.34.0)
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Jun 13, 2022
    Copy the full SHA
    595ce61 View commit details
  2. Fix lint (#867)

    blink1073 authored Jun 13, 2022
    Copy the full SHA
    b82d102 View commit details

Commits on Jun 15, 2022

  1. Copy the full SHA
    29911b1 View commit details
  2. Fix gateway kernel shutdown (#874)

    * Fix gateway kernel shutdown
    
    * Add test for shutdown_all scenarios
    kevin-bates authored Jun 15, 2022
    Copy the full SHA
    d901415 View commit details

Commits on Jun 16, 2022

  1. Show import error when faiing to load an extension (#878)

    import error may not be on the top-level module, it could deeper,
    e.g. during load
    minrk authored Jun 16, 2022
    Copy the full SHA
    7b5815e View commit details

Commits on Jun 17, 2022

  1. Copy the full SHA
    544f7d3 View commit details

Commits on Jun 20, 2022

  1. [pre-commit.ci] pre-commit autoupdate (#885)

    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Jun 20, 2022
    Copy the full SHA
    6c91556 View commit details

Commits on Jun 22, 2022

  1. Normalize os_path (#886)

    martinRenou authored Jun 22, 2022
    Copy the full SHA
    dee8c7a View commit details

Commits on Jun 27, 2022

  1. Make ChannelQueue.get_msg true async (#892)

    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    CiprianAnton and pre-commit-ci[bot] authored Jun 27, 2022
    Copy the full SHA
    b2669c5 View commit details
  2. [pre-commit.ci] pre-commit autoupdate (#894)

    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Jun 27, 2022
    Copy the full SHA
    4f1e09e View commit details

Commits on Jun 29, 2022

  1. Copy the full SHA
    ee40dbc View commit details

Commits on Jul 5, 2022

  1. [pre-commit.ci] pre-commit autoupdate (#902)

    updates:
    - [github.com/psf/black: 22.3.0 → 22.6.0](psf/black@22.3.0...22.6.0)
    - [github.com/pre-commit/mirrors-eslint: v8.18.0 → v8.19.0](pre-commit/mirrors-eslint@v8.18.0...v8.19.0)
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Jul 5, 2022
    Copy the full SHA
    bd1e7d7 View commit details
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.3.0
hooks:
- id: end-of-file-fixer
- id: check-case-conflict
@@ -16,7 +16,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.6.0
hooks:
- id: black

@@ -27,19 +27,19 @@ repos:
files: \.py$

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.960
rev: v0.961
hooks:
- id: mypy
exclude: examples/simple/setup.py
additional_dependencies: [types-requests]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.6.2
rev: v2.7.1
hooks:
- id: prettier

- repo: https://github.com/asottile/pyupgrade
rev: v2.32.1
rev: v2.34.0
hooks:
- id: pyupgrade
args: [--py37-plus]
@@ -65,13 +65,13 @@ repos:
stages: [manual]

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.17.0
rev: v8.19.0
hooks:
- id: eslint
stages: [manual]

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.16.0
rev: 0.16.2
hooks:
- id: check-jsonschema
name: "Check GitHub Workflows"
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.

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

## 2.0.0a1

([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.0.0a0...v2.0.0a1)

- Address security advisory [GHSA-q874-g24w-4q9g](https://github.com/jupyter-server/jupyter_server/security/advisories/GHSA-q874-g24w-4q9g).

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

## 2.0.0a0

([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v1.16.0...3e64fa5eef7fba9f8e17c30cec688254adf913bd))
@@ -60,8 +68,6 @@ All notable changes to this project will be documented in this file.

[@andreyvelich](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Aandreyvelich+updated%3A2022-03-29..2022-05-03&type=Issues) | [@blink1073](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Ablink1073+updated%3A2022-03-29..2022-05-03&type=Issues) | [@bollwyvl](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Abollwyvl+updated%3A2022-03-29..2022-05-03&type=Issues) | [@codecov-commenter](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Acodecov-commenter+updated%3A2022-03-29..2022-05-03&type=Issues) | [@davidbrochart](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Adavidbrochart+updated%3A2022-03-29..2022-05-03&type=Issues) | [@echarles](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Aecharles+updated%3A2022-03-29..2022-05-03&type=Issues) | [@hbcarlos](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Ahbcarlos+updated%3A2022-03-29..2022-05-03&type=Issues) | [@kevin-bates](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Akevin-bates+updated%3A2022-03-29..2022-05-03&type=Issues) | [@meeseeksdev](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Ameeseeksdev+updated%3A2022-03-29..2022-05-03&type=Issues) | [@mgorny](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Amgorny+updated%3A2022-03-29..2022-05-03&type=Issues) | [@minrk](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Aminrk+updated%3A2022-03-29..2022-05-03&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Apre-commit-ci+updated%3A2022-03-29..2022-05-03&type=Issues) | [@SylvainCorlay](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3ASylvainCorlay+updated%3A2022-03-29..2022-05-03&type=Issues) | [@welcome](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Awelcome+updated%3A2022-03-29..2022-05-03&type=Issues) | [@Wh1isper](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3AWh1isper+updated%3A2022-03-29..2022-05-03&type=Issues) | [@willingc](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Awillingc+updated%3A2022-03-29..2022-05-03&type=Issues) | [@Zsailer](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3AZsailer+updated%3A2022-03-29..2022-05-03&type=Issues)

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

## 1.17.0

([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v1.16.0...2b296099777d50aa86f67faf94d5cbfde906b169))
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -108,7 +108,7 @@
# |version| and |release|, also used in various other places throughout the
# built documents.
#
__version__ = "2.0.0a1"
__version__ = "2.1.0.dev0"
# The short X.Y version.
version_parsed = parse_version(__version__)
version = f"{version_parsed.major}.{version_parsed.minor}"
@@ -118,7 +118,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
2 changes: 1 addition & 1 deletion jupyter_server/_version.py
Original file line number Diff line number Diff line change
@@ -2,5 +2,5 @@
store the current version info of the server.
"""
version_info = (2, 0, 0, "a", "1")
version_info = (2, 1, 0, ".dev", "0")
__version__ = ".".join(map(str, version_info[:3])) + "".join(version_info[3:])
6 changes: 3 additions & 3 deletions jupyter_server/extension/manager.py
Original file line number Diff line number Diff line change
@@ -175,10 +175,10 @@ def _validate_name(self, proposed):
self._extension_points = {}
try:
self._module, self._metadata = get_metadata(name)
except ImportError:
except ImportError as e:
raise ExtensionModuleNotFound(
"The module '{name}' could not be found. Are you "
"sure the extension is installed?".format(name=name)
"The module '{name}' could not be found ({e}). Are you "
"sure the extension is installed?".format(name=name, e=e)
)
# Create extension point interfaces for each extension path.
for m in self._metadata:
77 changes: 56 additions & 21 deletions jupyter_server/gateway/managers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import asyncio
import datetime
import json
import os
from logging import Logger
from queue import Queue
from queue import Empty, Queue
from threading import Thread
from time import monotonic
from typing import Any, Dict, Optional

import websocket
@@ -92,7 +94,7 @@ async def kernel_model(self, kernel_id):
The uuid of the kernel.
"""
model = None
km = self.get_kernel(kernel_id)
km = self.get_kernel(str(kernel_id))
if km:
model = km.kernel
return model
@@ -166,13 +168,14 @@ async def interrupt_kernel(self, kernel_id, **kwargs):

async def shutdown_all(self, now=False):
"""Shutdown all kernels."""
for kernel_id in self._kernels:
kids = list(self._kernels)
for kernel_id in kids:
km = self.get_kernel(kernel_id)
await km.shutdown_kernel(now=now)
self.remove_kernel(kernel_id)

async def cull_kernels(self):
"""Override cull_kernels so we can be sure their state is current."""
"""Override cull_kernels, so we can be sure their state is current."""
await self.list_kernels()
await super().cull_kernels()

@@ -295,7 +298,7 @@ class GatewaySessionManager(SessionManager):
kernel_manager = Instance("jupyter_server.gateway.managers.GatewayMappingKernelManager")

async def kernel_culled(self, kernel_id):
"""Checks if the kernel is still considered alive and returns true if its not found."""
"""Checks if the kernel is still considered alive and returns true if it's not found."""
kernel = None
try:
km = self.kernel_manager.get_kernel(kernel_id)
@@ -387,7 +390,7 @@ async def refresh_model(self, model=None):
if isinstance(self.parent, AsyncMappingKernelManager):
# Update connections only if there's a mapping kernel manager parent for
# this kernel manager. The current kernel manager instance may not have
# an parent instance if, say, a server extension is using another application
# a parent instance if, say, a server extension is using another application
# (e.g., papermill) that uses a KernelManager instance directly.
self.parent._kernel_connections[self.kernel_id] = int(model["connections"])

@@ -448,8 +451,14 @@ async def shutdown_kernel(self, now=False, restart=False):

if self.has_kernel:
self.log.debug("Request shutdown kernel at: %s", self.kernel_url)
response = await gateway_request(self.kernel_url, method="DELETE")
self.log.debug("Shutdown kernel response: %d %s", response.code, response.reason)
try:
response = await gateway_request(self.kernel_url, method="DELETE")
self.log.debug("Shutdown kernel response: %d %s", response.code, response.reason)
except web.HTTPError as error:
if error.status_code == 404:
self.log.debug("Shutdown kernel response: kernel not found (ignored)")
else:
raise

async def restart_kernel(self, **kw):
"""Restarts a kernel via HTTP."""
@@ -489,16 +498,35 @@ def cleanup_resources(self, restart=False):
class ChannelQueue(Queue):

channel_name: Optional[str] = None
response_router_finished: bool

def __init__(self, channel_name: str, channel_socket: websocket.WebSocket, log: Logger):
super().__init__()
self.channel_name = channel_name
self.channel_socket = channel_socket
self.log = log
self.response_router_finished = False

async def _async_get(self, timeout=None):
if timeout is None:
timeout = float("inf")
elif timeout < 0:
raise ValueError("'timeout' must be a non-negative number")
end_time = monotonic() + timeout

while True:
try:
return self.get(block=False)
except Empty:
if self.response_router_finished:
raise RuntimeError("Response router had finished")
if monotonic() > end_time:
raise
await asyncio.sleep(0)

async def get_msg(self, *args: Any, **kwargs: Any) -> dict:
timeout = kwargs.get("timeout", 1)
msg = self.get(timeout=timeout)
msg = await self._async_get(timeout=timeout)
self.log.debug(
"Received message on channel: {}, msg_id: {}, msg_type: {}".format(
self.channel_name, msg["msg_id"], msg["msg_type"] if msg else "null"
@@ -518,7 +546,7 @@ def send(self, msg: dict) -> None:

@staticmethod
def serialize_datetime(dt):
if isinstance(dt, (datetime.datetime)):
if isinstance(dt, datetime.datetime):
return dt.timestamp()
return None

@@ -574,16 +602,16 @@ class GatewayKernelClient(AsyncKernelClient):
# flag for whether execute requests should be allowed to call raw_input:
allow_stdin = False
_channels_stopped: bool
_channel_queues: Optional[dict]
_channel_queues: Optional[Dict[str, ChannelQueue]]
_control_channel: Optional[ChannelQueue]
_hb_channel: Optional[ChannelQueue]
_stdin_channel: Optional[ChannelQueue]
_iopub_channel: Optional[ChannelQueue]
_shell_channel: Optional[ChannelQueue]

def __init__(self, **kwargs):
def __init__(self, kernel_id, **kwargs):
super().__init__(**kwargs)
self.kernel_id = kwargs["kernel_id"]
self.kernel_id = kernel_id
self.channel_socket: Optional[websocket.WebSocket] = None
self.response_router: Optional[Thread] = None
self._channels_stopped = False
@@ -597,7 +625,7 @@ async def start_channels(self, shell=True, iopub=True, stdin=True, hb=True, cont
"""Starts the channels for this kernel.
For this class, we establish a websocket connection to the destination
and setup the channel-based queues on which applicable messages will
and set up the channel-based queues on which applicable messages will
be posted.
"""

@@ -608,24 +636,26 @@ async def start_channels(self, shell=True, iopub=True, stdin=True, hb=True, cont
"channels",
)
# Gather cert info in case where ssl is desired...
ssl_options = {}
ssl_options["ca_certs"] = GatewayClient.instance().ca_certs
ssl_options["certfile"] = GatewayClient.instance().client_cert
ssl_options["keyfile"] = GatewayClient.instance().client_key
ssl_options = {
"ca_certs": GatewayClient.instance().ca_certs,
"certfile": GatewayClient.instance().client_cert,
"keyfile": GatewayClient.instance().client_key,
}

self.channel_socket = websocket.create_connection(
ws_url,
timeout=GatewayClient.instance().KERNEL_LAUNCH_TIMEOUT,
enable_multithread=True,
sslopt=ssl_options,
)
self.response_router = Thread(target=self._route_responses)
self.response_router.start()

await ensure_async(
super().start_channels(shell=shell, iopub=iopub, stdin=stdin, hb=hb, control=control)
)

self.response_router = Thread(target=self._route_responses)
self.response_router.start()

def stop_channels(self):
"""Stops all the running channels for this kernel.
@@ -722,12 +752,17 @@ def _route_responses(self):
self._channel_queues[channel].put_nowait(response_message)

except websocket.WebSocketConnectionClosedException:
pass # websocket closure most likely due to shutdown
pass # websocket closure most likely due to shut down

except BaseException as be:
if not self._channels_stopped:
self.log.warning(f"Unexpected exception encountered ({be})")

# Notify channel queues that this thread had finished and no more messages are being received
assert self._channel_queues is not None
for channel_queue in self._channel_queues.values():
channel_queue.response_router_finished = True

self.log.debug("Response router thread exiting...")


2 changes: 1 addition & 1 deletion jupyter_server/utils.py
Original file line number Diff line number Diff line change
@@ -111,7 +111,7 @@ def to_os_path(path, root=""):
parts = path.strip("/").split("/")
parts = [p for p in parts if p != ""] # remove duplicate splits
path = os.path.join(root, *parts)
return path
return os.path.normpath(path)


def to_api_path(os_path, root=""):
8 changes: 5 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_server"
version = "2.0.0a1"
version = "2.1.0.dev0"
readme = "README.md"
license = { file = "COPYING.md" }
description = "The backend—i.e. core services, APIs, and REST endpoints—to Jupyter web applications."
@@ -100,7 +100,9 @@ timeout = 300
# timeout_method = "thread"
filterwarnings = [
"error",
"ignore:There is no current event loop:DeprecationWarning",
"module:make_current is deprecated:DeprecationWarning",
"module:clear_current is deprecated:DeprecationWarning",
"module:There is no current event loop:DeprecationWarning",
"ignore:Passing a schema to Validator.iter_errors:DeprecationWarning",
"ignore:unclosed <socket.socket:ResourceWarning",
"ignore:unclosed event loop:ResourceWarning",
@@ -118,7 +120,7 @@ post-version-spec = "dev"
pydist_resource_paths = ["jupyter_server/static/style/bootstrap.min.css", "jupyter_server/static/style/bootstrap-theme.min.css"]

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