nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 hatch-jupyter-builder,
7 hatchling,
8 pytestCheckHook,
9 pytest-console-scripts,
10 pytest-jupyter,
11 pytest-timeout,
12 argon2-cffi,
13 jinja2,
14 tornado,
15 pyzmq,
16 ipykernel,
17 traitlets,
18 jupyter-core,
19 jupyter-client,
20 jupyter-events,
21 jupyter-server-terminals,
22 nbformat,
23 nbconvert,
24 packaging,
25 send2trash,
26 terminado,
27 prometheus-client,
28 anyio,
29 websocket-client,
30 overrides,
31 requests,
32 flaky,
33}:
34
35buildPythonPackage rec {
36 pname = "jupyter-server";
37 version = "2.17.0";
38 pyproject = true;
39
40 src = fetchPypi {
41 pname = "jupyter_server";
42 inherit version;
43 hash = "sha256-w46omFZpZMiItHcq4e1Y7KhFkuiCUdLPxNFx+B9+mdU=";
44 };
45
46 build-system = [
47 hatch-jupyter-builder
48 hatchling
49 ];
50
51 dependencies = [
52 argon2-cffi
53 jinja2
54 tornado
55 pyzmq
56 traitlets
57 jupyter-core
58 jupyter-client
59 jupyter-events
60 jupyter-server-terminals
61 nbformat
62 nbconvert
63 packaging
64 send2trash
65 terminado
66 prometheus-client
67 anyio
68 websocket-client
69 overrides
70 ];
71
72 # https://github.com/NixOS/nixpkgs/issues/299427
73 stripExclude = lib.optionals stdenv.hostPlatform.isDarwin [ "favicon.ico" ];
74
75 pythonImportsCheck = [ "jupyter_server" ];
76
77 nativeCheckInputs = [
78 ipykernel
79 pytestCheckHook
80 pytest-console-scripts
81 pytest-jupyter
82 pytest-timeout
83 requests
84 flaky
85 ];
86
87 pytestFlags = [
88 "-Wignore::DeprecationWarning"
89 # 19 failures on python 3.13:
90 # ResourceWarning: unclosed database in <sqlite3.Connection object at 0x7ffff2a0cc70>
91 # TODO: Can probably be removed at the next update
92 "-Wignore::pytest.PytestUnraisableExceptionWarning"
93 ];
94
95 preCheck = ''
96 export HOME=$(mktemp -d)
97 export PATH=$out/bin:$PATH
98 '';
99
100 disabledTests = [
101 "test_cull_idle"
102 "test_server_extension_list"
103 "test_subscribe_websocket"
104 # test is presumable broken in sandbox
105 "test_authorized_requests"
106 ]
107 ++ lib.optionals stdenv.hostPlatform.isDarwin [
108 # attempts to use trashcan, build env doesn't allow this
109 "test_delete"
110 # Insufficient access privileges for operation
111 "test_regression_is_hidden"
112 # Fails under load (which causes failure on Hydra)
113 "test_execution_state"
114 ]
115 ++ lib.optionals stdenv.hostPlatform.isLinux [
116 # Failed: DID NOT RAISE <class 'tornado.web.HTTPError'>
117 "test_copy_big_dir"
118 ]
119 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
120 # TypeError: the JSON object must be str, bytes or bytearray, not NoneType
121 "test_terminal_create_with_cwd"
122 # Fails under load (which causes failure on Hydra)
123 "test_cull_connected"
124 ];
125
126 disabledTestPaths = [
127 "tests/services/kernels/test_api.py"
128 "tests/services/sessions/test_api.py"
129 # nbconvert failed: `relax_add_props` kwargs of validate has been
130 # deprecated for security reasons, and will be removed soon.
131 "tests/nbconvert/test_handlers.py"
132 ];
133
134 __darwinAllowLocalNetworking = true;
135
136 meta = {
137 changelog = "https://github.com/jupyter-server/jupyter_server/blob/v${version}/CHANGELOG.md";
138 description = "Backend—i.e. core services, APIs, and REST endpoints—to Jupyter web applications";
139 mainProgram = "jupyter-server";
140 homepage = "https://github.com/jupyter-server/jupyter_server";
141 license = lib.licenses.bsdOriginal;
142 teams = [ lib.teams.jupyter ];
143 };
144}