1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 pythonOlder,
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.14.0";
39 pyproject = true;
40 disabled = pythonOlder "3.8";
41
42 src = fetchPypi {
43 pname = "jupyter_server";
44 inherit version;
45 hash = "sha256-ZZFUzqUSCDQ0/XyTt/4Il696L9C53UdJKCtC6qxK5nc=";
46 };
47
48 nativeBuildInputs = [
49 hatch-jupyter-builder
50 hatchling
51 ];
52
53 propagatedBuildInputs = [
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.isDarwin [ "favicon.ico" ];
76
77 nativeCheckInputs = [
78 ipykernel
79 pytestCheckHook
80 pytest-console-scripts
81 pytest-jupyter
82 pytest-timeout
83 requests
84 flaky
85 ];
86
87 pytestFlagsArray = [
88 "-W"
89 "ignore::DeprecationWarning"
90 ];
91
92 preCheck = ''
93 export HOME=$(mktemp -d)
94 export PATH=$out/bin:$PATH
95 '';
96
97 disabledTests =
98 [
99 "test_cull_idle"
100 "test_server_extension_list"
101 "test_subscribe_websocket"
102 # test is presumable broken in sandbox
103 "test_authorized_requests"
104 ]
105 ++ lib.optionals stdenv.isDarwin [
106 # attempts to use trashcan, build env doesn't allow this
107 "test_delete"
108 # Insufficient access privileges for operation
109 "test_regression_is_hidden"
110 ]
111 ++ lib.optionals stdenv.isLinux [
112 # Failed: DID NOT RAISE <class 'tornado.web.HTTPError'>
113 "test_copy_big_dir"
114 ];
115
116 disabledTestPaths = [
117 "tests/services/kernels/test_api.py"
118 "tests/services/sessions/test_api.py"
119 # nbconvert failed: `relax_add_props` kwargs of validate has been
120 # deprecated for security reasons, and will be removed soon.
121 "tests/nbconvert/test_handlers.py"
122 ];
123
124 __darwinAllowLocalNetworking = true;
125
126 meta = with lib; {
127 changelog = "https://github.com/jupyter-server/jupyter_server/blob/v${version}/CHANGELOG.md";
128 description = "The backend—i.e. core services, APIs, and REST endpoints—to Jupyter web applications";
129 mainProgram = "jupyter-server";
130 homepage = "https://github.com/jupyter-server/jupyter_server";
131 license = licenses.bsdOriginal;
132 maintainers = lib.teams.jupyter.members;
133 };
134}