summary refs log tree commit diff
path: root/pkgs/development/python-modules/myst-nb/default.nix
blob: 6ede481fba85b74177075dec4a84711f8e6e8821 (plain) (blame)
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
{ lib
, buildPythonPackage
, pythonOlder
, fetchPypi
, fetchpatch
, flit-core
, importlib-metadata
, ipython
, jupyter-cache
, nbclient
, myst-parser
, nbformat
, pyyaml
, sphinx
, sphinx-togglebutton
, typing-extensions
, ipykernel
, pythonRelaxDepsHook
}:

buildPythonPackage rec {
  pname = "myst-nb";
  version = "0.17.2";

  format = "flit";

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-D2E4ZRX6sHxzZGrcqX//L2n0HpDTE6JgIXxbvkGdhYs=";
  };

  patches = [
    # Fix compatiblity with myst-parser 1.0. Remove with the next release.
    (fetchpatch {
      url = "https://github.com/executablebooks/MyST-NB/commit/48c45c6a8c4501005766c2d821b5e9ddfbedd5fa.patch";
      hash = "sha256-jGL2MjZArvPtbiaR/rRGCIi0QwYO0iTIK26GLuTrBM8=";
      excludes = [
        "myst_nb/__init__.py"
        "docs/authoring/custom-formats.Rmd"
        "docs/authoring/jupyter-notebooks.md"
        "docs/index.md"
        "pyproject.toml"
        "tests/nb_fixtures/reporter_warnings.txt"
      ];
    })
  ];

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace "myst-parser~=0.18.0" "myst-parser"
  '';

  nativeBuildInputs = [
    flit-core
    pythonRelaxDepsHook
  ];

  propagatedBuildInputs = [
    importlib-metadata
    ipython
    jupyter-cache
    nbclient
    myst-parser
    nbformat
    pyyaml
    sphinx
    sphinx-togglebutton
    typing-extensions
    ipykernel
  ];

  pythonRelaxDeps = [
    "myst-parser"
  ];

  pythonImportsCheck = [
    "myst_nb"
    "myst_nb.sphinx_ext"
  ];

  meta = with lib; {
    description = "A Jupyter Notebook Sphinx reader built on top of the MyST markdown parser";
    homepage = "https://github.com/executablebooks/MyST-NB";
    changelog = "https://github.com/executablebooks/MyST-NB/raw/v${version}/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [ marsam ];
  };
}