From a6fc5809f127a6788f340130f8d3560667b89c62 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 18 Apr 2026 06:50:10 +0000 Subject: [PATCH 1/4] python3Packages.jupyterlab-server: use finalAttrs --- .../python-modules/jupyterlab-server/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/jupyterlab-server/default.nix b/pkgs/development/python-modules/jupyterlab-server/default.nix index a87b821b54aa..986b9e236e68 100644 --- a/pkgs/development/python-modules/jupyterlab-server/default.nix +++ b/pkgs/development/python-modules/jupyterlab-server/default.nix @@ -18,14 +18,14 @@ strict-rfc3339, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "jupyterlab-server"; version = "2.28.0"; pyproject = true; src = fetchPypi { pname = "jupyterlab_server"; - inherit version; + inherit (finalAttrs) version; hash = "sha256-NbqoGJixX5NXPi3spQ0RrArkB+u2iCmdOlITJlAzcSw="; }; @@ -58,7 +58,7 @@ buildPythonPackage rec { requests-mock strict-rfc3339 ] - ++ optional-dependencies.openapi; + ++ finalAttrs.passthru.optional-dependencies.openapi; preCheck = '' export HOME=$(mktemp -d) @@ -82,8 +82,8 @@ buildPythonPackage rec { meta = { description = "Set of server components for JupyterLab and JupyterLab like applications"; homepage = "https://github.com/jupyterlab/jupyterlab_server"; - changelog = "https://github.com/jupyterlab/jupyterlab_server/blob/v${version}/CHANGELOG.md"; + changelog = "https://github.com/jupyterlab/jupyterlab_server/blob/v${finalAttrs.version}/CHANGELOG.md"; license = lib.licenses.bsd3; teams = [ lib.teams.jupyter ]; }; -} +}) From 4a7ea26de40ef3d78634404e0f3bd7c4c34e7106 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 18 Apr 2026 07:30:53 +0000 Subject: [PATCH 2/4] python3Packages.jupyterlab-server: fix build --- .../jupyterlab-server/default.nix | 5 ++ .../fix-openapi-core-compat.patch | 58 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 pkgs/development/python-modules/jupyterlab-server/fix-openapi-core-compat.patch diff --git a/pkgs/development/python-modules/jupyterlab-server/default.nix b/pkgs/development/python-modules/jupyterlab-server/default.nix index 986b9e236e68..953272407217 100644 --- a/pkgs/development/python-modules/jupyterlab-server/default.nix +++ b/pkgs/development/python-modules/jupyterlab-server/default.nix @@ -29,6 +29,11 @@ buildPythonPackage (finalAttrs: { hash = "sha256-NbqoGJixX5NXPi3spQ0RrArkB+u2iCmdOlITJlAzcSw="; }; + patches = [ + # oopenapi-core changed their API, which breaks jupyterlab-server + ./fix-openapi-core-compat.patch + ]; + postPatch = '' sed -i "/timeout/d" pyproject.toml ''; diff --git a/pkgs/development/python-modules/jupyterlab-server/fix-openapi-core-compat.patch b/pkgs/development/python-modules/jupyterlab-server/fix-openapi-core-compat.patch new file mode 100644 index 000000000000..0b736618e12f --- /dev/null +++ b/pkgs/development/python-modules/jupyterlab-server/fix-openapi-core-compat.patch @@ -0,0 +1,58 @@ +diff --git a/jupyterlab_server/spec.py b/jupyterlab_server/spec.py +index 94347b9..6e0d7d4 100644 +--- a/jupyterlab_server/spec.py ++++ b/jupyterlab_server/spec.py +@@ -9,17 +9,17 @@ import typing + from pathlib import Path + + if typing.TYPE_CHECKING: +- from openapi_core.spec.paths import Spec ++ from jsonschema_path import SchemaPath + + HERE = Path(os.path.dirname(__file__)).resolve() + + +-def get_openapi_spec() -> Spec: ++def get_openapi_spec() -> SchemaPath: + """Get the OpenAPI spec object.""" +- from openapi_core.spec.paths import Spec ++ from jsonschema_path import SchemaPath + + openapi_spec_dict = get_openapi_spec_dict() +- return Spec.from_dict(openapi_spec_dict) # type:ignore[arg-type] ++ return SchemaPath.from_dict(openapi_spec_dict) + + + def get_openapi_spec_dict() -> dict[str, typing.Any]: +diff --git a/jupyterlab_server/test_utils.py b/jupyterlab_server/test_utils.py +index c1d8956..337bb53 100644 +--- a/jupyterlab_server/test_utils.py ++++ b/jupyterlab_server/test_utils.py +@@ -13,8 +13,8 @@ from urllib.parse import parse_qs, urlparse + + import tornado.httpclient + import tornado.web ++from jsonschema_path import SchemaPath + from openapi_core import V30RequestValidator, V30ResponseValidator +-from openapi_core.spec.paths import Spec + from openapi_core.validation.request.datatypes import RequestParameters + from tornado.httpclient import HTTPRequest, HTTPResponse + from werkzeug.datastructures import Headers, ImmutableMultiDict +@@ -32,7 +32,7 @@ class TornadoOpenAPIRequest: + Converts a torando request to an OpenAPI one + """ + +- def __init__(self, request: HTTPRequest, spec: Spec): ++ def __init__(self, request: HTTPRequest, spec: SchemaPath): + """Initialize the request.""" + self.request = request + self.spec = spec +@@ -76,7 +76,7 @@ class TornadoOpenAPIRequest: + # https://github.com/OAI/OpenAPI-Specification/issues/892 + url = None + o = urlparse(self.request.url) +- for path_ in self.spec["paths"]: ++ for path_ in self.spec["paths"].keys(): + if url: + continue # type:ignore[unreachable] + has_arg = "{" in path_ From 0d132573a11441a6b6f3d1cc00075c30233343da Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 18 Apr 2026 07:33:29 +0000 Subject: [PATCH 3/4] python3Packages.jupyterlab-server: use fetchFromGitHub instead of fetchPypi --- .../python-modules/jupyterlab-server/default.nix | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkgs/development/python-modules/jupyterlab-server/default.nix b/pkgs/development/python-modules/jupyterlab-server/default.nix index 953272407217..ea4c2b9146b6 100644 --- a/pkgs/development/python-modules/jupyterlab-server/default.nix +++ b/pkgs/development/python-modules/jupyterlab-server/default.nix @@ -1,7 +1,7 @@ { lib, buildPythonPackage, - fetchPypi, + fetchFromGitHub, hatchling, babel, jinja2, @@ -23,10 +23,11 @@ buildPythonPackage (finalAttrs: { version = "2.28.0"; pyproject = true; - src = fetchPypi { - pname = "jupyterlab_server"; - inherit (finalAttrs) version; - hash = "sha256-NbqoGJixX5NXPi3spQ0RrArkB+u2iCmdOlITJlAzcSw="; + src = fetchFromGitHub { + owner = "jupyterlab"; + repo = "jupyterlab_server"; + tag = "v${finalAttrs.version}"; + hash = "sha256-/h25HBKt6maaxuZRK+VMVA0AqTZhQkDnGVDgBisQcCw="; }; patches = [ @@ -87,7 +88,7 @@ buildPythonPackage (finalAttrs: { meta = { description = "Set of server components for JupyterLab and JupyterLab like applications"; homepage = "https://github.com/jupyterlab/jupyterlab_server"; - changelog = "https://github.com/jupyterlab/jupyterlab_server/blob/v${finalAttrs.version}/CHANGELOG.md"; + changelog = "https://github.com/jupyterlab/jupyterlab_server/blob/${finalAttrs.src.tag}/CHANGELOG.md"; license = lib.licenses.bsd3; teams = [ lib.teams.jupyter ]; }; From d2ef1f35100fa579d6dd7eb368818d96390b29ac Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 18 Apr 2026 07:39:09 +0000 Subject: [PATCH 4/4] python3Packages.jupyterlab-server: cleanup --- .../jupyterlab-server/default.nix | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/pkgs/development/python-modules/jupyterlab-server/default.nix b/pkgs/development/python-modules/jupyterlab-server/default.nix index ea4c2b9146b6..b091c9a92abf 100644 --- a/pkgs/development/python-modules/jupyterlab-server/default.nix +++ b/pkgs/development/python-modules/jupyterlab-server/default.nix @@ -2,7 +2,11 @@ lib, buildPythonPackage, fetchFromGitHub, + + # build-system hatchling, + + # dependencies babel, jinja2, json5, @@ -10,12 +14,18 @@ jupyter-server, packaging, requests, + + # optional-dependencies openapi-core, + ruamel-yaml, + + # tests pytest-jupyter, + pytest-timeout, pytestCheckHook, requests-mock, - ruamel-yaml, strict-rfc3339, + writableTmpDirAsHomeHook, }: buildPythonPackage (finalAttrs: { @@ -35,11 +45,9 @@ buildPythonPackage (finalAttrs: { ./fix-openapi-core-compat.patch ]; - postPatch = '' - sed -i "/timeout/d" pyproject.toml - ''; - - build-system = [ hatchling ]; + build-system = [ + hatchling + ]; dependencies = [ babel @@ -58,31 +66,23 @@ buildPythonPackage (finalAttrs: { ]; }; + pythonImportsCheck = [ "jupyterlab_server" ]; + nativeCheckInputs = [ pytest-jupyter + pytest-timeout pytestCheckHook requests-mock strict-rfc3339 + writableTmpDirAsHomeHook ] ++ finalAttrs.passthru.optional-dependencies.openapi; - preCheck = '' - export HOME=$(mktemp -d) - ''; - - pytestFlags = [ - "-Wignore::DeprecationWarning" - ]; - disabledTestPaths = [ # require optional language pack packages for tests "tests/test_translation_api.py" ]; - pythonImportsCheck = [ - "jupyterlab_server" - ]; - __darwinAllowLocalNetworking = true; meta = {