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

Adding in-notebook branching #12

Open
beasteers opened this issue Apr 8, 2019 · 1 comment
Open

Adding in-notebook branching #12

beasteers opened this issue Apr 8, 2019 · 1 comment

Comments

@beasteers
Copy link

First off, I want to say that finding this project was very exciting and is functionality that I've been itching for.

It'd be nice if we could provide this inside notebooks themselves. Here's what I'm envisioning:

# my_notebook.ipynb
## cell
# defaults
MODEL = 'asdsadfasfd'
DATASET = 'asdfasdf.csv'

## cell
%% nbrun some_test_1
MODEL = 'adfasdfasf'
...

## cell
%% nbrun some_test_2
MODEL = 'qwerqwerer'
DATASET = 'qwerwqer.csv'
...

# ....rest of notebook...

Then to run:

>>> nbrun my_notebook.ipynb results/
Writing to results/some_test_1.pdf.
Writing to results/some_test_2.pdf.

So the nbrun script would branch off for each nbrun id it encounters and write that to its own file. Only cells that match the current nbrun branch id would be run. This would actually remove the limitations because it wouldn't require objects to have a literal representation.

One thing that would require thought is if we would need to enforce these cells to exist only at the top of the file. And if not, if we allow branching in the middle or at the end, how would we deal with cloning objects for each branch.

@beasteers
Copy link
Author

Now that I think about it, this could be useful in normal notebook execution too. Like if you have multiple consecutive nbrun cells, we could mod the layout so that they sit side-by-side in a carousel layout. And there could be a dropdown at the top of the notebook which would enumerate all of the branches you have and would allow you to select which one you want to run.

This UI would be a much bigger frontend project so I'm not actually suggesting it, but I think it would be really interesting for nb workflows.

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

No branches or pull requests

1 participant