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

Should code after %save be executed? #180

Closed
BoPeng opened this issue Jan 17, 2019 · 5 comments
Closed

Should code after %save be executed? #180

BoPeng opened this issue Jan 17, 2019 · 5 comments
Assignees

Comments

@BoPeng
Copy link
Contributor

BoPeng commented Jan 17, 2019

With #179 , I am adding a new %runfile magic that uses the

%save filename
%run

----
%runfile filename

pattern to replace

%run
---
%rerun

However, the current behavior of %save is that it will save the cell without executing them, so the above example will not work.

%run
%save

will not work either because %run will send %save to sos command.

I remember that we had this discussion a long time ago and you seem to use %save to create multiple workflows or arbitrary config file so you prefer the current behavior (of not executing the rest of the cell). Is this still the case?

I think using %save to make Jupyter an editor of external file is logically suspicious, and we already have

report: output='whatever'
content

for this purpose. Should I change the behavior back?

@gaow
Copy link
Member

gaow commented Jan 17, 2019

you seem to use %save to create multiple workflows or arbitrary config file so you prefer the current behavior

Yes that was indeed in some of my old code.

I think using %save to make Jupyter an editor of external file is logically suspicious,

I used it heavily before because it looks nice on github -- I have one file for lots of scripts. But it is about the only benefit of it. Offline I use vscode which organizes all scripts nicely anyways.

If you ask my personal opinion of reverting: the major impact is that it will break one of my project (with a paper under review) but I'd not worry about it because I do not think they will ever try to reproduce it and even if they do, my official instruction was to use a docker image I made. Also this will impact some code @minqiao has but it is not a big deal. So it's Okay if you want to change the behavior back and we'll make adjustments accordingly.

@BoPeng
Copy link
Contributor Author

BoPeng commented Jan 17, 2019

I used it heavily before because it looks nice on github

I do not get it. github does not highlight sos notebook, right? Or are you saying %save looks better than report: output=?

@gaow
Copy link
Member

gaow commented Jan 17, 2019

I used it heavily before because it looks nice on github

Sorry -- I never use report: output=?. Github is not good at searching keywords from multiple scripts so by putting them in one file it made search on github easier. Also I can document it better using markdown cells which also shows nicely on github. But yes there is no syntax highlighting. We do not advertise usingof SoS Notebook as a script organizer the way I use it anyways. But these are what I found useful, not for offline editing or developing, but for sharing and letting others to view them.

@BoPeng
Copy link
Contributor Author

BoPeng commented Jan 17, 2019

So perhaps a -r (run) option to %save? This will not break your notebooks and have the job done.

@gaow
Copy link
Member

gaow commented Jan 17, 2019

Sure, thanks! Yes although I'm neutral at this point, if down the line we do improve the syntax highlighting and other features and somehow make SoS notebook a decent script organizer this magic might then be useful to have. Also %save by itself should not sound like it will execute before it saves a script.

BoPeng pushed a commit that referenced this issue Jan 17, 2019
@BoPeng BoPeng closed this as completed Jan 17, 2019
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

2 participants