Show More
@@ -1,76 +1,92 b'' | |||
|
1 |
|
|
|
2 | =================== | |
|
1 | .. _documenting-ipython: | |
|
2 | ||
|
3 | ===================== | |
|
4 | Documenting IPython | |
|
5 | ===================== | |
|
3 | 6 | |
|
4 | 7 | Standalone documentation |
|
5 | ------------------------ | |
|
8 | ======================== | |
|
6 | 9 | |
|
7 | 10 | All standalone documentation should be written in plain text (``.txt``) files |
|
8 | 11 | using `reStructuredText`_ for markup and formatting. All such documentation |
|
9 | 12 | should be placed in the top level directory ``docs`` of the IPython source |
|
10 | 13 | tree. Or, when appropriate, a suitably named subdirectory should be used. The |
|
11 | 14 | documentation in this location will serve as the main source for IPython |
|
12 | 15 | documentation and all existing documentation should be converted to this |
|
13 | 16 | format. |
|
14 | 17 | |
|
15 | In the future, the text files in the ``docs`` directory will be used to | |
|
16 | generate all forms of documentation for IPython. This include documentation on | |
|
17 | the IPython website as well as *pdf* documentation. | |
|
18 | The actual HTML and PDF docs are built using the Sphinx_ documentation | |
|
19 | generation tool. Sphinx has been adopted as the default documentation tool for | |
|
20 | Python itself as of version 2.6, as well as by a number of projects that | |
|
21 | IPython is related with, such as numpy, scipy, matplotlib, sage and nipy. | |
|
18 | 22 | |
|
19 | 23 | .. _reStructuredText: http://docutils.sourceforge.net/rst.html |
|
24 | .. _Sphinx: http://sphinx.pocoo.org/ | |
|
20 | 25 | |
|
21 | A bit of shell code: | |
|
22 | 26 | |
|
23 | .. code-block:: bash | |
|
27 | The rest of this document is mostly taken from the `matploblib | |
|
28 | documentation`__; we are using a number of Sphinx tools and extensions written | |
|
29 | by the matplotlib team and will mostly follow their conventions, which are | |
|
30 | nicely spelled out in their guide. What follows is thus a lightly adapted | |
|
31 | version of the matplotlib documentation guide, taken with permission from the | |
|
32 | MPL team. | |
|
24 | 33 | |
|
25 | cd /tmp | |
|
26 | echo "My home directory is: $HOME" | |
|
27 | ls | |
|
34 | .. __: http://matplotlib.sourceforge.net/doc/html/devel/documenting_mpl.html | |
|
28 | 35 | |
|
29 | A bit of Python code: | |
|
30 | 36 | |
|
31 | .. code-block:: python | |
|
37 | A bit of Python code:: | |
|
32 | 38 | |
|
33 | 39 | for i in range(10): |
|
34 | 40 | print i, |
|
35 | 41 | print "A big number:",2**34 |
|
36 | 42 | |
|
37 | An interactive Python session: | |
|
38 | ||
|
39 | .. code-block:: python | |
|
43 | An interactive Python session:: | |
|
40 | 44 | |
|
41 | 45 | >>> from IPython import genutils |
|
42 | 46 | >>> genutils.get_ipython_dir() |
|
43 | 47 | '/home/fperez/.ipython' |
|
44 | 48 | |
|
45 | 49 | |
|
46 | 50 | An IPython session: |
|
47 | 51 | |
|
48 | 52 | .. code-block:: ipython |
|
49 | 53 | |
|
50 |
In [ |
|
|
54 | In [7]: import IPython | |
|
51 | 55 | |
|
52 |
In [ |
|
|
56 | In [8]: print "This IPython is version:",IPython.__version__ | |
|
53 | 57 | This IPython is version: 0.9.1 |
|
54 | 58 | |
|
59 | In [9]: 2+4 | |
|
60 | Out[9]: 6 | |
|
61 | ||
|
62 | ||
|
63 | A bit of shell code: | |
|
64 | ||
|
65 | .. code-block:: bash | |
|
66 | ||
|
67 | cd /tmp | |
|
68 | echo "My home directory is: $HOME" | |
|
69 | ls | |
|
55 | 70 | |
|
56 | 71 | |
|
72 | ||
|
57 | 73 | Docstring format |
|
58 | ---------------- | |
|
74 | ================ | |
|
59 | 75 | |
|
60 | 76 | Good docstrings are very important. All new code will use `Epydoc`_ for |
|
61 | 77 | generating API docs, so we will follow the `Epydoc`_ conventions. More |
|
62 | 78 | specifically, we will use `reStructuredText`_ for markup and formatting, since |
|
63 | 79 | it is understood by a wide variety of tools. This means that if in the future |
|
64 | 80 | we have any reason to change from `Epydoc`_ to something else, we'll have fewer |
|
65 | 81 | transition pains. |
|
66 | 82 | |
|
67 | 83 | Details about using `reStructuredText`_ for docstrings can be found `here |
|
68 | 84 | <http://epydoc.sourceforge.net/manual-othermarkup.html>`_. |
|
69 | 85 | |
|
70 | 86 | .. _Epydoc: http://epydoc.sourceforge.net/ |
|
71 | 87 | |
|
72 | 88 | Additional PEPs of interest regarding documentation of code: |
|
73 | 89 | |
|
74 | 90 | - `Docstring Conventions <http://www.python.org/peps/pep-0257.html>`_ |
|
75 | 91 | - `Docstring Processing System Framework <http://www.python.org/peps/pep-0256.html>`_ |
|
76 | 92 | - `Docutils Design Specification <http://www.python.org/peps/pep-0258.html>`_ |
General Comments 0
You need to be logged in to leave comments.
Login now