Skip to content

Commit

Permalink
merge 2.12.4 from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmarkarl committed Jan 14, 2024
2 parents c0c54b8 + f9c6924 commit 7d322c9
Show file tree
Hide file tree
Showing 19 changed files with 564 additions and 490 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ updates:
directory: "/"
schedule:
interval: "weekly"
groups:
actions:
patterns:
- "*"
# Python
- package-ecosystem: "pip"
directory: "/"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
with:
package_name: jupytext
test_command: pip install pytest-jupyter[server] gitpython pre-commit && python -m ipykernel install --name jupytext-dev --user && pytest -vv -raXxs -W default --durations 10 --color=yes --ignore=tests/test_doc_files_are_notebooks.py --ignore=tests/test_changelog.py
test_command: pip install pytest-jupyter[server] gitpython pre-commit && python -m ipykernel install --name jupytext-dev --user && pytest -vv -raXxs -W default --durations 10 --color=yes

downstream_check: # This job does nothing and is only used for the branch protection
if: always()
Expand Down
16 changes: 5 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.2
rev: 0.27.3
hooks:
- id: check-github-workflows

Expand All @@ -33,17 +33,11 @@ repos:
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
types_or: [yaml, html, json]

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

- repo: https://github.com/codespell-project/codespell
rev: "v2.2.6"
hooks:
Expand All @@ -58,7 +52,7 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.7.1"
rev: "v1.8.0"
hooks:
- id: mypy
files: jupyter_server
Expand All @@ -67,7 +61,7 @@ repos:
["traitlets>=5.13", "jupyter_core>=5.5", "jupyter_client>=8.5"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
rev: v0.1.9
hooks:
- id: ruff
types_or: [python, jupyter]
Expand All @@ -76,7 +70,7 @@ repos:
types_or: [python, jupyter]

- repo: https://github.com/scientific-python/cookie
rev: "2023.11.17"
rev: "2023.12.21"
hooks:
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"]
5 changes: 5 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ python:
path: .
extra_requirements:
- docs
formats:
- epub
- htmlzip
# TODO: evaluate, see https://github.com/jupyter-server/jupyter_server/issues/1378
# - pdf
61 changes: 59 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,65 @@ All notable changes to this project will be documented in this file.

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

## 2.12.4

([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.12.3...7bb21b45392c889b5c87eb0d1b48662a497ba15a))

### Bugs fixed

- Fix log arguments for gateway client error [#1385](https://github.com/jupyter-server/jupyter_server/pull/1385) ([@minrk](https://github.com/minrk))

### Contributors to this release

([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_server/graphs/contributors?from=2024-01-09&to=2024-01-11&type=c))

[@minrk](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Aminrk+updated%3A2024-01-09..2024-01-11&type=Issues)

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

## 2.12.3

([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.12.2...99b9126853b69aafb700b4c92b50b83b7ca00e32))

### Bugs fixed

- Import User unconditionally [#1384](https://github.com/jupyter-server/jupyter_server/pull/1384) ([@yuvipanda](https://github.com/yuvipanda))

### Maintenance and upkeep improvements

- Simplify the jupytext downstream test [#1383](https://github.com/jupyter-server/jupyter_server/pull/1383) ([@mwouts](https://github.com/mwouts))
- Fix test param for pytest-xdist [#1382](https://github.com/jupyter-server/jupyter_server/pull/1382) ([@tornaria](https://github.com/tornaria))

### Contributors to this release

([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_server/graphs/contributors?from=2024-01-04&to=2024-01-09&type=c))

[@mwouts](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Amwouts+updated%3A2024-01-04..2024-01-09&type=Issues) | [@tornaria](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Atornaria+updated%3A2024-01-04..2024-01-09&type=Issues) | [@welcome](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Awelcome+updated%3A2024-01-04..2024-01-09&type=Issues) | [@yuvipanda](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Ayuvipanda+updated%3A2024-01-04..2024-01-09&type=Issues)

## 2.12.2

([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.12.1...49915685531ce90baae9d2a4d6baa9c533beffcc))

### Bugs fixed

- Fix a typo in error message [#1381](https://github.com/jupyter-server/jupyter_server/pull/1381) ([@krassowski](https://github.com/krassowski))
- Force legacy ws subprotocol when using gateway [#1311](https://github.com/jupyter-server/jupyter_server/pull/1311) ([@epignot](https://github.com/epignot))

### Maintenance and upkeep improvements

- Update pre-commit deps [#1380](https://github.com/jupyter-server/jupyter_server/pull/1380) ([@blink1073](https://github.com/blink1073))
- Use ruff docstring-code-format [#1377](https://github.com/jupyter-server/jupyter_server/pull/1377) ([@blink1073](https://github.com/blink1073))

### Documentation improvements

- Enable htmlzip and epub on readthedocs [#1379](https://github.com/jupyter-server/jupyter_server/pull/1379) ([@bollwyvl](https://github.com/bollwyvl))

### Contributors to this release

([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_server/graphs/contributors?from=2023-12-06&to=2024-01-04&type=c))

[@blink1073](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Ablink1073+updated%3A2023-12-06..2024-01-04&type=Issues) | [@bollwyvl](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Abollwyvl+updated%3A2023-12-06..2024-01-04&type=Issues) | [@epignot](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Aepignot+updated%3A2023-12-06..2024-01-04&type=Issues) | [@krassowski](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Akrassowski+updated%3A2023-12-06..2024-01-04&type=Issues)

## 2.12.1

([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.12.0...a59beb9b7bf3decc00af782821561435f47bbb16))
Expand All @@ -19,8 +78,6 @@ All notable changes to this project will be documented in this file.

[@minrk](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Aminrk+updated%3A2023-12-05..2023-12-06&type=Issues) | [@Zsailer](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3AZsailer+updated%3A2023-12-05..2023-12-06&type=Issues)

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

## 2.12.0

([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.11.2...3bd347b6f2ead5897a18c6171db1174eaaf6176d))
Expand Down
3 changes: 3 additions & 0 deletions examples/simple/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ source = "nodejs"
[tool.hatch.build.targets.wheel.shared-data]
"etc/jupyter/jupyter_server_config.d" = "etc/jupyter/jupyter_server_config.d"

[tool.hatch.build.targets.wheel]
packages = ["simple_ext1", "simple_ext2", "simple_ext11"]

[tool.hatch.build.hooks.jupyter-builder]
dependencies = [
"hatch-jupyter-builder>=0.8.2",
Expand Down
2 changes: 1 addition & 1 deletion jupyter_server/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import List

# Version string must appear intact for automatic versioning
__version__ = "2.12.1"
__version__ = "2.12.4"

# Build up version_info tuple for backwards compatibility
pattern = r"(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)"
Expand Down
11 changes: 5 additions & 6 deletions jupyter_server/auth/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def passwd(passphrase=None, algorithm="argon2"):
Examples
--------
>>> passwd('mypassword') # doctest: +ELLIPSIS
>>> passwd("mypassword") # doctest: +ELLIPSIS
'argon2:...'
"""
Expand Down Expand Up @@ -93,15 +93,14 @@ def passwd_check(hashed_passphrase, passphrase):
Examples
--------
>>> myhash = passwd('mypassword')
>>> passwd_check(myhash, 'mypassword')
>>> myhash = passwd("mypassword")
>>> passwd_check(myhash, "mypassword")
True
>>> passwd_check(myhash, 'otherpassword')
>>> passwd_check(myhash, "otherpassword")
False
>>> passwd_check('sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a',
... 'mypassword')
>>> passwd_check("sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a", "mypassword")
True
"""
if hashed_passphrase.startswith("argon2:"):
Expand Down
3 changes: 2 additions & 1 deletion jupyter_server/base/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from jupyter_server._sysinfo import get_sys_info
from jupyter_server._tz import utcnow
from jupyter_server.auth.decorator import authorized
from jupyter_server.auth.identity import User
from jupyter_server.i18n import combine_translations
from jupyter_server.services.security import csp_report_uri
from jupyter_server.utils import (
Expand All @@ -50,7 +51,7 @@
from tornado.concurrent import Future

from jupyter_server.auth.authorizer import Authorizer
from jupyter_server.auth.identity import IdentityProvider, User
from jupyter_server.auth.identity import IdentityProvider
from jupyter_server.serverapp import ServerApp
from jupyter_server.services.config.manager import ConfigManager
from jupyter_server.services.contents.manager import ContentsManager
Expand Down
7 changes: 6 additions & 1 deletion jupyter_server/gateway/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from tornado.escape import json_decode, url_escape, utf8
from tornado.httpclient import HTTPRequest
from tornado.ioloop import IOLoop
from traitlets import Bool, Instance, Int
from traitlets import Bool, Instance, Int, Unicode

from ..services.kernels.connection.base import BaseKernelWebsocketConnection
from ..utils import url_path_join
Expand All @@ -31,6 +31,11 @@ class GatewayWebSocketConnection(BaseKernelWebsocketConnection):

retry = Int(0)

# When opening ws connection to gateway, server already negotiated subprotocol with notebook client.
# Same protocol must be used for client and gateway, so legacy ws subprotocol for client is enforced here.

kernel_ws_protocol = Unicode("", allow_none=True, config=True)

async def connect(self):
"""Connect to the socket."""
# websocket is initialized before connection
Expand Down
28 changes: 16 additions & 12 deletions jupyter_server/gateway/gateway_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,22 +757,25 @@ async def _is_retryable(self, method: str, exception: Exception) -> bool:

async def gateway_request(endpoint: str, **kwargs: ty.Any) -> HTTPResponse:
"""Make an async request to kernel gateway endpoint, returns a response"""
kwargs = GatewayClient.instance().load_connection_args(**kwargs)
gateway_client = GatewayClient.instance()
kwargs = gateway_client.load_connection_args(**kwargs)
rhc = RetryableHTTPClient()
try:
response = await rhc.fetch(endpoint, **kwargs)
GatewayClient.instance().emit(
gateway_client.emit(
data={STATUS_KEY: SUCCESS_STATUS, STATUS_CODE_KEY: 200, MESSAGE_KEY: "success"}
)
# Trap a set of common exceptions so that we can inform the user that their Gateway url is incorrect
# or the server is not running.
# NOTE: We do this here since this handler is called during the server's startup and subsequent refreshes
# of the tree view.
except HTTPClientError as e:
GatewayClient.instance().emit(
gateway_client.emit(
data={STATUS_KEY: ERROR_STATUS, STATUS_CODE_KEY: e.code, MESSAGE_KEY: str(e.message)}
)
error_reason = f"Exception while attempting to connect to Gateway server url '{GatewayClient.instance().url}'"
error_reason = (
f"Exception while attempting to connect to Gateway server url '{gateway_client.url}'"
)
error_message = e.message
if e.response:
try:
Expand All @@ -788,38 +791,39 @@ async def gateway_request(endpoint: str, **kwargs: ty.Any) -> HTTPResponse:
"Ensure gateway url is valid and the Gateway instance is running.",
) from e
except ConnectionError as e:
GatewayClient.instance().emit(
gateway_client.emit(
data={STATUS_KEY: ERROR_STATUS, STATUS_CODE_KEY: 503, MESSAGE_KEY: str(e)}
)
raise web.HTTPError(
503,
f"ConnectionError was received from Gateway server url '{GatewayClient.instance().url}'. "
f"ConnectionError was received from Gateway server url '{gateway_client.url}'. "
"Check to be sure the Gateway instance is running.",
) from e
except gaierror as e:
GatewayClient.instance().emit(
gateway_client.emit(
data={STATUS_KEY: ERROR_STATUS, STATUS_CODE_KEY: 404, MESSAGE_KEY: str(e)}
)
raise web.HTTPError(
404,
f"The Gateway server specified in the gateway_url '{GatewayClient.instance().url}' doesn't "
f"The Gateway server specified in the gateway_url '{gateway_client.url}' doesn't "
f"appear to be valid. Ensure gateway url is valid and the Gateway instance is running.",
) from e
except Exception as e:
GatewayClient.instance().emit(
gateway_client.emit(
data={STATUS_KEY: ERROR_STATUS, STATUS_CODE_KEY: 505, MESSAGE_KEY: str(e)}
)
logging.getLogger("ServerApp").error(
f"Exception while trying to launch kernel via Gateway URL {GatewayClient.instance().url} , {e}",
"Exception while trying to launch kernel via Gateway URL %s: %s",
gateway_client.url,
e,
)
raise e

if GatewayClient.instance().accept_cookies:
if gateway_client.accept_cookies:
# Update cookies on GatewayClient from server if configured.
cookie_values = response.headers.get("Set-Cookie")
if cookie_values:
cookie: SimpleCookie = SimpleCookie()
cookie.load(cookie_values)
GatewayClient.instance().update_cookies(cookie)
gateway_client.update_cookies(cookie)
return response
Loading

0 comments on commit 7d322c9

Please sign in to comment.