Add --script flag as shorthand for notebook save_script option. #1168

Merged
merged 4 commits into from Dec 18, 2011

2 participants

@fperez
IPython member

Also expand the section of the docs dealing with notebook imports.

@takluyver takluyver and 1 other commented on an outdated diff Dec 17, 2011
IPython/frontend/html/notebook/notebookmanager.py
@@ -40,10 +47,12 @@ class NotebookManager(LoggingConfigurable):
""")
save_script = Bool(False, config=True,
- help="""Also save notebooks as a Python script.
+ help="""Automaticall create a Python script when saving the notebook.
@takluyver
IPython member
takluyver added a line comment Dec 17, 2011

Automatically - it's missing the y

@fperez
IPython member
fperez added a line comment Dec 17, 2011

Thanks, fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@takluyver takluyver and 1 other commented on an outdated diff Dec 17, 2011
IPython/frontend/html/notebook/notebookmanager.py
#-----------------------------------------------------------------------------
+manager_flags =boolean_flag('script', 'NotebookManager.save_script',
@takluyver
IPython member
takluyver added a line comment Dec 17, 2011

I'm not so familiar with our command line parsing, but it looks odd that we're assigning a single ...flag item to a plural ...flags name. Should it be wrapped in a container of some sort?

@fperez
IPython member
fperez added a line comment Dec 17, 2011

That object is actually a dict that contains two flags, '--script', and '--no-script'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@minrk minrk and 1 other commented on an outdated diff Dec 18, 2011
IPython/frontend/html/notebook/notebookapp.py
# the flags that are specific to the frontend
# these must be scrubbed before being passed to the kernel,
# or it will raise an error on unrecognized flags
-notebook_flags = ['no-browser', 'no-mathjax', 'read-only']
+notebook_flags = ['no-browser', 'no-mathjax', 'read-only', 'script']
@minrk
IPython member
minrk added a line comment Dec 18, 2011

need to include 'no-script' in notebook_flags, so it won't be relayed to kernel

@fperez
IPython member
fperez added a line comment Dec 18, 2011

Fixing it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@minrk
IPython member

Typically we have defined flags in the same file as the application that uses them, but I don't actually see anything wrong with doing it this way.

@fperez
IPython member

OK, I'll move it over for consistency's sake. Not having done it before, I did what seemed most obvious immediately, but I think it's better to keep a consistent pattern.

@fperez
IPython member

Pushed, let me know how it looks and we'll merge when ready. Thanks for the review!

@minrk
IPython member

thanks, looks good. Go ahead and merge.

@fperez
IPython member

Great, thanks. Merging now.

@fperez fperez merged commit e953107 into ipython:master Dec 18, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment