Yes, use #| exports
instead of #| export
. (The s
at the end is for show).
Whew, I finally got it! Yeah! (I was writing in this post about my failed attempts, and suddenly I realized the cause of the problem… so, keep sharing in the forum is very helpful indeed.)
The cause of my problem is I should not have exported more than one notebook to the same library module. When I exported 3 notebooks to the same module core
, only one notebook will be exported, which actually makes sense because nbdev probably is designed and is intended to use each notebook as a separate module.
I don’t think nbdev tutorial has mentioned it, or has it?
Could we enable nbdev to allow more than one notebooks to export to the same module? I think it can be useful.
Possibly! We’ll keep it in mind.
Perfect, thank you @jeremy !
On that note, I had a question about this function in the 09_processors.ipnb
notebook in the nbdev source:
def _do_eval(cell):
...
_show_dirs = {'export','exports','exporti','exec_doc'}
...
I know now what export and exports do, but what about exporti
? After trying it, I can’t tell if it does anything different than export
.
It’s i
nternal. It’s not added to __all__
– just as if you’d prefixed the function name with _
.
An unexpected behavior of README.md
in nbdev
I though README.md
is just non essential in making nbdev work smoothly. So, I have removed it. But I was wrong.
When I run pip install -e .
, I have the following error message:
Then I wanted to create a README.md file by nbdev_docs
, then error says I am missing a module which is in my lib folder.
The problem above seems to be a loop. But the problem is solved when I copied an earlier version of README.md
.
Hi @jeremy you mentioned there will be session on nbdev this week from last week APL session, could you talk more about the future sessions on nbdev?
I said there might be – but I’m not starting them this week. Will post in this category before they start.
What caused this CI error?
I have updated fastcore and nbdev, and nbdev_prepare
and nbdev_preview
both worked fine. But I still get this CI error from github after git push
. Where should I check next?
Are you sure you have the latest fastcore? That argument was just added
Thanks, it resolved. Not sure how exactly
Hello nbdev community,
I keep getting the following error even after applying nbdev_export and pushing the content to my repo.
Error: Notebooks and library are not in sync. Please run nbdev_export.
Any idea why?
Just realized that I was using a slightly older nbdev version.
pip3 install --upgrade --force-reinstall nbdev
solved the issue.
#|filter_stream
seems not working
The middle two lines which are supposed to be removed are still there. Where do I get wrong?
It should look like this
@Daniel directives don’t take any effect in the notebook editor itself, they only affect the result of other commands like export, docs, tests, etc. If you do nbdev_preview
and navigate to that notebook’s web page, you should see that those lines were removed
Thank you so much! This is very helpful.
Never include import ...
in a cell with other codes
When I ran a cell like this
from fastcore.meta import delegates as dg
defaults.src = inspect.getsource(dg) # user input, must have
defaults.deb = inspect.getsource(delegatesdb) # user input, must have
defaults.checksource() # user input, must have
I have the following error
After you split them into two cells, meaning let import
to have its own cell, then the error is gone.
Yep, nbdev is supposed to warn you if you mix imports with code in unexported cells. Are you on the latest version? We also have a section on the FAQ describing it: nbdev - Getting started
I see that documentation generated with #|export comes with a source
link alongside the documentation in the nbdev tutorial (here for example), which is nice.
However, this source
link does not show up on my documentation (here for example). Is there an option I need to enable?
Thanks in advance.
Are you using the latest version of nbdev? This was added recently