1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # nativeBuildInputs
8 nodejs,
9 yarn-berry_3,
10 distutils,
11
12 # build-system
13 hatch-jupyter-builder,
14 hatchling,
15 jupyterlab,
16
17 # dependencies
18 jupyter-server,
19 jupyterlab-server,
20 notebook-shim,
21 tornado,
22
23 # tests
24 pytest-jupyter,
25 pytestCheckHook,
26}:
27
28buildPythonPackage rec {
29 pname = "notebook";
30 version = "7.4.4";
31 pyproject = true;
32
33 src = fetchFromGitHub {
34 owner = "jupyter";
35 repo = "notebook";
36 tag = "v${version}";
37 hash = "sha256-bj4iQvm0TGBiCu9drJ8QFXsedzm/cEjevNQS6UsasNs=";
38 };
39
40 postPatch = ''
41 substituteInPlace pyproject.toml \
42 --replace-fail "timeout = 300" ""
43 '';
44
45 nativeBuildInputs = [
46 nodejs
47 yarn-berry_3.yarnBerryConfigHook
48 ]
49 ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
50 distutils
51 ];
52
53 missingHashes = ./missing-hashes.json;
54
55 offlineCache = yarn-berry_3.fetchYarnBerryDeps {
56 inherit src missingHashes;
57 hash = "sha256-nRaWzr5Q904KojfK0mPgLX9be82axb8Aab0SJULE7RU=";
58 };
59
60 build-system = [
61 hatch-jupyter-builder
62 hatchling
63 jupyterlab
64 ];
65
66 dependencies = [
67 jupyter-server
68 jupyterlab
69 jupyterlab-server
70 notebook-shim
71 tornado
72 ];
73
74 nativeCheckInputs = [
75 pytest-jupyter
76 pytestCheckHook
77 ];
78
79 pytestFlags = [
80 "-Wignore::DeprecationWarning"
81 ];
82
83 env = {
84 JUPYTER_PLATFORM_DIRS = 1;
85 };
86
87 # Some of the tests use localhost networking.
88 __darwinAllowLocalNetworking = true;
89
90 meta = {
91 changelog = "https://github.com/jupyter/notebook/blob/${src.tag}/CHANGELOG.md";
92 description = "Web-based notebook environment for interactive computing";
93 homepage = "https://github.com/jupyter/notebook";
94 license = lib.licenses.bsd3;
95 teams = [ lib.teams.jupyter ];
96 mainProgram = "jupyter-notebook";
97 };
98}