Nbdev v2 launched

Yes, I haven’t used nbdev_update yet, but it seems useful for code refactoring.

One basic need I have is when my notebook gets big, and I want to open it and go straight to the point where I want to modify it. I use the find functionality, but that search over text is slow compared to IDE, which filters only function names, for example.

I will give it a try to VS, as @seem suggested, as it is something I want to try anyway, as they seem to be making a lot of progress on ML/AI productivity.

Can you explain more about what you mean here?

Sure. Currently, my test.yaml looks like this;

jobs:
  test:
    runs-on: ubuntu-latest
    steps: [uses: fastai/workflows/nbdev-ci@master]

I understand that if the maintainer of fastai/workflows/nbdev-ci@master make code changes to this workflow, it will automatically propagate to my CI.

If I copy the contents of the workflow above to my repo and modify it to fix the issues I mentioned, I will no longer be in sync with future changes made in fastai/workflows/nbdev-ci@master.

1 Like

Yes that’s true. I use the Collapsible Headings and TOC2 extensions to move around notebooks more quickly, but it’s not as fast to jump to a definition as with a regular editor.

3 Likes

Failed to clean notebooks and URI malformed

I have written a library for a second time and this time I was fully consumed by it and didn’t run nbdev_prepare until now. After fixed all the mix cell issues, I still got two issues (I did update nbdev though):

The first issue is after I run nbdev_prepare I got a lots of messages saying 'failed to clean notebook"

The second issue is after I run nbdev_docs, I got “URI malformed”

Could anyone help me have a look? Thanks

At least one of the issues is reported here, but it is not solved yet AFAIK.

1 Like

Thanks a lot @tgmstat, and the solution by updating to the latest libraries with git by @hamelsmu solved the first issue for me. However, I still have no idea where to look to fix my second issue with 'URI malformed"

Can you tell me more about the URI malformed? My apologies as I may have missed that or lost track of that one!

1 Like

Thanks for your reply, but the image above is all I got from nbdev after running nbdev_docs. How do I dig more about the info related to URI malformed? Where should I look?

This line suggests its a deno error, which would be happening inside Quarto preview, and I suspect not due to nbdev (I could be wrong).

I’d be happy to take a look but I get a 404 error when I follow your repo link, it might be private. Trying the latest Quarto prerelease might also help. Looking through their changelog, they’ve been making quite a few deno-related changes lately e.g. upgrading its version.

You might also have luck posting in a Quarto support forum?

Thanks a lot. You are right, it was private, my bad. Now it is public.

I have downloaded and installed the latest prerelease, there is some progress here, as there is more info given instead of URI malformed. But I don’t know what to do with it.

If I remove the first table of contents cell from utils.ipynb, the error goes away.

I’m curious why you’re opting for that? The Quarto docs should have its own table of contents on the right (and you can control it with the Quarto toc frontmatter options described here). And in Jupyter, I recommend using the table of contents extension available here.

BTW, if a markdown header ends in a - (e.g. ## Export -) it will be hidden, no need for #|hide in that case.

I also get that in the latest prerelease - it’s being tracked here by the Quarto team: rust launcher: crash on retrieving exit code from deno · Issue #2296 · quarto-dev/quarto-cli · GitHub

Best to revert to the released version in the meantime.

1 Like

Yeah, the toc cell is annoying. Every time I use the classic notebook, the toc cell will automatically generated for me. I don’t know how to turn it off without keeping TOC2 extension. Also when I move from Jupyter Notebook to Jupyter lab, if I don’t turn off TOC2 from classic Notebook, when I open Jupyter lab I will still get the toc cell.

So, these days I mainly stay with Jupyter lab without using toc2 extension.

Now, the problem is solved with Jeremy’s tips and removing the toc cell as you suggested.

1 Like

Thanks Jeremy, revert back to the latest version does solve the URI malformed problem for me!

Ah I see! I didn’t know the extension could do that. I’m able to toggle that setting by clicking “Edit”, “nbextensions config”, then clicking “Table of Contents (2)” in the list, then toggling the “Add a Table of Contents cell at the top of the notebook” option.

Alternatively, it also seems to be configurable in the JSON file ~/.jupyter/nbconfig/notebook.json under the keys "toc2" followed by "toc_cell" (a JSON boolean).

2 Likes

Wow, thank you so much! This is very helpful!!! I have always wanted to get this sorted out but was never successful!

I tried and they work well. Thank you!


Now, I think jupyter notebook may become lovely and appealing again :slight_smile:

2 Likes

How to collapse sidebars to display the 100% of line width of cells

I have written a little tool to print both source codes, comments and evaluations of expressions for debugging. So, I need to a wide line width to display below, and luckily in jupyterlab, by default the line width of cells seem to be 100% (I guess). To enable a nice view of the print out, I just need to collapse the sidebar as shown below.

In jupyter notebook, I can manually set the line width of cells with the following code

from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))

then I can get the look I want as below

However, when I do nbdev_preview, I can’t collapse the sidebars to display the full line width of cells. Is there a way to collapse the sidebars to reveal the full line width of cells?

There are many nice ways to do this in quarto:

1 Like