0

I'm looking for a library/tool that can generate a .py file from a notebook, with the added feature that I want to control which cells (both code and markdown cells) get exported and/or excluded from the .py file. For example adding to cells something like %exclude or %include and have control at export time how to work with these tags. I found jupytext that may do this, but got me confused with the version control part / link of .ipynb/.md.

ELECE
  • 41
  • 5
  • You could super fine-tune this however you wish using nbformat upstream of jupytext. Use nbformat to take the original notebook and filter based on metadata tags or special signals you add in the content to make a new notebook. Then the new notebook you pass to Jupytext to make a script out of it. See some tips about getting started with nbformat [here](https://stackoverflow.com/a/74379308/8508004), where I also link to a lot of examples with code. – Wayne Nov 12 '22 at 23:12

0 Answers0