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
Add a top-level function to execute notebooks #125
Comments
@minrk Is there anything that needs to be done for this issue? With @tritemio's https://github.com/tritemio/nbrun he seems to have covered the use case, is the idea that we should attempt to integrate that functionality into the core library? What are the barriers to doing that? One thought is that the approach to distributing nbrun separately is going to discourage people from using it. |
nbrun also executes notebooks passing parameters, but this is not the topic here. What I was proposing was to add a simple function that given a notebook (i.e. filename) it executes it and writes the executed version to disk. A use case is executing a set of notebooks on a CI server (for both testing and rendering). Right now, I'm adding nbrun.py to the notebook repository as it is only a small file (and one function). Having such a function directly in nbconvert would avoid the need of vendorizing nbrun. API-wise, the function should be in the top-level module and have only a few options to specify the output file (including not writing the output, maybe just returning the |
Talked with @takluyver about this a bit today. I think there's going to need to be a general discussion of how we want to expose an API for executing notebooks (at least in terms of anything beyond @takluyver can correct me but I believe his preferred method would be to have something like You suggest above running a series of notebooks in one shot and the way you propose to modify the current functionality sounds like it would be an API expected to work from the module perspective of nbconvert rather than as a CLI. That seems to be a different use case than what @takluyver was thinking of. One thing that would be useful is a collection of use cases for executable notebooks. Do you know of the uses that people have put executing notebooks in place by using your nbrun code? |
@michaelpacer, I have two use cases. One is testing execution of a set of notebooks (let say a set of library tutorials) both locally or through a CI service. I don't execute the notebook in place but save them in a second file. Another case is reducing code duplication in analysis executing notebooks in batch from another notebooks while passing arguments. Passing arguments to notebook was not my original intent with this proposal. I'm not aware of others using nbrun. I think that a module-level function that can also be called via command line would work quite well. |
I think that #573 should take care of what you want. |
With all the machinery to run notebooks in-place in nbconvert, would be nice to offer a top-level function to simply execute a notebook programmatically.
I use something like this, if others agree I can send a PR:
Having a function like this would save some gimmick to users wanting to run a series of notebooks in one shot.
The text was updated successfully, but these errors were encountered: