1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 # build-system 7 hatchling, 8 9 # dependencies 10 ipykernel, 11 ipython, 12 jupyter-client, 13 jupyter-core, 14 prompt-toolkit, 15 pygments, 16 pyzmq, 17 traitlets, 18 19 # tests 20 flaky, 21 pexpect, 22 pytestCheckHook, 23}: 24 25buildPythonPackage rec { 26 pname = "jupyter-console"; 27 version = "6.6.3"; 28 pyproject = true; 29 30 src = fetchFromGitHub { 31 owner = "jupyter"; 32 repo = "jupyter_console"; 33 tag = "v${version}"; 34 hash = "sha256-jdSeZCspcjEQVBpJyxVnwJ5SAq+SS1bW9kqp/F/zwCQ="; 35 }; 36 37 postPatch = 38 # Use wrapped executable in tests 39 let 40 binPath = "${placeholder "out"}/bin/jupyter-console"; 41 in 42 '' 43 substituteInPlace jupyter_console/tests/test_console.py \ 44 --replace-fail "'-m', 'jupyter_console', " "" \ 45 --replace-fail "sys.executable" "'${binPath}'" 46 ''; 47 48 build-system = [ hatchling ]; 49 50 dependencies = [ 51 ipykernel 52 ipython 53 jupyter-client 54 jupyter-core 55 prompt-toolkit 56 pygments 57 pyzmq 58 traitlets 59 ]; 60 61 pythonImportsCheck = [ "jupyter_console" ]; 62 63 nativeCheckInputs = [ 64 flaky 65 pexpect 66 pytestCheckHook 67 ]; 68 69 preCheck = '' 70 export HOME=$TMPDIR 71 ''; 72 73 disabledTests = [ 74 # Flaky: pexpect.exceptions.TIMEOUT: Timeout exceeded 75 "test_console_starts" 76 "test_display_text" 77 ]; 78 79 __darwinAllowLocalNetworking = true; 80 81 meta = { 82 description = "Jupyter terminal console"; 83 mainProgram = "jupyter-console"; 84 homepage = "https://github.com/jupyter/jupyter_console"; 85 changelog = "https://github.com/jupyter/jupyter_console/releases/tag/v${version}"; 86 license = lib.licenses.bsd3; 87 teams = [ lib.teams.jupyter ]; 88 }; 89}