-
Couldn't load subscription status.
- 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. |
|
@bhoov you haven't requested Jeremy Howard or any of the maintainers to review the PR. I recently asked in discord, why this PR was not reviewed and the answer I received from Jeremy was:
|
|
@bhoov I was able to figure out the problem, and it was not related to your PR, but rather to an edge case of |
Github actually does not allow me to request reviewers or assign people to this repository, otherwise I would have. @jph00 can you review this PR? :)
|
|
Will do! |

Addresses #1461
Using quarto and its VS code extension, I find that writing
.qmdfiles to be a smoother interactive alternative to.ipynbfiles. That.qmdfiles are plain text comes with several advantages:.qmdseamlessly integrates with Cursor AI/other AI copilots..qmdis fully compatible with standard git tooling.qmdworks better with VIM keybindings.qmdfiles don't need a specialnbdev_cleanstep 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,
nbdevdoesn't need many changes to implement this feature..qmdin addition to .ipynbread_qmd/write_qmdfunction for converting the.qmdto/from nbdev'sAttrDictformat. This means two-way sync (vianbdev_update) also works for.qmdand its corresponding.pyfiles.execnb'srun_allto 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
jupytextas an additional dependency which uses the slowquarto convertcommand to pair a .ipynb and .qmd (this PR introduces a faster .qmd <-> .ipynb parser). Now you can seamlessly develop using a mix of.qmdand.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.qmdA few notes of caution and room for improvement:
00_core.ipynband00_core.qmd, as both of these will create the intermediate_proc/00_core.ipynbnbdev_preparewill run executable cells in.qmddocuments 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
.qmdfiles). There may be edge cases that I haven't considered, but in all I hope this is nearing a good shape to distribute.