From f7543da6287768922fe39444ca0982396fe6f0e0 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 28 Apr 2025 10:37:50 +0200 Subject: [PATCH 1/3] python312Packages.jupyterhub: cleanup --- .../python-modules/jupyterhub/default.nix | 90 +++++++++++-------- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/pkgs/development/python-modules/jupyterhub/default.nix b/pkgs/development/python-modules/jupyterhub/default.nix index 0e1fa2f5bc22..2556be5d4b0d 100644 --- a/pkgs/development/python-modules/jupyterhub/default.nix +++ b/pkgs/development/python-modules/jupyterhub/default.nix @@ -1,42 +1,51 @@ { lib, - stdenv, - alembic, - async-generator, - beautifulsoup4, buildPythonPackage, - certipy, - configurable-http-proxy, - cryptography, fetchFromGitHub, fetchNpmDeps, - idna, - importlib-metadata, - jinja2, - jsonschema, - jupyter-events, - jupyterlab, - mock, - nbclassic, + configurable-http-proxy, + + # nativeBuildInputs nodejs, npmHooks, + + # build-system + setuptools, + setuptools-scm, + + # dependencies + alembic, + certipy, + idna, + jinja2, + jupyter-events, oauthlib, packaging, pamela, - playwright, prometheus-client, pydantic, - pytest-asyncio, - pytestCheckHook, python-dateutil, - pythonOlder, requests, - requests-mock, - setuptools, - setuptools-scm, sqlalchemy, tornado, traitlets, + pythonOlder, + async-generator, + importlib-metadata, + + # tests + addBinToPathHook, + beautifulsoup4, + cryptography, + jsonschema, + jupyterlab, + mock, + nbclassic, + playwright, + pytest-asyncio, + pytestCheckHook, + requests-mock, + versionCheckHook, virtualenv, }: @@ -45,8 +54,6 @@ buildPythonPackage rec { version = "5.2.1"; pyproject = true; - disabled = pythonOlder "3.8"; - src = fetchFromGitHub { owner = "jupyterhub"; repo = "jupyterhub"; @@ -60,13 +67,15 @@ buildPythonPackage rec { }; postPatch = '' - substituteInPlace jupyterhub/proxy.py --replace-fail \ - "'configurable-http-proxy'" \ - "'${configurable-http-proxy}/bin/configurable-http-proxy'" + substituteInPlace jupyterhub/proxy.py \ + --replace-fail \ + "'configurable-http-proxy'" \ + "'${lib.getExe configurable-http-proxy}'" - substituteInPlace jupyterhub/tests/test_proxy.py --replace-fail \ - "'configurable-http-proxy'" \ - "'${configurable-http-proxy}/bin/configurable-http-proxy'" + substituteInPlace jupyterhub/tests/test_proxy.py \ + --replace-fail \ + "'configurable-http-proxy'" \ + "'${lib.getExe configurable-http-proxy}'" ''; nativeBuildInputs = [ @@ -102,7 +111,10 @@ buildPythonPackage rec { importlib-metadata ]; + pythonImportsCheck = [ "jupyterhub" ]; + nativeCheckInputs = [ + addBinToPathHook beautifulsoup4 cryptography jsonschema @@ -124,12 +136,10 @@ buildPythonPackage rec { )) pytestCheckHook requests-mock + versionCheckHook virtualenv ]; - - preCheck = '' - export PATH=$out/bin:$PATH; - ''; + versionCheckProgramArg = "--version"; disabledTests = [ # Tries to install older versions through pip @@ -164,13 +174,15 @@ buildPythonPackage rec { "jupyterhub/tests/test_user.py" ]; - meta = with lib; { + meta = { description = "Serves multiple Jupyter notebook instances"; homepage = "https://github.com/jupyterhub/jupyterhub"; changelog = "https://github.com/jupyterhub/jupyterhub/blob/${version}/docs/source/reference/changelog.md"; - license = licenses.bsd3; - teams = [ teams.jupyter ]; - # darwin: E OSError: dlopen(/nix/store/43zml0mlr17r5jsagxr00xxx91hz9lky-openpam-20170430/lib/libpam.so, 6): image not found - broken = stdenv.hostPlatform.isDarwin; + license = lib.licenses.bsd3; + teams = [ lib.teams.jupyter ]; + badPlatforms = [ + # E OSError: dlopen(/nix/store/43zml0mlr17r5jsagxr00xxx91hz9lky-openpam-20170430/lib/libpam.so, 6): image not found + lib.systems.inspect.patterns.isDarwin + ]; }; } From 6731f7007fc497722cac6ae101c709bdf6936a1f Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 28 Apr 2025 10:42:05 +0200 Subject: [PATCH 2/3] python312Packages.jupyterhub: 5.2.1 -> 5.3.0 Diff: https://github.com/jupyterhub/jupyterhub/compare/refs/tags/5.2.1...refs/tags/5.3.0 Changelog: https://github.com/jupyterhub/jupyterhub/blob/5.3.0/docs/source/reference/changelog.md --- pkgs/development/python-modules/jupyterhub/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/jupyterhub/default.nix b/pkgs/development/python-modules/jupyterhub/default.nix index 2556be5d4b0d..2b2e302ae490 100644 --- a/pkgs/development/python-modules/jupyterhub/default.nix +++ b/pkgs/development/python-modules/jupyterhub/default.nix @@ -51,19 +51,19 @@ buildPythonPackage rec { pname = "jupyterhub"; - version = "5.2.1"; + version = "5.3.0"; pyproject = true; src = fetchFromGitHub { owner = "jupyterhub"; repo = "jupyterhub"; rev = "refs/tags/${version}"; - hash = "sha256-zOWcXpByJRzI9sTjTl+w/vo99suKOEN0TvPn1ZWlNmc="; + hash = "sha256-FAVNS7GPvglFuSTDTAUtZ6ZzY4yH+eo34KhUQ4C3b4I="; }; npmDeps = fetchNpmDeps { inherit src; - hash = "sha256-My7WUAqIvOrbbVTxSnA6a5NviM6u95+iyykx1xbudpw="; + hash = "sha256-1ffF3i/IgE+J+0M+z6bzwZ9H8u0EYcYXTiBD9Jj7HdQ="; }; postPatch = '' From 5e483b267048dd1ccce657a9e457baa341a3b868 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 28 Apr 2025 10:36:28 +0200 Subject: [PATCH 3/3] python312Packages.batchspawner: fix --- .../python-modules/batchspawner/default.nix | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/batchspawner/default.nix b/pkgs/development/python-modules/batchspawner/default.nix index d53834e60b18..a4658f9b0694 100644 --- a/pkgs/development/python-modules/batchspawner/default.nix +++ b/pkgs/development/python-modules/batchspawner/default.nix @@ -2,11 +2,15 @@ lib, buildPythonPackage, fetchFromGitHub, + + # build-system setuptools, - wheel, + + # dependencies jinja2, jupyterhub, - pythonOlder, + + # tests pytest-asyncio, pytest-cov-stub, pytestCheckHook, @@ -17,8 +21,6 @@ buildPythonPackage rec { version = "1.3.0"; pyproject = true; - disabled = pythonOlder "3.6"; - src = fetchFromGitHub { owner = "jupyterhub"; repo = "batchspawner"; @@ -26,9 +28,17 @@ buildPythonPackage rec { hash = "sha256-Z7kB8b7s11wokTachLI/N+bdUV+FfCRTemL1KYQpzio="; }; + # When using pytest-asyncio>=0.24, jupyterhub no longer re-defines the event_loop function in its + # conftest.py, so it cannot be imported from there. + postPatch = '' + substituteInPlace batchspawner/tests/conftest.py \ + --replace-fail \ + "from jupyterhub.tests.conftest import db, event_loop # noqa" \ + "from jupyterhub.tests.conftest import db" + ''; + build-system = [ setuptools - wheel ]; dependencies = [ @@ -44,12 +54,12 @@ buildPythonPackage rec { pythonImportsCheck = [ "batchspawner" ]; - meta = with lib; { + meta = { description = "Spawner for Jupyterhub to spawn notebooks using batch resource managers"; mainProgram = "batchspawner-singleuser"; homepage = "https://github.com/jupyterhub/batchspawner"; changelog = "https://github.com/jupyterhub/batchspawner/blob/v${version}/CHANGELOG.md"; - license = licenses.bsd3; + license = lib.licenses.bsd3; maintainers = [ ]; }; }