summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/nbmake/default.nix
blob: f6780ba38981f2724d11c41465a5c131b5c653c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  hatchling,

  # dependencies
  ipykernel,
  nbclient,
  nbformat,
  pygments,

  # tests
  pytestCheckHook,
  typing-extensions,
}:

buildPythonPackage rec {
  pname = "nbmake";
  version = "1.5.5";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "treebeardtech";
    repo = "nbmake";
    tag = "v${version}";
    hash = "sha256-Du2sxSl1a5ZVl7ueHWnkTTPtuMUlmALuOuSkoEFIQcE=";
  };

  build-system = [
    hatchling
  ];

  dependencies = [
    ipykernel
    nbclient
    nbformat
    pygments
  ];

  pythonRelaxDeps = [ "nbclient" ];

  pythonImportsCheck = [ "nbmake" ];

  nativeCheckInputs = [
    pytestCheckHook
    typing-extensions
  ];

  preCheck = ''
    export HOME=$(mktemp -d)
  '';

  disabledTests = [
    # depends on pytest-xdist that is not added, as
    # tests are prone to race conditions under parallelism, they sometimes hang indefinitely
    # https://github.com/treebeardtech/nbmake/issues/129
    "test_when_parallel_passing_nbs_then_ok"
  ];

  __darwinAllowLocalNetworking = true;

  meta = {
    description = "Pytest plugin for testing notebooks";
    homepage = "https://github.com/treebeardtech/nbmake";
    changelog = "https://github.com/treebeardtech/nbmake/releases/tag/${src.tag}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ GaetanLepage ];
  };
}