1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, fetchpatch
6, flaky
7, ipython
8, jupyter_client
9, traitlets
10, tornado
11, pythonOlder
12, pytestCheckHook
13, nose
14}:
15
16buildPythonPackage rec {
17 pname = "ipykernel";
18 version = "5.2.1";
19
20 src = fetchPypi {
21 inherit pname version;
22 sha256 = "1a3hr7wx3ywwskr99hgp120dw9ab1vmcaxdixlsbd9bg6ly3fdr9";
23 };
24
25 propagatedBuildInputs = [ ipython jupyter_client traitlets tornado ];
26
27 # https://github.com/ipython/ipykernel/pull/377
28 patches = [
29 (fetchpatch {
30 url = "https://github.com/ipython/ipykernel/commit/a3bf849dbd368a1826deb9dfc94c2bd3e5ed04fe.patch";
31 sha256 = "1yhpwqixlf98a3n620z92mfips3riw6psijqnc5jgs2p58fgs2yc";
32 })
33 ];
34
35 checkInputs = [ pytestCheckHook nose flaky ];
36 dontUseSetuptoolsCheck = true;
37 preCheck = ''
38 export HOME=$(mktemp -d)
39 '';
40 disabledTests = lib.optionals stdenv.isDarwin ([
41 # see https://github.com/NixOS/nixpkgs/issues/76197
42 "test_subprocess_print"
43 "test_subprocess_error"
44 "test_ipython_start_kernel_no_userns"
45
46 # https://github.com/ipython/ipykernel/issues/506
47 "test_unc_paths"
48 ] ++ lib.optionals (pythonOlder "3.8") [
49 # flaky test https://github.com/ipython/ipykernel/issues/485
50 "test_shutdown"
51
52 # test regression https://github.com/ipython/ipykernel/issues/486
53 "test_sys_path_profile_dir"
54 "test_save_history"
55 "test_help_output"
56 "test_write_kernel_spec"
57 "test_ipython_start_kernel_userns"
58 "ZMQDisplayPublisherTests"
59 ]);
60
61 # Some of the tests use localhost networking.
62 __darwinAllowLocalNetworking = true;
63
64 meta = {
65 description = "IPython Kernel for Jupyter";
66 homepage = "http://ipython.org/";
67 license = lib.licenses.bsd3;
68 maintainers = with lib.maintainers; [ fridh ];
69 };
70}