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 rev = "refs/tags/v${version}";
34 hash = "sha256-RTpXBbVCRj0oyZ1TXXDv3M7sAI4kA6f3ouzTr0rXjwY=";
35 };
36
37 nativeBuildInputs = [ hatchling ];
38
39 buildInputs = [ pytest ];
40
41 propagatedBuildInputs = [ jupyter-core ];
42
43 passthru.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 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
63
64 passthru.tests = {
65 check = self.overridePythonAttrs (_: {
66 doCheck = false;
67 });
68 };
69
70 meta = with lib; {
71 changelog = "https://github.com/jupyter-server/pytest-jupyter/releases/tag/v${version}";
72 description = "pytest plugin for testing Jupyter core libraries and extensions";
73 homepage = "https://github.com/jupyter-server/pytest-jupyter";
74 license = licenses.bsd3;
75 maintainers = [ ];
76 };
77 };
78in
79self