mwouts / jupytext

Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts
https://jupytext.readthedocs.io
MIT License
6.65k stars 386 forks source link

substitutions don't round-trip #994

Closed MarcoGorelli closed 2 years ago

MarcoGorelli commented 2 years ago

Example:

$ cat t.md 
---
jupytext:
  text_representation:
    extension: .md
    format_name: myst
    format_version: 0.13
    jupytext_version: 1.14.1
kernelspec:
  display_name: Python 3
  language: python
  name: python3
substitutions:
  extra_dependencies: bokeh
---
$ git add t.md 
$ jupytext t.md --to myst
[jupytext] Reading t.md in format md
[jupytext] Writing t.md in format md:myst (destination file replaced)
$ git diff -- t.md
diff --git a/t.md b/t.md
index 267e81b..98e41c3 100644
--- a/t.md
+++ b/t.md
@@ -9,6 +9,4 @@ kernelspec:
   display_name: Python 3
   language: python
   name: python3
-substitutions:
-  extra_dependencies: bokeh
 ---

A workaround I've found is to add

notebook_metadata_filter: substitutions
MarcoGorelli commented 2 years ago

A workaround I've found is to add

notebook_metadata_filter: substitutions

apologies, looks like this is explicitly documented: https://jupytext.readthedocs.io/en/latest/config.html#metadata-filtering

so, this is probably fine? closing then