Skip to content
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 convenience function for executing notebooks #573

Merged
merged 2 commits into from
Apr 25, 2017

Conversation

takluyver
Copy link
Member

Using the ExecutePreprocessor API is slightly awkward if you want to execute a notebook from a Python script. This provides a more convenient executenb function to do it.

Prompted by takluyver/nbparameterise#4

@takluyver takluyver added this to the 5.2 milestone Apr 21, 2017
@mpacer
Copy link
Member

mpacer commented Apr 21, 2017

LGTM

@mpacer
Copy link
Member

mpacer commented Apr 21, 2017

Hmm actually do you have any thoughts on how the API would expose the ability to pass configuration values (e.g., other preprocessors that would be run before running nbexecute)? I feel like that could also be useful from the perspective of nbparameterize.

@mpacer
Copy link
Member

mpacer commented Apr 21, 2017

If you don't want to make that part of this PR, no worries, and I'll just merge as is.

@takluyver
Copy link
Member Author

how the API would expose the ability to pass configuration values (e.g., other preprocessors that would be run before running nbexecute)?

At least for the case of other preprocessors running before execution, I would suggest running them before calling the function. There's no need to design a new API for running a series of operations in order, because code already defines a series of operations to run in order. ;-)

# Complex
do_y(..., pre_function=do_x)

# Simple
do_x(...)
do_y(...)

We may want to provide similar convenience functions for other preprocessors, so they're easy to call from Python code. But I'd take that on a case-by-case basis.

I notice that this branch has a merge conflict, so I'll resolve those.

@mpacer
Copy link
Member

mpacer commented Apr 25, 2017

Fair enough and fair enough. LGTM, merging.

@mpacer mpacer merged commit 2285e3f into jupyter:master Apr 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants