jupyter-book
jupyter-book copied to clipboard
`nb_custom_format` cannot overwrite default `.ipynb` extension
Describe the problem
I would like to pre-process my ipynb files and have created a package that does so.
The approach is described in Custom notebook formats and Jupytest.
However, I am not able to overwrite the default behavior.
I would assume that every one that is specifically providing a different entry point for .ipynb files knows what they are doing and expects it to replace the default loader.
Given the documentation, I would expect that the default loader does exactly:
nbformat.reads(ipynb_file_contents, 4
If this is not the case, I am maybe missing something basic and this issue is probably not a bug. :)
Link to your repository or website
No response
Steps to reproduce
Add the following configuration to _conf.yml that is also given in the Custom notebook formats and Jupytest documentation:
sphinx:
config:
nb_custom_formats:
.ipynb:
- nbformat.reads
- as_version: 4
An extension error is raised that the source_suffix .ipynb is already registered.
Extension error:
Config Path: <PATH>/_config.yml
source_suffix '.ipynb' is already registered
Output Path: <PATH>/_build/html
Traceback (most recent call last):
Running Sphinx v4.3.2
File "<PYPATH>/lib/python3.8/site-packages/jupyter_book/sphinx.py", line 114, in build_sphinx
making output directory... done
app = Sphinx(
ERROR conda.cli.main_run:execute(33): Subprocess for 'conda run ['jupyter-book', 'build', '<BOOK_NAME>']' command failed. (See above for error)
error: Recipe `build` failed on line 8 with exit code 1
The version of Python you're using
3.8.12
Your operating system
Linux-amd64
Versions of your packages
Jupyter Book : 0.12.1
External ToC : 0.2.3
MyST-Parser : 0.15.2
MyST-NB : 0.13.1
Sphinx Book Theme : 0.1.7
Jupyter-Cache : 0.4.3
NbClient : 0.5.9
Additional context
No response
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
See: https://github.com/executablebooks/meta/discussions/613#discussioncomment-1913981
My use-case is very similar to this - writing a custom preprocessor for notebooks.
I faced the exact issue source_suffix '.ipynb' is already registered when writing nb_custom_format for .ipynb, though it worked for other custom formats like .my_ipynb.
As per this executablebooks/discussions/613#discussioncomment-1913981 answer and my understanding from changelog this feature has been released with MyST-NB v0.14.0. I tried it with MyST-NB v0.15.0 and it works for .ipynb.
The only problem is that JupyterBook gives warnings as it still uses an older version of MyST-NB (ref) . Do we have a timeline to upgrade MyST-NB to v0.14.0 or v0.15.0 in JupyterBook? It would also solve this issue.
Please let me know if I am missing something as I have recently started using JupyterBook. Thank you.