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 [
67 # subprocess.CalledProcessError: Command '['git', 'diff', 'base', 'diff.ipynb']' returned non-zero exit status 128.
68 # git-nbdiffdriver diff: line 1: git-nbdiffdriver: command not found
69 # fatal: external diff died, stopping at diff.ipynb
70 "test_git_diffdriver"
71
72 # subprocess.CalledProcessError: Command '['git', 'merge', 'remote-no-conflict']' returned non-zero exit status 1.
73 "test_git_mergedriver"
74
75 # Require network access
76 "test_git_difftool"
77 "test_git_mergetool"
78 ]
79 ++ lib.optionals stdenv.hostPlatform.isDarwin [
80 # OSError: Could not find system gitattributes location!
81 "test_locate_gitattributes_syste"
82 ];
83
84 preCheck = ''
85 git config --global user.email "janedoe@example.com"
86 git config --global user.name "Jane Doe"
87 '';
88
89 __darwinAllowLocalNetworking = true;
90
91 pythonImportsCheck = [ "nbdime" ];
92
93 meta = {
94 homepage = "https://github.com/jupyter/nbdime";
95 changelog = "https://github.com/jupyter/nbdime/blob/${version}/CHANGELOG.md";
96 description = "Tools for diffing and merging of Jupyter notebooks";
97 license = lib.licenses.bsd3;
98 maintainers = with lib.maintainers; [ tbenst ];
99 };
100}