/usr/share/doc/python-guidata-doc/html/development.html is in python-guidata-doc 1.7.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | <!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>How to contribute — guidata 1.7 Manual</title>
<link rel="stylesheet" href="_static/sphinxdoc.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.7.4',
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="shortcut icon" href="_static/favicon.ico"/>
<link rel="top" title="guidata 1.7 Manual" href="index.html" />
<link rel="next" title="Examples" href="examples.html" />
<link rel="prev" title="Installation" href="installation.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="examples.html" title="Examples"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="installation.html" title="Installation"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">guidata Manual</a> »</li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/guidata.png" alt="Logo"/>
</a></p>
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">How to contribute</a><ul>
<li><a class="reference internal" href="#submitting-changes">Submitting changes</a></li>
<li><a class="reference internal" href="#coding-guidelines">Coding guidelines</a></li>
<li><a class="reference internal" href="#pyqt-v4-4-compatibility-issues">PyQt v4.4 compatibility issues</a></li>
<li><a class="reference internal" href="#pyqt-pyside-compatibility">PyQt / PySide compatibility</a></li>
<li><a class="reference internal" href="#pyqt5-compatibility">PyQt5 compatibility</a></li>
</ul>
</li>
<li><a class="reference internal" href="#python-3-compatibility">Python 3 compatibility</a><ul>
<li><a class="reference internal" href="#fixing-trivial-things-with-2to3">Fixing trivial things with 2to3</a></li>
<li><a class="reference internal" href="#fixing-unicode-issues">Fixing unicode issues</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="installation.html"
title="previous chapter">Installation</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="examples.html"
title="next chapter">Examples</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/development.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick 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>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="how-to-contribute">
<h1>How to contribute<a class="headerlink" href="#how-to-contribute" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submitting-changes">
<h2>Submitting changes<a class="headerlink" href="#submitting-changes" title="Permalink to this headline">¶</a></h2>
<p>Due to confidentiality issues, we are not able <em>for now</em> to publish any source-
controlled repository (even if we do have a <cite>Mercurial</cite> repository for the
project). However, this does not prevent motivated users from contributing to
the project by sending patches applied to the last published version of the
library. To compensate the absence of source repository, we try to update the
library as often as we can in order to keep the public source archive version
as close as possible to the internal development version.</p>
</div>
<div class="section" id="coding-guidelines">
<h2>Coding guidelines<a class="headerlink" href="#coding-guidelines" title="Permalink to this headline">¶</a></h2>
<p>In general, we try to follow the standard Python coding guidelines, which cover
all the important coding aspects (docstrings, comments, naming conventions,
import statements, ...) as described here:</p>
<ul class="simple">
<li><a class="reference external" href="http://www.python.org/peps/pep-0008.html">Style Guide for Python Code</a></li>
</ul>
<p>The easiest way to check that your code is following those guidelines is to
run <cite>pylint</cite> (a note greater than 8/10 seems to be a reasonnable goal).</p>
</div>
<div class="section" id="pyqt-v4-4-compatibility-issues">
<h2>PyQt v4.4 compatibility issues<a class="headerlink" href="#pyqt-v4-4-compatibility-issues" title="Permalink to this headline">¶</a></h2>
<p>The project has to be compatible with PyQt >= v4.4 which means that the
following recommendations should be followed:</p>
<ul class="simple">
<li>avoid using <cite>super</cite>: when writing classes deriving from a QObject child class
(i.e. almost any single class imported from QtGui or QtCore), the <cite>super</cite>
builtin-function should not be used outside the constructor method (call
the parent class method directly instead)</li>
<li>before using any function or method from PyQt4, please check that the feature
you are about to use was already implemented in PyQt4 v4.4 (more precisely
in the Qt version used in PyQt4 v4.4) – if not, a workaround should be
implemented to avoid breaking compatibility</li>
<li>do not use the PyQt-specific QFileDialog static methods (not present in Qt)
which were introduced in PyQt v4.6: <cite>getOpenFileNameAndFilter</cite>,
<cite>getOpenFileNamesAndFilter</cite> and <cite>getSaveFileNameAndFilter</cite> (<cite>guidata</cite>
provides wrappers around <cite>QFileDialog</cite> static methods handling the selected
filter which were taken from the <cite>spyderlib</cite> library (from module
<cite>spyderlib.qt.compat</cite>): they are available in <cite>guidata.qt.compat</cite>)</li>
</ul>
</div>
<div class="section" id="pyqt-pyside-compatibility">
<h2>PyQt / PySide compatibility<a class="headerlink" href="#pyqt-pyside-compatibility" title="Permalink to this headline">¶</a></h2>
<p>The project should be mostly compatible with both PyQt and PySide (although
PySide is not as popular as it used to be, so testing tend to be limited).</p>
</div>
<div class="section" id="pyqt5-compatibility">
<h2>PyQt5 compatibility<a class="headerlink" href="#pyqt5-compatibility" title="Permalink to this headline">¶</a></h2>
<p>In its current implementation, the code base has to be compatible with PyQt
API #2 (PySide-compatible API, PyQt >= v4.6) and with PyQt5, which means that
the following recommendations should be followed:</p>
<ul class="simple">
<li><cite>QVariant</cite> objects must not be used (API #2 compatibility)</li>
<li>Use exclusively new-style signals and slots</li>
<li>Read carefully PyQt5 documentation regarding class inheritance behavior: it
is quite different than the old PyQt4 implementation. Producing code
compatible with both PyQt4 and PyQt5 can be tricky: testing is essential.</li>
</ul>
</div>
</div>
<div class="section" id="python-3-compatibility">
<h1>Python 3 compatibility<a class="headerlink" href="#python-3-compatibility" title="Permalink to this headline">¶</a></h1>
<p>Regarding Python 3 compatibility, we chose to handle it by maintaining a single
source branch being compatible with both Python 2.6-2.7 and Python 3.</p>
<p>Here is what we have done.</p>
<div class="section" id="fixing-trivial-things-with-2to3">
<h2>Fixing trivial things with 2to3<a class="headerlink" href="#fixing-trivial-things-with-2to3" title="Permalink to this headline">¶</a></h2>
<p>The first step is to run the <cite>2to3</cite> script (see Python documentation) to
convert print statements to print function calls – note that your source
directory (named <cite>directory_name</cite>) has to be version controlled (no backup is
done thanks to the <cite>-n</cite> option flag).
<cite>python 2to3.py -w -n -f print directory_name</cite></p>
<p>Open each modified source file and add the following line at the beginning:
from __future__ import print_function</p>
<p>Then run again <cite>2to3</cite> with all other Python 2/3 compatible fixers:
<cite>python 2to3.py -w -n -f apply -f dict -f except -f exitfunc -f filter -f has_key -f map -f ne -f raise -f ws_comma -f xrange -f xreadlines -f zip directory_name</cite></p>
<p>After these two steps, your code should be compatible with Python 2.6, 2.7
and 3.x, but only with respect to the simplest changes that occured between
Python 2 and Python 3. However, this a step forward to Python 3 compatibility
without breaking Python 2.6+ compatibility.</p>
</div>
<div class="section" id="fixing-unicode-issues">
<h2>Fixing unicode issues<a class="headerlink" href="#fixing-unicode-issues" title="Permalink to this headline">¶</a></h2>
<p>In Python 3, <cite>unicode</cite> and <cite>str</cite> strings have been replaced by <cite>str</cite> and
<cite>bytes</cite> strings:</p>
<blockquote>
<div><ul class="simple">
<li><cite>str</cite> is the text string type, supporting unicode characters natively</li>
<li><cite>bytes</cite> is the binary string type.</li>
</ul>
</div></blockquote>
<p>As a consequence, Python 2 code involving strings may cause compatibility
issues with Python 3. For example:</p>
<blockquote>
<div><ul class="simple">
<li>file I/O may return <cite>bytes</cite> instead of <cite>str</cite> in Python 3 (depending on the
open mode): this can be solved by calling the <cite>decode</cite> method on the <cite>bytes</cite>
object (this will work on both Python 2 <cite>str</cite> and Python 3 <cite>bytes</cite> objects)</li>
<li>in Python 3.0-3.2, the <cite>u’unicode text’</cite> or <cite>u”unicode text”</cite> syntax is
not allowed and will raise a SyntaxError: this can be solved by inserting the
<cite>from __future__ import unicode_literals</cite> at the beginning of the script and
by removing all the <cite>u</cite> string prefixes</li>
<li>in Python 3 <cite>isinstance(text, basestring)</cite> can be replaced by
<cite>is_text_string(text)</cite> (function of the <cite>guidata.py3compat</cite> module)</li>
<li>in Python 3 <cite>isinstance(text, unicode)</cite> can be replaced by
<cite>is_unicode(text)</cite> (function of the <cite>guidata.py3compat</cite> module)</li>
<li>in Python 3 <cite>unicode(text)</cite> can be replaced by <cite>to_text_string(text)</cite>
(function of the <cite>guidata.py3compat</cite> module)</li>
</ul>
</div></blockquote>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="examples.html" title="Examples"
>next</a> |</li>
<li class="right" >
<a href="installation.html" title="Installation"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">guidata Manual</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2009-2015, CEA - Commissariat à l'Energie Atomique et aux Energies Alternatives.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.3.
</div>
</body>
</html>
|