Show More
@@ -1,123 +1,121 b'' | |||||
1 | ================================================================ |
|
1 | ================================================================ | |
2 | nbconvert: conversion utilities for the IPython notebook format |
|
2 | nbconvert: conversion utilities for the IPython notebook format | |
3 | ================================================================ |
|
3 | ================================================================ | |
4 |
|
4 | |||
5 | Overview |
|
5 | Overview | |
6 | ======== |
|
6 | ======== | |
7 |
|
7 | |||
8 | nbconvert provides command line utilities to convert to and from IPython |
|
8 | nbconvert provides command line utilities to convert to and from IPython | |
9 | notebooks and standard formats. |
|
9 | notebooks and standard formats. | |
10 |
|
10 | |||
11 | - ReST |
|
11 | - ReST | |
12 | - Markdown |
|
12 | - Markdown | |
13 | - HTML |
|
13 | - HTML | |
14 | - Python script |
|
14 | - Python script | |
15 | - LaTeX (through Sphinx) |
|
15 | - LaTeX (through Sphinx) | |
16 |
|
16 | |||
17 | As these tools mature, these utilities will be merged into IPython. |
|
17 | As these tools mature, these utilities will be merged into IPython. | |
18 |
|
18 | |||
19 | Requirements |
|
19 | Requirements | |
20 | ============ |
|
20 | ============ | |
21 |
|
21 | |||
22 | Jinja2 |
|
22 | Jinja2 | |
23 | ~~~~~~ |
|
23 | ~~~~~~ | |
24 |
|
24 | |||
25 | Most of the converter should rely on Jinja2 templating language. |
|
25 | Most of the converters should rely on the Jinja2 templating language. | |
26 |
|
26 | |||
27 |
|
27 | |||
28 | Markdown |
|
28 | Markdown | |
29 | ~~~~~~~~ |
|
29 | ~~~~~~~~ | |
30 | You will need the `python markdown module |
|
30 | You will need the `python markdown module | |
31 | <http://pypi.python.org/pypi/Markdown>`_ :: |
|
31 | <http://pypi.python.org/pypi/Markdown>`_ :: | |
32 |
|
32 | |||
33 |
|
33 | |||
34 | $ pip install markdown |
|
34 | $ pip install markdown | |
35 |
|
35 | |||
36 | Docutils |
|
36 | Docutils | |
37 | ~~~~~~~~ |
|
37 | ~~~~~~~~ | |
38 |
|
38 | |||
39 | nbconvert require the latest development version of docutils. This can be installed |
|
39 | nbconvert requires the latest development version of docutils. This can be installed | |
40 | via :: |
|
40 | via :: | |
41 |
|
41 | |||
42 | $ curl http://docutils.svn.sourceforge.net/viewvc/docutils/trunk/docutils/?view=tar > docutils.tgz |
|
42 | $ curl http://docutils.svn.sourceforge.net/viewvc/docutils/trunk/docutils/?view=tar > docutils.tgz | |
43 | $ pip install -U docutils.tgz |
|
43 | $ pip install -U docutils.tgz | |
44 |
|
44 | |||
45 | Sphinx-Latex |
|
45 | Sphinx-Latex | |
46 | ~~~~~~~~~~~~ |
|
46 | ~~~~~~~~~~~~ | |
47 |
|
47 | |||
48 | We are trying to require as little as possible, but for now, compiling the generated Tex file require texlive-full. |
|
48 | We are trying to require as little as possible, but for now, compiling the generated Tex file requires texlive-full. | |
49 | :: |
|
49 | :: | |
50 |
|
50 | |||
51 | sudo apt-get install texlive-full |
|
51 | sudo apt-get install texlive-full | |
52 |
|
52 | |||
53 |
|
53 | |||
54 | See http://jimmyg.org/blog/2009/sphinx-pdf-generation-with-latex.html |
|
54 | See http://jimmyg.org/blog/2009/sphinx-pdf-generation-with-latex.html | |
55 |
|
55 | |||
56 |
|
56 | |||
57 | Testing for Sphinx Latex |
|
57 | Testing for Sphinx Latex | |
58 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
|
58 | ~~~~~~~~~~~~~~~~~~~~~~~~ | |
59 |
|
59 | |||
60 | To test, I place a Test1.ipynb file in my nbconvert directory. |
|
60 | To test, I place a Test1.ipynb file in my nbconvert directory. | |
61 | Then I run this shell script |
|
61 | Then I run this shell script | |
62 |
|
62 | |||
63 | :: |
|
63 | :: | |
64 |
|
64 | |||
65 | mkdir Test1_files |
|
65 | mkdir Test1_files | |
66 | rm Test1_files/* |
|
66 | rm Test1_files/* | |
67 |
|
67 | |||
68 | python nbconvert2.py latex_sphinx_howto Test1.ipynb |
|
68 | python nbconvert2.py latex_sphinx_howto Test1.ipynb | |
69 | mv Test1.tex Test1_files/Test1.tex |
|
69 | mv Test1.tex Test1_files/Test1.tex | |
70 | cd Test1_files |
|
70 | cd Test1_files | |
71 | pdflatex Test1.tex |
|
71 | pdflatex Test1.tex | |
72 |
|
72 | |||
73 | This script will build a Sphinx-howto out of the Test1 IPython notebook. |
|
73 | This script will build a Sphinx-howto out of the Test1 IPython notebook. | |
74 | Replace "howto" with "manual" to build a manual. |
|
74 | Replace "howto" with "manual" to build a manual. | |
75 |
|
75 | |||
76 | Tested against |
|
76 | Tested against | |
77 | https://github.com/unpingco/Python-for-Signal-Processing |
|
77 | https://github.com/unpingco/Python-for-Signal-Processing | |
78 |
|
78 | |||
79 | Pandoc |
|
79 | Pandoc | |
80 | ~~~~~~ |
|
80 | ~~~~~~ | |
81 |
|
81 | |||
82 | Nbconvert also needs the `pandoc multiformat converter |
|
82 | Nbconvert also needs the `pandoc multiformat converter | |
83 | <http://johnmacfarlane.net/pandoc>`_ to do the actual text conversions. Pandoc |
|
83 | <http://johnmacfarlane.net/pandoc>`_ to do the actual text conversions. Pandoc | |
84 |
is included in most |
|
84 | is included in most Linux package managers for each distribution, and the author's | |
85 | website contains links to Mac OS X and Windows installers. |
|
85 | website contains links to Mac OS X and Windows installers. | |
86 |
|
86 | |||
87 | Pandoc, to convert markdown into latex |
|
87 | Pandoc, to convert markdown into latex | |
88 | :: |
|
88 | :: | |
89 |
|
89 | |||
90 | sudo apt-get install pandoc |
|
90 | sudo apt-get install pandoc | |
91 |
|
91 | |||
92 | Pygment |
|
92 | Pygment | |
93 | ~~~~~~~ |
|
93 | ~~~~~~~ | |
94 | For conversion to HTML/LaTeX, pygments is also required for syntax highlighting |
|
94 | For conversion to HTML/LaTeX, pygments is also required for syntax highlighting | |
95 | :: |
|
95 | :: | |
96 |
|
96 | |||
97 | $ pip install pygments |
|
97 | $ pip install pygments | |
98 |
|
98 | |||
99 |
|
99 | |||
100 |
|
100 | |||
101 | Running Tests |
|
101 | Running Tests | |
102 | ============= |
|
102 | ============= | |
103 |
|
103 | |||
104 | Please try to run the tests to avoid regression when commiting a patch, and create new test when adding features. |
|
104 | Please try to run the tests to avoid regression when commiting a patch, and create new tests when adding features. | |
105 | :: |
|
105 | :: | |
106 |
|
106 | |||
107 | $ pip install nose |
|
107 | $ pip install nose | |
108 | $ nosetests |
|
108 | $ nosetests | |
109 |
|
109 | |||
110 |
|
110 | |||
111 | Using nbconvert |
|
111 | Using nbconvert | |
112 | =============== |
|
112 | =============== | |
113 |
|
113 | |||
114 | You will need to either put the source repository in your ``$PATH`` or symlink |
|
114 | You will need to either put the source repository in your ``$PATH`` or symlink | |
115 | the ``nbconvert.py`` script, as well as the ``css`` and ``js`` subdirectories |
|
115 | the ``nbconvert.py`` script, as well as the ``css`` and ``js`` subdirectories | |
116 | to a directory in your ``$PATH``. Once this is done, you can call it as:: |
|
116 | to a directory in your ``$PATH``. Once this is done, you can call it as:: | |
117 |
|
117 | |||
118 | $ nbconvert -f <FORMAT> notebook.ipynb |
|
118 | $ nbconvert -f <FORMAT> notebook.ipynb | |
119 |
|
119 | |||
120 | Use ``nbconvert -h`` for up to date help on the available formats. |
|
120 | Use ``nbconvert -h`` for up to date help on the available formats. | |
121 |
|
121 | |||
122 |
|
||||
123 |
|
General Comments 0
You need to be logged in to leave comments.
Login now