about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMario Rodas <marsam@users.noreply.github.com>2023-07-30 04:20:00 +0000
committerMario Rodas <marsam@users.noreply.github.com>2023-07-30 04:20:00 +0000
commitc63a98dd41bb7fd6e7e32db4eb88fc0e84a81236 (patch)
treeeae3d5948c667b1722507f5897f0712b3d601dbf
parent0ac9f471496d9244957cacd8bba74b1b3fa40538 (diff)
python310Packages.myst-nb: fix compatibility with myst-parser 1.0
-rw-r--r--pkgs/development/python-modules/myst-nb/default.nix27
1 files changed, 26 insertions, 1 deletions
diff --git a/pkgs/development/python-modules/myst-nb/default.nix b/pkgs/development/python-modules/myst-nb/default.nix
index a5694987abd5c..6ede481fba85b 100644
--- a/pkgs/development/python-modules/myst-nb/default.nix
+++ b/pkgs/development/python-modules/myst-nb/default.nix
@@ -2,6 +2,7 @@
 , buildPythonPackage
 , pythonOlder
 , fetchPypi
+, fetchpatch
 , flit-core
 , importlib-metadata
 , ipython
@@ -30,6 +31,27 @@ buildPythonPackage rec {
     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
@@ -53,7 +75,10 @@ buildPythonPackage rec {
     "myst-parser"
   ];
 
-  pythonImportsCheck = [ "myst_nb" ];
+  pythonImportsCheck = [
+    "myst_nb"
+    "myst_nb.sphinx_ext"
+  ];
 
   meta = with lib; {
     description = "A Jupyter Notebook Sphinx reader built on top of the MyST markdown parser";