1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 callPackage,
6 fetchPypi,
7 hatchling,
8 pythonOlder,
9 appnope,
10 comm,
11 debugpy,
12 ipython,
13 jupyter-client,
14 jupyter-core,
15 matplotlib-inline,
16 nest-asyncio,
17 packaging,
18 psutil,
19 pyzmq,
20 tornado,
21 traitlets,
22
23 # Reverse dependency
24 sage,
25}:
26
27buildPythonPackage rec {
28 pname = "ipykernel";
29 version = "6.29.5";
30 pyproject = true;
31
32 disabled = pythonOlder "3.8";
33
34 src = fetchPypi {
35 inherit pname version;
36 hash = "sha256-8JOiLEpA+IKPjjMKnCl8uT3KsTvZZ43tbejlz4HFYhU=";
37 };
38
39 # debugpy is optional, see https://github.com/ipython/ipykernel/pull/767
40 postPatch = ''
41 sed -i "/debugpy/d" pyproject.toml
42 '';
43
44 nativeBuildInputs = [ hatchling ];
45
46 propagatedBuildInputs = [
47 comm
48 debugpy
49 ipython
50 jupyter-client
51 jupyter-core
52 matplotlib-inline
53 nest-asyncio
54 packaging
55 psutil
56 pyzmq
57 tornado
58 traitlets
59 ] ++ lib.optionals stdenv.isDarwin [ appnope ];
60
61 # check in passthru.tests.pytest to escape infinite recursion with ipyparallel
62 doCheck = false;
63
64 passthru.tests = {
65 pytest = callPackage ./tests.nix { };
66 inherit sage;
67 };
68
69 meta = {
70 description = "IPython Kernel for Jupyter";
71 homepage = "https://ipython.org/";
72 changelog = "https://github.com/ipython/ipykernel/releases/tag/v${version}";
73 license = lib.licenses.bsd3;
74 maintainers = lib.teams.jupyter.members;
75 };
76}