1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 hatchling,
8
9 # dependencies
10 ipykernel,
11 nbclient,
12 nbformat,
13 pygments,
14
15 # tests
16 pytestCheckHook,
17 typing-extensions,
18}:
19
20buildPythonPackage rec {
21 pname = "nbmake";
22 version = "1.5.5";
23 pyproject = true;
24
25 src = fetchFromGitHub {
26 owner = "treebeardtech";
27 repo = "nbmake";
28 tag = "v${version}";
29 hash = "sha256-Du2sxSl1a5ZVl7ueHWnkTTPtuMUlmALuOuSkoEFIQcE=";
30 };
31
32 build-system = [
33 hatchling
34 ];
35
36 dependencies = [
37 ipykernel
38 nbclient
39 nbformat
40 pygments
41 ];
42
43 pythonRelaxDeps = [ "nbclient" ];
44
45 pythonImportsCheck = [ "nbmake" ];
46
47 nativeCheckInputs = [
48 pytestCheckHook
49 typing-extensions
50 ];
51
52 preCheck = ''
53 export HOME=$(mktemp -d)
54 '';
55
56 disabledTests = [
57 # depends on pytest-xdist that is not added, as
58 # tests are prone to race conditions under parallelism, they sometimes hang indefinitely
59 # https://github.com/treebeardtech/nbmake/issues/129
60 "test_when_parallel_passing_nbs_then_ok"
61 ];
62
63 __darwinAllowLocalNetworking = true;
64
65 meta = {
66 description = "Pytest plugin for testing notebooks";
67 homepage = "https://github.com/treebeardtech/nbmake";
68 changelog = "https://github.com/treebeardtech/nbmake/releases/tag/${src.tag}";
69 license = lib.licenses.asl20;
70 maintainers = with lib.maintainers; [ GaetanLepage ];
71 };
72}