1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 pythonOlder,
7
8 # Build dependencies
9 setuptools,
10
11 # Runtime dependencies
12 decorator,
13 exceptiongroup,
14 jedi,
15 matplotlib-inline,
16 pexpect,
17 prompt-toolkit,
18 pygments,
19 stack-data,
20 traitlets,
21 typing-extensions,
22
23 # Optional dependencies
24 ipykernel,
25 ipyparallel,
26 ipywidgets,
27 matplotlib,
28 nbconvert,
29 nbformat,
30 notebook,
31 qtconsole,
32
33 # Reverse dependency
34 sage,
35
36 # Test dependencies
37 pickleshare,
38 pytest-asyncio,
39 pytest7CheckHook,
40 testpath,
41}:
42
43buildPythonPackage rec {
44 pname = "ipython";
45 version = "8.24.0";
46 pyproject = true;
47 disabled = pythonOlder "3.10";
48
49 src = fetchPypi {
50 inherit pname version;
51 hash = "sha256-AQ2z+KcopXi7ZB/dBsBjufuOlqlGTGOuxjEPvLXoBQE=";
52 };
53
54 build-system = [ setuptools ];
55
56 dependencies =
57 [
58 decorator
59 jedi
60 matplotlib-inline
61 pexpect
62 prompt-toolkit
63 pygments
64 stack-data
65 traitlets
66 ]
67 ++ lib.optionals (pythonOlder "3.11") [ exceptiongroup ]
68 ++ lib.optionals (pythonOlder "3.12") [ typing-extensions ];
69
70 optional-dependencies = {
71 kernel = [ ipykernel ];
72 nbconvert = [ nbconvert ];
73 nbformat = [ nbformat ];
74 notebook = [
75 ipywidgets
76 notebook
77 ];
78 parallel = [ ipyparallel ];
79 qtconsole = [ qtconsole ];
80 matplotlib = [ matplotlib ];
81 };
82
83 pythonImportsCheck = [ "IPython" ];
84
85 preCheck = ''
86 export HOME=$TMPDIR
87
88 # doctests try to fetch an image from the internet
89 substituteInPlace pyproject.toml \
90 --replace '"--ipdoctest-modules",' '"--ipdoctest-modules", "--ignore=IPython/core/display.py",'
91 '';
92
93 nativeCheckInputs = [
94 pickleshare
95 pytest-asyncio
96 pytest7CheckHook
97 testpath
98 ];
99
100 disabledTests =
101 [
102 # UnboundLocalError: local variable 'child' referenced before assignment
103 "test_system_interrupt"
104 ]
105 ++ lib.optionals (stdenv.isDarwin) [
106 # FileNotFoundError: [Errno 2] No such file or directory: 'pbpaste'
107 "test_clipboard_get"
108 ];
109
110 passthru.tests = {
111 inherit sage;
112 };
113
114 meta = with lib; {
115 description = "IPython: Productive Interactive Computing";
116 downloadPage = "https://github.com/ipython/ipython/";
117 homepage = "https://ipython.org/";
118 changelog = "https://github.com/ipython/ipython/blob/${version}/docs/source/whatsnew/version${lib.versions.major version}.rst";
119 license = licenses.bsd3;
120 maintainers = with maintainers; [ bjornfor ];
121 };
122}