-
Notifications
You must be signed in to change notification settings - Fork 3
/
developer_notes.html
237 lines (216 loc) · 14.9 KB
/
developer_notes.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>For Developers — PyCogent 1.9 documentation</title>
<link rel="stylesheet" href="_static/agogo.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.9',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="PyCogent 1.9 documentation" href="index.html" />
<link rel="next" title="Scripting guidelines" href="scripting_guidelines.html" />
<link rel="prev" title="Useful Utilities" href="cookbook/useful_utilities.html" />
<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAbW_pA971hrPgosv-Msv7hRQZ4X-jPDmWcshBrz2j7-fJvuUABRTGWmdiw2G89JpgztGlFGG8hDxRAw"></script>\
<script type="text/javascript" src="_static/google_feed.js"></script>
</head>
<body role="document">
<div class="header-wrapper" role="banner">
<div class="header">
<div class="headertitle"><a
href="index.html">PyCogent 1.9 documentation</a></div>
<div class="rel" role="navigation" aria-label="related navigation">
<a href="cookbook/useful_utilities.html" title="Useful Utilities"
accesskey="P">previous</a> |
<a href="scripting_guidelines.html" title="Scripting guidelines"
accesskey="N">next</a> |
<a href="genindex.html" title="General Index"
accesskey="I">index</a>
</div>
</div>
</div>
<div class="content-wrapper">
<div class="content">
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="for-developers">
<h1>For Developers<a class="headerlink" href="#for-developers" title="Permalink to this headline">¶</a></h1>
<p>Anyone can contribute to the development of PyCogent, not just registered developers. If you figure out a solution to something using PyCogent that you’d like to share, or if you have ideas for improving the current documentation, please consider submitting a <a class="reference external" href="https://help.github.com/articles/using-pull-requests">pull request</a> to the <a class="reference external" href="https://github.com/pycogent/pycogent">PyCogent git repository on GitHub</a> and we’ll look into including it in PyCogent!</p>
<div class="section" id="grabbing-from-github">
<h2>Grabbing from GitHub<a class="headerlink" href="#grabbing-from-github" title="Permalink to this headline">¶</a></h2>
<p>To grab PyCogent from GitHub, do the following:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ git clone git://github.com/pycogent/pycogent.git PyCogent
</pre></div>
</div>
</div>
<div class="section" id="building-testing-the-documentation">
<h2>Building/testing the documentation<a class="headerlink" href="#building-testing-the-documentation" title="Permalink to this headline">¶</a></h2>
<p>To build the documentation or <code class="docutils literal"><span class="pre">doctest</span></code> the contents, you’ll need to install Sphinx. Assuming you have <code class="docutils literal"><span class="pre">easy_install</span></code> configured on your machine (and if not, download <code class="docutils literal"><span class="pre">setuptools</span></code> from <a class="reference external" href="http://pypi.python.org/pypi/setuptools">http://pypi.python.org/pypi/setuptools</a> and follow the instructions). Then grab Sphinx:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ sudo easy_install -U sphinx
</pre></div>
</div>
<p>Generating the html form of the documentation requires changing into the <code class="docutils literal"><span class="pre">doc</span></code> directory and executing a <code class="docutils literal"><span class="pre">make</span></code> command:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ cd path/to/PyCogent/doc
$ make html
... # bunch of output
Build finished. The HTML pages are in _build/html.
</pre></div>
</div>
<p>This prints a bunch of output to screen and creates a directory <code class="docutils literal"><span class="pre">PyCogent/doc/_build</span></code> and within that <code class="docutils literal"><span class="pre">html</span></code>. The index file <code class="docutils literal"><span class="pre">PyCogent/doc/_build/html/index.html</span></code> is the root of the documentation.</p>
<p>One can also generate a pdf file, using the Sphinx latex generation capacity. This is slightly more involved. (It also requires that you have an installation of <a class="reference external" href="http://www.tug.org/texlive/">TeTex</a>.)</p>
<p>First generate the latex</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ make latex
... # bunch of output
Build finished; the LaTeX files are in _build/latex.
Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex.
</pre></div>
</div>
<p>then change into the <code class="docutils literal"><span class="pre">latex</span></code> dir and build the pdf</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ cd _build/latex
$ make all-pdf
</pre></div>
</div>
<p>You can now open <code class="docutils literal"><span class="pre">PyCogent.pdf</span></code>.</p>
<p>To actually test the documentation, you need to be in the <code class="docutils literal"><span class="pre">doc</span></code> directory and then execute another <code class="docutils literal"><span class="pre">make</span></code> command:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ cd path/to/PyCogent/doc
$ make doctest
</pre></div>
</div>
<p>The results are in <code class="docutils literal"><span class="pre">_build/doctest/output.txt</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The documentation does not test for presence of 3rd party dependencies (such as applications or python modules) like the PyCogent <code class="docutils literal"><span class="pre">unittest</span></code> test suite. If you don’t have all the 3rd party applications installed you will see failures. At this point <strong>no effort</strong> is being expended to hide such failures.</p>
</div>
</div>
<div class="section" id="adding-to-the-documentation">
<h2>Adding to the documentation<a class="headerlink" href="#adding-to-the-documentation" title="Permalink to this headline">¶</a></h2>
<p>You can maximise the cogent user experience for yourself and others by contributing to the documentation. If you solve a problem that you think might prove useful to others then add it into the documentation. If you can think of ways to improve the existing documents let us know.</p>
<p>For guidance on adding documentation, look at any of the existing examples. The restructured text format is pretty easy to write (for overview see the Sphinx <a class="reference external" href="http://sphinx.pocoo.org/rest.html">rest overview</a>). The conventions adopted by PyCogent are to use heading levels to be consistent with the Python.org standard (taken from <a class="reference external" href="http://sphinx.pocoo.org/rest.html#sections">Sphinx headings</a>). They are</p>
<ul class="simple">
<li># with overline, for parts</li>
<li>* with overline, for chapters</li>
<li>=, for sections</li>
<li>-, for subsections</li>
<li>^, for subsubsections</li>
<li>”, for paragraphs</li>
<li>+, added for sub-paragraphs (non-standard)</li>
</ul>
<p>If it’s a use-case, create your file in the <code class="docutils literal"><span class="pre">examples</span></code> directory, giving it a <code class="docutils literal"><span class="pre">.rst</span></code> suffix. Link it into the documentation tree, adding a line into the <code class="docutils literal"><span class="pre">examples/index.rst</span></code> file. If it’s something you think should be added into the cookbook, add it into the appropriate cookbook document.</p>
<div class="section" id="the-new-documentation-checklist">
<h3>The new documentation checklist<a class="headerlink" href="#the-new-documentation-checklist" title="Permalink to this headline">¶</a></h3>
<p>Things you should check before committing your new document:</p>
<ul>
<li><p class="first">Add a line at the beginning with yourself as author (<code class="docutils literal"><span class="pre">..</span> <span class="pre">sectionauthor::</span> <span class="pre">My</span> <span class="pre">Name</span></code>) so people can contact you with feedback.</p>
</li>
<li><p class="first">Add any data files used in your documentation under <code class="docutils literal"><span class="pre">PyCogent/doc/data/</span></code></p>
</li>
<li><p class="first">Add a download link to those files to <code class="docutils literal"><span class="pre">PyCogent/doc/data_file_links.rst</span></code> following the style employed in that file.</p>
</li>
<li><p class="first">Spellcheck!!</p>
</li>
<li><p class="first">Check what you wrote is valid restructured text by building the documents for both html and latex. If your document isn’t connected into the table of contents, Sphinx will print a warning to screen.</p>
</li>
<li><p class="first">Check you have correctly marked up the content and that it looks OK. Make sure that python code and shell commands are correctly highlighted and that literals are marked up as literals. In particular, check the latex build since it is common for text to span beyond the page margins. If the latter happens, revise your document!</p>
</li>
<li><p class="first">Check that it works (rather than testing the entire suite, you can use the convenience script within doc). For instance, the following is a single test of one file:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ cd path/to/PyCogent/doc
$ python doctest_rsts.py examples/reverse_complement.rst
</pre></div>
</div>
</li>
</ul>
</div>
<div class="section" id="adding-todos">
<h3>Adding TODOs<a class="headerlink" href="#adding-todos" title="Permalink to this headline">¶</a></h3>
<p>Add todo’s into the rst files using the <code class="docutils literal"><span class="pre">todo</span></code> directive as in</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="o">..</span> <span class="n">todo</span><span class="p">::</span>
<span class="n">some</span> <span class="n">task</span>
</pre></div>
</div>
<p>To see the list of todo’s in the project, uncomment the line that sets <code class="docutils literal"><span class="pre">todo_include_todos=True</span></code> in <code class="docutils literal"><span class="pre">doc/conf.py</span></code>, then cd into the <code class="docutils literal"><span class="pre">doc/</span></code> and make the html docs again. The todo’s are listed on the main page.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Be sure to revert the conf.py file back to it’s original state so you don’t accidentally commit the change as this affects everyone else’s documentation too!</p>
</div>
</div>
</div>
<div class="section" id="developing-c-extensions">
<h2>Developing C-extensions<a class="headerlink" href="#developing-c-extensions" title="Permalink to this headline">¶</a></h2>
<p>Extensions for PyCogent should be written in <a class="reference external" href="http://www.cython.org/">Cython</a>.</p>
<p>If you have any questions, contact <a class="reference external" href="mailto:Gavin.Huttley%40anu.edu.au">Gavin</a>.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sidebar">
<div class="news">
<table id="feed"><tr><td><h3><a href="http://pycogent.wordpress.com/">PyCogent News and Announcements</a></h3></td>
</tr></table></div>
<h3>Table Of Contents</h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="install.html">Quick installation using pip</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html">The Readme</a></li>
<li class="toctree-l1"><a class="reference internal" href="coding_guidelines.html">Coding guidelines</a></li>
<li class="toctree-l1"><a class="reference internal" href="data_file_links.html">The data files used in the documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples/index.html">Cogent Usage Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="cookbook/index.html">PyCogent Cookbook</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">For Developers</a></li>
<li class="toctree-l1"><a class="reference internal" href="scripting_guidelines.html">Scripting guidelines</a></li>
<li class="toctree-l1"><a class="reference internal" href="licenses.html">Licenses and disclaimer</a></li>
<li class="toctree-l1"><a class="reference internal" href="ChangeLog.html">Changelog</a></li>
</ul>
<div role="search">
<h3 style="margin-top: 1.5em;">Search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
<div class="footer-wrapper">
<div class="footer">
<div class="left">
<div role="navigation" aria-label="related navigaton">
<a href="cookbook/useful_utilities.html" title="Useful Utilities"
>previous</a> |
<a href="scripting_guidelines.html" title="Scripting guidelines"
>next</a> |
<a href="genindex.html" title="General Index"
>index</a>
</div>
<div role="note" aria-label="source link">
<br/>
<a href="_sources/developer_notes.txt"
rel="nofollow">Show Source</a>
</div>
</div>
<div class="right">
<div class="footer" role="contentinfo">
© Copyright 2016, PyCogent Team.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.1.
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</body>
</html>