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 = [ ]; }; } diff --git a/pkgs/development/python-modules/jupyterhub/default.nix b/pkgs/development/python-modules/jupyterhub/default.nix index 0e1fa2f5bc22..2b2e302ae490 100644 --- a/pkgs/development/python-modules/jupyterhub/default.nix +++ b/pkgs/development/python-modules/jupyterhub/default.nix @@ -1,72 +1,81 @@ { 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, }: buildPythonPackage rec { pname = "jupyterhub"; - version = "5.2.1"; + version = "5.3.0"; pyproject = true; - disabled = pythonOlder "3.8"; - 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 = '' - 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 + ]; }; }