1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 hatchling,
7 platformdirs,
8 traitlets,
9 pip,
10 pytestCheckHook,
11
12 # Reverse dependency
13 sage,
14}:
15
16buildPythonPackage rec {
17 pname = "jupyter-core";
18 version = "5.8.1";
19 disabled = pythonOlder "3.7";
20
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "jupyter";
25 repo = "jupyter_core";
26 tag = "v${version}";
27 hash = "sha256-opTFYVDqzkjeFC+9IZXPRCoV2QCTm1ze6ldrOZN0aUc=";
28 };
29
30 patches = [ ./tests_respect_pythonpath.patch ];
31
32 nativeBuildInputs = [ hatchling ];
33
34 propagatedBuildInputs = [
35 platformdirs
36 traitlets
37 ];
38
39 nativeCheckInputs = [
40 pip
41 pytestCheckHook
42 ];
43
44 preCheck = ''
45 export HOME=$TMPDIR
46 '';
47
48 pytestFlags = [
49 # suppress pytest.PytestUnraisableExceptionWarning: Exception ignored in: <socket.socket fd=-1, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
50 "-Wignore::pytest.PytestUnraisableExceptionWarning"
51 ];
52
53 disabledTests = [
54 # creates a temporary script, which isn't aware of PYTHONPATH
55 "test_argv0"
56 ];
57
58 postCheck = ''
59 $out/bin/jupyter --help > /dev/null
60 '';
61
62 pythonImportsCheck = [ "jupyter_core" ];
63
64 passthru.tests = {
65 inherit sage;
66 };
67
68 meta = with lib; {
69 description = "Base package on which Jupyter projects rely";
70 homepage = "https://jupyter.org/";
71 changelog = "https://github.com/jupyter/jupyter_core/blob/${src.rev}/CHANGELOG.md";
72 license = licenses.bsd3;
73 teams = [ teams.jupyter ];
74 };
75}