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