1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build
7 hatchling,
8 pytest,
9
10 # runtime
11 jupyter-core,
12
13 # optionals
14 jupyter-client,
15 ipykernel,
16 jupyter-server,
17 nbformat,
18
19 # tests
20 pytest-timeout,
21 pytestCheckHook,
22}:
23
24let
25 self = buildPythonPackage rec {
26 pname = "pytest-jupyter";
27 version = "0.10.1";
28 pyproject = true;
29
30 src = fetchFromGitHub {
31 owner = "jupyter-server";
32 repo = "pytest-jupyter";
33 tag = "v${version}";
34 hash = "sha256-RTpXBbVCRj0oyZ1TXXDv3M7sAI4kA6f3ouzTr0rXjwY=";
35 };
36
37 nativeBuildInputs = [ hatchling ];
38
39 buildInputs = [ pytest ];
40
41 propagatedBuildInputs = [ jupyter-core ];
42
43 optional-dependencies = {
44 client = [
45 jupyter-client
46 nbformat
47 ipykernel
48 ];
49 server = [
50 jupyter-server
51 jupyter-client
52 nbformat
53 ipykernel
54 ];
55 };
56
57 doCheck = false; # infinite recursion with jupyter-server
58
59 nativeCheckInputs = [
60 pytest-timeout
61 pytestCheckHook
62 ]
63 ++ lib.flatten (builtins.attrValues optional-dependencies);
64
65 passthru.tests = {
66 check = self.overridePythonAttrs (_: {
67 doCheck = false;
68 });
69 };
70
71 meta = with lib; {
72 changelog = "https://github.com/jupyter-server/pytest-jupyter/releases/tag/v${version}";
73 description = "Pytest plugin for testing Jupyter core libraries and extensions";
74 homepage = "https://github.com/jupyter-server/pytest-jupyter";
75 license = licenses.bsd3;
76 maintainers = [ ];
77 };
78 };
79in
80self