[IPython-dev] Create New Notebook from Command-line

Wes Turner wes.turner at gmail.com
Fri Dec 5 14:06:25 EST 2014


On Fri, Dec 5, 2014 at 2:57 AM, Matthias BUSSONNIER <
bussonniermatthias at gmail.com> wrote:

> Hi Andrew.
>
> Base on a Fernando example would the following python snippet suit you ?
>
> import IPython.nbformat as nbf
> nb = nbf.v4.new_notebook()
> text = "This is an auto-generated notebook"
> nb['cells'] = [ nbf.v4.new_markdown_cell(text)]
> nb['cells'].append(nbf.v4.new_code_cell('#'+text))
> fname = 'test.ipynb'
>
> with open(fname, 'w') as f:
>     nbf.write(nb, f, 4)


1. This could be a useful commandline option.

2. You could accomplish the same with a
https://github.com/audreyr/cookiecutter jinja2 project template.

    * There could be variations on such a template e.g. with default
headings for:
      *
https://en.wikipedia.org/wiki/Scientific_method#Elements_of_the_scientific_method
      * { Abstract, Question, Hypothesis, Experiment, Observations/Data,
Analysis, Conclusion, ... }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141205/7d8705de/attachment.html>


More information about the IPython-dev mailing list