1{ 2 lib, 3 buildPythonPackage, 4 fetchPypi, 5 pythonOlder, 6 hatchling, 7 ipykernel, 8 exceptiongroup, 9 ipython, 10 jupyter-client, 11 jupyter-core, 12 prompt-toolkit, 13 pygments, 14 pyzmq, 15 traitlets, 16 flaky, 17 pexpect, 18 pytestCheckHook, 19}: 20 21buildPythonPackage rec { 22 pname = "jupyter-console"; 23 version = "6.6.3"; 24 format = "pyproject"; 25 26 disabled = pythonOlder "3.7"; 27 28 src = fetchPypi { 29 pname = "jupyter_console"; 30 inherit version; 31 hash = "sha256-VmpL8xyHrb+t8izfhG4wabWace1dpx1rpNiqrRSlNTk="; 32 }; 33 34 nativeBuildInputs = [ hatchling ]; 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 ] ++ lib.optionals (pythonOlder "3.11") [ exceptiongroup ]; 54 55 pythonImportsCheck = [ "jupyter_console" ]; 56 57 nativeCheckInputs = [ 58 flaky 59 pexpect 60 pytestCheckHook 61 ]; 62 63 preCheck = '' 64 export HOME=$TMPDIR 65 ''; 66 67 meta = { 68 description = "Jupyter terminal console"; 69 mainProgram = "jupyter-console"; 70 homepage = "https://github.com/jupyter/jupyter_console"; 71 changelog = "https://github.com/jupyter/jupyter_console/releases/tag/v${version}"; 72 license = lib.licenses.bsd3; 73 maintainers = lib.teams.jupyter.members; 74 }; 75}