-
Notifications
You must be signed in to change notification settings - Fork 512
Allow plain text .qmd
files as source notebooks
#1521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…not key: vals from lists
- Adopt Quarto for documentation and notebooks making use of [this nbdev PR](AnswerDotAI/nbdev#1521) that allows full `.qmd` driven packages - Convert all `ipynb` files to `.qmd` format - Use nbdev_docs to generate the documentation website - Adopt logger that solves #3 (#3)
What are the next steps here? |
I may be having challenges with this, but just wanted to check to see if you've seen this before or if it's something external to your fork: nbdev_proc_nbs:
Any thoughts? What else would you like to see to help debug? |
I got this PR to work for my personal use cases and didn't see much initial interest on this PR to bring it into the main branch. Seems like there's gotten to be a bit more traction since I first made the PR, and I'm happy to push this forward.
From my side, it has been awhile since I've rebased with the main. I will do that and see what bugs/clashes have come up since then and try to resolve those. Beyond that it's up to the maintainers to see if this is worth incorporating into the main branch (I think it definitely is, but I am biased. The @TinasheMTapera I am not positive, but this bug looks a lot like the weird edge cases I encountered when trying to parse .qmd files as valid nbdev source. Could you share a minimal .qmd file that reproduces this bug? I'm a bit new at contributing to larger OSS projects on github, but I feel that this bug doesn't need its own issue since it is pertinent only to this PR. |
Addresses #1461
Using quarto and its VS code extension, I find that writing
.qmd
files to be a smoother interactive alternative to.ipynb
files. That.qmd
files are plain text comes with several advantages:.qmd
seamlessly integrates with Cursor AI/other AI copilots..qmd
is fully compatible with standard git tooling.qmd
works better with VIM keybindings.qmd
files don't need a specialnbdev_clean
step to remove cell metadata and outputs, meaning your source files are not altered in any way by nbdev's transpilation process (something that bothers me immensely when developing in.ipynb
)Turns out,
nbdev
doesn't need many changes to implement this feature..qmd
in addition to .ipynbread_qmd
/write_qmd
function for converting the.qmd
to/from nbdev'sAttrDict
format. This means two-way sync (vianbdev_update
) also works for.qmd
and its corresponding.py
files.execnb
'srun_all
to generate outputs for the docs inside_proc/
-cached .ipynb files.It looks like there have been other attempts to allow .qmd support for nbdev (see this quarto issue) or allow plain-text support (see #1499). However, .qmd support is still missing in the current version of nbdev, and the latter seems to introduce
jupytext
as an additional dependency which uses the slowquarto convert
command to pair a .ipynb and .qmd (this PR introduces a faster .qmd <-> .ipynb parser). Now you can seamlessly develop using a mix of.qmd
and.ipynb
, whichever you prefer, with no additional dependencies.I've written up a small tutorial for setting good VSCode defaults in
nbs/tutorials/develop_in_plain_text.qmd
A few notes of caution and room for improvement:
00_core.ipynb
and00_core.qmd
, as both of these will create the intermediate_proc/00_core.ipynb
nbdev_prepare
will run executable cells in.qmd
documents twice: 1x when testing and, because outputs aren't saved, 1x when generating the docs.The PR is in a pretty stable position already (see this fork of nbdev rewritten entirely using
.qmd
files). There may be edge cases that I haven't considered, but in all I hope this is nearing a good shape to distribute.