1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonOlder
5, substituteAll
6, hatchling
7, ipykernel
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.1";
23 format = "pyproject";
24
25 disabled = pythonOlder "3.7";
26
27 src = fetchPypi {
28 inherit pname version;
29 hash = "sha256-WTEhLVy8H5Vvb9YVdVteFfOJqOqmlyiNu+Q3cBdhXsw=";
30 };
31
32 nativeBuildInputs = [
33 hatchling
34 ];
35
36 postPatch = ''
37 # use wrapped executable in tests
38 substituteInPlace jupyter_console/tests/test_console.py \
39 --replace "args = ['-m', 'jupyter_console', '--colors=NoColor']" "args = ['--colors=NoColor']" \
40 --replace "cmd = sys.executable" "cmd = '${placeholder "out"}/bin/jupyter-console'" \
41 --replace "check_output([sys.executable, '-m', 'jupyter_console'," "check_output(['${placeholder "out"}/bin/jupyter-console',"
42 '';
43
44 propagatedBuildInputs = [
45 ipykernel
46 ipython
47 jupyter-client
48 jupyter-core
49 prompt-toolkit
50 pygments
51 pyzmq
52 traitlets
53 ];
54
55 pythonImportsCheck = [
56 "jupyter_console"
57 ];
58
59 nativeCheckInputs = [
60 flaky
61 pexpect
62 pytestCheckHook
63 ];
64
65 preCheck = ''
66 export HOME=$TMPDIR
67 '';
68
69 meta = {
70 description = "Jupyter terminal console";
71 homepage = "https://github.com/jupyter/jupyter_console";
72 changelog = "https://github.com/jupyter/jupyter_console/releases/tag/v${version}";
73 license = lib.licenses.bsd3;
74 };
75}