summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/nbdime/default.nix
blob: c43652d4d1fa692cce632585748af13c1571e5e5 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchPypi,

  # build-system
  hatch-jupyter-builder,
  hatchling,
  jupyterlab,

  # dependencies
  colorama,
  gitpython,
  jinja2,
  jupyter-server,
  jupyter-server-mathjax,
  nbformat,
  pygments,
  requests,
  tornado,

  # tests
  gitMinimal,
  pytest-tornado,
  pytestCheckHook,
  writableTmpDirAsHomeHook,
}:

buildPythonPackage rec {
  pname = "nbdime";
  version = "4.0.3";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-YqtQp1goJSPEUBFEufMUIh27rtBAPBL9cPak/MUy7CQ=";
  };

  build-system = [
    hatch-jupyter-builder
    hatchling
    jupyterlab
  ];

  dependencies = [
    colorama
    gitpython
    jinja2
    jupyter-server
    jupyter-server-mathjax
    nbformat
    pygments
    requests
    tornado
  ];

  nativeCheckInputs = [
    gitMinimal
    pytest-tornado
    pytestCheckHook
    writableTmpDirAsHomeHook
  ];

  disabledTests = [
    # subprocess.CalledProcessError: Command '['git', 'diff', 'base', 'diff.ipynb']' returned non-zero exit status 128.
    # git-nbdiffdriver diff: line 1: git-nbdiffdriver: command not found
    # fatal: external diff died, stopping at diff.ipynb
    "test_git_diffdriver"

    # subprocess.CalledProcessError: Command '['git', 'merge', 'remote-no-conflict']' returned non-zero exit status 1.
    "test_git_mergedriver"

    # Require network access
    "test_git_difftool"
    "test_git_mergetool"
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    # OSError: Could not find system gitattributes location!
    "test_locate_gitattributes_syste"
  ];

  preCheck = ''
    git config --global user.email "janedoe@example.com"
    git config --global user.name "Jane Doe"
  '';

  __darwinAllowLocalNetworking = true;

  pythonImportsCheck = [ "nbdime" ];

  meta = {
    homepage = "https://github.com/jupyter/nbdime";
    changelog = "https://github.com/jupyter/nbdime/blob/${version}/CHANGELOG.md";
    description = "Tools for diffing and merging of Jupyter notebooks";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ tbenst ];
  };
}