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