-
Notifications
You must be signed in to change notification settings - Fork 65
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
Configurable pre-notebook cell #211
base: main
Are you sure you want to change the base?
Conversation
I'd use this addition. I also have a hidden cell at the top of all of my pages that are identical. How will this look in the latex versions? The hidden cells seem to not be hidden in latex. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi all I'm a new maintainer of the package and I'll try my best to review your PR.
I also myself use the "hidden cell" technique in some of my documentation and it would be a very nice addition to define some setup at the very start of the build.
Are you still willing to work on this PR or should I merge it to a feature branch ?
I thought a bit more about this beyond what I wrote recently in #235 (comment). Adding standard initialization code is a feature users often request, and therefore it makes sense to consider the functionality for executing initialization code everywhere. On the other hand, this functionality is unusual: I can't think of other tools in the Python, Jupyter, or Sphinx world that do something alike. The amount of code saved is also not too big—it's four lines per kernel, and this also makes the source easier to understand because anyone editing will see where the initialization comes from. In order to identify a proper way forward, it is worth to consider corner cases and interactions with other jupyter-sphinx features. Here's are some of these questions:
Based on the above, I would say that the initialization code should be added within sphinx, rather than to the notebook, as done in this PR. There's already functionality for finding which Jupyter cell node belongs to which notebook ( This still does not address the considerations about the different use cases and configurations, though. It seems that there may be very different use cases, and adding a lot of configuration upfront seems to add complexity that isn't compensated by the added convenience. As a reasonable middle ground I propose to document how to achieve this by using a small sphinx Does that sound reasonable? |
This is an excellent project and has proven very useful, but in some environments we end up having a lot of boilerplate required to setup the notebook before things are run, which gets repeated throughout the codebase when kernels are reset.
To avoid having the hidden block in multiple places:
Instead it would be nice to configure some constant setup cell that is inserted at the top of the notebook
conf.py:
Then all execute blocks are already setup without the extra boilerplate: