[IPython-dev] A Reproducible IPython project template (was: Create New Notebook from Command-line)

Wes Turner wes.turner at gmail.com
Fri Dec 5 14:16:22 EST 2014


On Fri, Dec 5, 2014 at 1:06 PM, Wes Turner <wes.turner at gmail.com> wrote:

>
>
> 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, ... }
>

Really, a reproducible project template could have:

* folders for e.g. ./data , ./scripts , ./notebooks {./lib for vendored
libraries)
* a setup.py supporting a necessary directory structure
* a Makefile (that generates an index with links to nbviewer)
  * https://github.com/westurner/notebooks/blob/gh-pages/Makefile
  * https://github.com/westurner/notebooks/blob/gh-pages/makeindex.py
* an install.sh script
  * (miniconda; conda create -n py27 python readline pip)
  * https://github.com/westurner/notebooks/blob/gh-pages/install.sh
* an extension (that I still believe should be included with IPython) that
lists the versions of all installed (on the import path) and utilized
libraries and extensions
  * https://github.com/ipython/ipython/issues/2597
  * https://github.com/rasbt/watermark
  * https://github.com/jrjohansson/version_information
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141205/b93fc307/attachment.html>


More information about the IPython-dev mailing list