1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonOlder
5, hatchling
6, ipykernel
7, exceptiongroup
8, ipython
9, jupyter-client
10, jupyter-core
11, prompt-toolkit
12, pygments
13, pyzmq
14, traitlets
15, flaky
16, pexpect
17, pytestCheckHook
18}:
19
20buildPythonPackage rec {
21 pname = "jupyter-console";
22 version = "6.6.3";
23 format = "pyproject";
24
25 disabled = pythonOlder "3.7";
26
27 src = fetchPypi {
28 pname = "jupyter_console";
29 inherit version;
30 hash = "sha256-VmpL8xyHrb+t8izfhG4wabWace1dpx1rpNiqrRSlNTk=";
31 };
32
33 nativeBuildInputs = [
34 hatchling
35 ];
36
37 postPatch = ''
38 # use wrapped executable in tests
39 substituteInPlace jupyter_console/tests/test_console.py \
40 --replace "args = ['-m', 'jupyter_console', '--colors=NoColor']" "args = ['--colors=NoColor']" \
41 --replace "cmd = sys.executable" "cmd = '${placeholder "out"}/bin/jupyter-console'" \
42 --replace "check_output([sys.executable, '-m', 'jupyter_console'," "check_output(['${placeholder "out"}/bin/jupyter-console',"
43 '';
44
45 propagatedBuildInputs = [
46 ipykernel
47 ipython
48 jupyter-client
49 jupyter-core
50 prompt-toolkit
51 pygments
52 pyzmq
53 traitlets
54 ] ++ lib.optionals (pythonOlder "3.11") [
55 exceptiongroup
56 ];
57
58 pythonImportsCheck = [
59 "jupyter_console"
60 ];
61
62 nativeCheckInputs = [
63 flaky
64 pexpect
65 pytestCheckHook
66 ];
67
68 preCheck = ''
69 export HOME=$TMPDIR
70 '';
71
72 meta = {
73 description = "Jupyter terminal console";
74 homepage = "https://github.com/jupyter/jupyter_console";
75 changelog = "https://github.com/jupyter/jupyter_console/releases/tag/v${version}";
76 license = lib.licenses.bsd3;
77 maintainers = lib.teams.jupyter.members;
78 };
79}