1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6
7 # build-system
8 hatch-jupyter-builder,
9 hatchling,
10 jupyterlab,
11
12 # dependencies
13 colorama,
14 gitpython,
15 jinja2,
16 jupyter-server,
17 jupyter-server-mathjax,
18 nbformat,
19 pygments,
20 requests,
21 tornado,
22
23 # tests
24 gitMinimal,
25 pytest-tornado,
26 pytestCheckHook,
27 writableTmpDirAsHomeHook,
28}:
29
30buildPythonPackage rec {
31 pname = "nbdime";
32 version = "4.0.2";
33 pyproject = true;
34
35 src = fetchPypi {
36 inherit pname version;
37 hash = "sha256-2Cefj0sjbAslOyDWDEgxu2eEPtjb1uCfI06wEdNvG/I=";
38 };
39
40 build-system = [
41 hatch-jupyter-builder
42 hatchling
43 jupyterlab
44 ];
45
46 dependencies = [
47 colorama
48 gitpython
49 jinja2
50 jupyter-server
51 jupyter-server-mathjax
52 nbformat
53 pygments
54 requests
55 tornado
56 ];
57
58 nativeCheckInputs = [
59 gitMinimal
60 pytest-tornado
61 pytestCheckHook
62 writableTmpDirAsHomeHook
63 ];
64
65 disabledTests = [
66 # subprocess.CalledProcessError: Command '['git', 'diff', 'base', 'diff.ipynb']' returned non-zero exit status 128.
67 # git-nbdiffdriver diff: line 1: git-nbdiffdriver: command not found
68 # fatal: external diff died, stopping at diff.ipynb
69 "test_git_diffdriver"
70
71 # subprocess.CalledProcessError: Command '['git', 'merge', 'remote-no-conflict']' returned non-zero exit status 1.
72 "test_git_mergedriver"
73
74 # Require network access
75 "test_git_difftool"
76 "test_git_mergetool"
77 ]
78 ++ lib.optionals stdenv.hostPlatform.isDarwin [
79 # OSError: Could not find system gitattributes location!
80 "test_locate_gitattributes_syste"
81 ];
82
83 preCheck = ''
84 git config --global user.email "janedoe@example.com"
85 git config --global user.name "Jane Doe"
86 '';
87
88 __darwinAllowLocalNetworking = true;
89
90 pythonImportsCheck = [ "nbdime" ];
91
92 meta = {
93 homepage = "https://github.com/jupyter/nbdime";
94 changelog = "https://github.com/jupyter/nbdime/blob/${version}/CHANGELOG.md";
95 description = "Tools for diffing and merging of Jupyter notebooks";
96 license = lib.licenses.bsd3;
97 maintainers = with lib.maintainers; [ tbenst ];
98 };
99}