nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchNpmDeps,
6 configurable-http-proxy,
7
8 # nativeBuildInputs
9 nodejs,
10 npmHooks,
11
12 # build-system
13 setuptools,
14 setuptools-scm,
15
16 # dependencies
17 alembic,
18 certipy,
19 idna,
20 jinja2,
21 jupyter-events,
22 oauthlib,
23 packaging,
24 pamela,
25 prometheus-client,
26 pydantic,
27 python-dateutil,
28 requests,
29 sqlalchemy,
30 tornado,
31 traitlets,
32
33 # tests
34 addBinToPathHook,
35 beautifulsoup4,
36 cryptography,
37 jsonschema,
38 jupyterlab,
39 mock,
40 nbclassic,
41 playwright,
42 pytest-asyncio,
43 pytestCheckHook,
44 requests-mock,
45 versionCheckHook,
46 virtualenv,
47}:
48
49buildPythonPackage rec {
50 pname = "jupyterhub";
51 version = "5.4.3";
52 pyproject = true;
53
54 src = fetchFromGitHub {
55 owner = "jupyterhub";
56 repo = "jupyterhub";
57 tag = version;
58 hash = "sha256-2LxbLwkEXpMBE5Fy7+3vQGO+CEKM50Ou5vATT6JtA8s=";
59 };
60
61 npmDeps = fetchNpmDeps {
62 inherit src;
63 hash = "sha256-IlY0dRHXsrEWNfBqUSk7hwU+CmlUfGPtXTPNcOBT8Bw=";
64 };
65
66 postPatch = ''
67 substituteInPlace jupyterhub/proxy.py \
68 --replace-fail \
69 "'configurable-http-proxy'" \
70 "'${lib.getExe configurable-http-proxy}'"
71
72 substituteInPlace jupyterhub/tests/test_proxy.py \
73 --replace-fail \
74 "'configurable-http-proxy'" \
75 "'${lib.getExe configurable-http-proxy}'"
76 '';
77
78 nativeBuildInputs = [
79 nodejs
80 npmHooks.npmConfigHook
81 ];
82
83 build-system = [
84 setuptools
85 setuptools-scm
86 ];
87
88 dependencies = [
89 alembic
90 certipy
91 idna
92 jinja2
93 jupyter-events
94 oauthlib
95 packaging
96 pamela
97 prometheus-client
98 pydantic
99 python-dateutil
100 requests
101 sqlalchemy
102 tornado
103 traitlets
104 ];
105
106 pythonImportsCheck = [ "jupyterhub" ];
107
108 nativeCheckInputs = [
109 addBinToPathHook
110 beautifulsoup4
111 cryptography
112 jsonschema
113 jupyterlab
114 mock
115 nbclassic
116 playwright
117 # require pytest-asyncio<0.23
118 # https://github.com/jupyterhub/jupyterhub/pull/4663
119 (pytest-asyncio.overrideAttrs (
120 final: prev: {
121 version = "0.21.2";
122 src = fetchFromGitHub {
123 inherit (prev.src) owner repo;
124 tag = "v${final.version}";
125 hash = "sha256-AVVvdo/CDF9IU6l779sLc7wKz5h3kzMttdDNTPLYxtQ=";
126 };
127 }
128 ))
129 pytestCheckHook
130 requests-mock
131 versionCheckHook
132 virtualenv
133 ];
134
135 disabledTests = [
136 # Tries to install older versions through pip
137 "test_upgrade"
138 # Testcase fails to find requests import
139 "test_external_service"
140 # Attempts to do TLS connection
141 "test_connection_notebook_wrong_certs"
142 # AttributeError: 'coroutine' object...
143 "test_valid_events"
144 "test_invalid_events"
145 "test_user_group_roles"
146 ];
147
148 disabledTestPaths = [
149 # Not testing with a running instance
150 # AttributeError: 'coroutine' object has no attribute 'db'
151 "docs/test_docs.py"
152 "jupyterhub/tests/browser/test_browser.py"
153 "jupyterhub/tests/test_api.py"
154 "jupyterhub/tests/test_auth_expiry.py"
155 "jupyterhub/tests/test_auth.py"
156 "jupyterhub/tests/test_metrics.py"
157 "jupyterhub/tests/test_named_servers.py"
158 "jupyterhub/tests/test_orm.py"
159 "jupyterhub/tests/test_pages.py"
160 "jupyterhub/tests/test_proxy.py"
161 "jupyterhub/tests/test_scopes.py"
162 "jupyterhub/tests/test_services_auth.py"
163 "jupyterhub/tests/test_singleuser.py"
164 "jupyterhub/tests/test_spawner.py"
165 "jupyterhub/tests/test_user.py"
166 ];
167
168 meta = {
169 description = "Serves multiple Jupyter notebook instances";
170 homepage = "https://github.com/jupyterhub/jupyterhub";
171 changelog = "https://github.com/jupyterhub/jupyterhub/blob/${version}/docs/source/reference/changelog.md";
172 license = lib.licenses.bsd3;
173 teams = [ lib.teams.jupyter ];
174 badPlatforms = [
175 # E OSError: dlopen(/nix/store/43zml0mlr17r5jsagxr00xxx91hz9lky-openpam-20170430/lib/libpam.so, 6): image not found
176 lib.systems.inspect.patterns.isDarwin
177 ];
178 };
179}