nbdev icon indicating copy to clipboard operation
nbdev copied to clipboard

Feature: add support for .py files in plaintext formats

Open lukastk opened this issue 9 months ago • 2 comments

Add support for exporting the following plaintext formats as if they were regular .ipynb files:

  • percent
  • light
  • sphinx
  • myst
  • pandoc

See this for details on the above plain-text notebook formats. This feature is inspired by this article, where the author also requested it.

(Note: This is a reissue of a previous poorly attempted pull request)

lukastk avatar Feb 22 '25 21:02 lukastk

Thanks for sharing the blog post with the section on proposals for nbdev. I enjoyed reading that. However saving outputs is important for rendering docs, so I don't think saving to plain text would work? Please let me know if I'm wrong

Also this increases the surface area of maintenance which I am not sure we want to do.

cc: @jph00

hamelsmu avatar Feb 27 '25 06:02 hamelsmu

In the jupytext approach, the notebooks are run (and their output stored) when generating the documentation, but there is no need to keep the notebook output under version control. The one thing one loses is the diffs in PRs that would show if an output where to change. The way around that is to have the documentation folder itself under source control.

My personal opinion is that keeping the myst-nb files (or any other plain text instead of notebooks) as source of truth makes code reviews much easier. If you don't want to carry the extra dependencies with jupytext and myst-markdown, perhaps this could be an optional feature? eg something one would install with pip install nbdev[md] or similar.

jlopezpena avatar Mar 07 '25 16:03 jlopezpena