-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontributing.html
346 lines (308 loc) · 20.6 KB
/
contributing.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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Contributing to POT — POT Python Optimal Transport 0.9.5 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
<link rel="stylesheet" type="text/css" href="_static/sg_gallery.css?v=d2d258e8" />
<link rel="stylesheet" type="text/css" href="_static/sg_gallery-binder.css?v=f4aeca0c" />
<link rel="stylesheet" type="text/css" href="_static/sg_gallery-dataframe.css?v=2082cf3c" />
<link rel="stylesheet" type="text/css" href="_static/sg_gallery-rendered-html.css?v=1277b6f3" />
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=61b282d3"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Code of conduct" href="code_of_conduct.html" />
<link rel="prev" title="Contributors" href="contributors.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
POT Python Optimal Transport
<img src="_static/logo_dark.svg" class="logo" alt="Logo"/>
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="index.html">POT: Python Optimal Transport</a></li>
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quick start guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="all.html">API and modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="auto_examples/index.html">Examples gallery</a></li>
<li class="toctree-l1"><a class="reference internal" href="releases.html">Releases</a></li>
<li class="toctree-l1"><a class="reference internal" href="contributors.html">Contributors</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Contributing to POT</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#how-to-contribute">How to contribute</a></li>
<li class="toctree-l2"><a class="reference internal" href="#pull-request-checklist">Pull Request Checklist</a></li>
<li class="toctree-l2"><a class="reference internal" href="#filing-bugs">Filing bugs</a></li>
<li class="toctree-l2"><a class="reference internal" href="#new-contributor-tips">New contributor tips</a></li>
<li class="toctree-l2"><a class="reference internal" href="#documentation">Documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="code_of_conduct.html">Code of conduct</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">POT Python Optimal Transport</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Contributing to POT</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/contributing.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="contributing-to-pot">
<h1>Contributing to POT<a class="headerlink" href="#contributing-to-pot" title="Link to this heading"></a></h1>
<p>First off, thank you for considering contributing to POT.</p>
<section id="how-to-contribute">
<h2>How to contribute<a class="headerlink" href="#how-to-contribute" title="Link to this heading"></a></h2>
<p>The preferred workflow for contributing to POT is to fork the
<a class="reference external" href="https://github.com/rflamary/POT">main repository</a> on
GitHub, clone, and develop on a branch. Steps:</p>
<ol class="arabic">
<li><p>Fork the <a class="reference external" href="https://github.com/rflamary/POT">project repository</a>
by clicking on the ‘Fork’ button near the top right of the page. This creates
a copy of the code under your GitHub user account. For more details on
how to fork a repository see <a class="reference external" href="https://help.github.com/articles/fork-a-repo/">this guide</a>.</p></li>
<li><p>Clone your fork of the POT repo from your GitHub account to your local disk:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>clone<span class="w"> </span>[email protected]:YourLogin/POT.git
$<span class="w"> </span><span class="nb">cd</span><span class="w"> </span>POT
</pre></div>
</div>
</li>
<li><p>Install pre-commit hooks to ensure that your code is properly formatted:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>pre-commit
$<span class="w"> </span>pre-commit<span class="w"> </span>install
</pre></div>
</div>
<p>This will install the pre-commit hooks that will run on every commit. If the hooks fail, the commit will be aborted.</p>
</li>
<li><p>Create a <code class="docutils literal notranslate"><span class="pre">feature</span></code> branch to hold your development changes:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>checkout<span class="w"> </span>-b<span class="w"> </span>my-feature
</pre></div>
</div>
<p>Always use a <code class="docutils literal notranslate"><span class="pre">feature</span></code> branch. It’s good practice to never work on the <code class="docutils literal notranslate"><span class="pre">master</span></code> branch!</p>
</li>
<li><p>Develop the feature on your feature branch. Add changed files using <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">add</span></code> and then <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">commit</span></code> files:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>add<span class="w"> </span>modified_files
$<span class="w"> </span>git<span class="w"> </span>commit
</pre></div>
</div>
<p>to record your changes in Git, then push the changes to your GitHub account with:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>push<span class="w"> </span>-u<span class="w"> </span>origin<span class="w"> </span>my-feature
</pre></div>
</div>
</li>
<li><p>Follow <a class="reference external" href="https://help.github.com/articles/creating-a-pull-request-from-a-fork">these instructions</a>
to create a pull request from your fork. This will send an email to the committers.</p></li>
</ol>
<p>(If any of the above seems like magic to you, please look up the
<a class="reference external" href="https://git-scm.com/documentation">Git documentation</a> on the web, or ask a friend or another contributor for help.)</p>
</section>
<section id="pull-request-checklist">
<h2>Pull Request Checklist<a class="headerlink" href="#pull-request-checklist" title="Link to this heading"></a></h2>
<p>We recommended that your contribution complies with the
following rules before you submit a pull request:</p>
<ul class="simple">
<li><p>Follow the PEP8 Guidelines which should be handles automatically by pre-commit.</p></li>
<li><p>If your pull request addresses an issue, please use the pull request title
to describe the issue and mention the issue number in the pull request description. This will make sure a link back to the original issue is
created.</p></li>
<li><p>All public methods should have informative docstrings with sample
usage presented as doctests when appropriate.</p></li>
<li><p>Please prefix the title of your pull request with <code class="docutils literal notranslate"><span class="pre">[MRG]</span></code> (Ready for
Merge), if the contribution is complete and ready for a detailed review.
Two core developers will review your code and change the prefix of the pull
request to <code class="docutils literal notranslate"><span class="pre">[MRG</span> <span class="pre">+</span> <span class="pre">1]</span></code> and <code class="docutils literal notranslate"><span class="pre">[MRG</span> <span class="pre">+</span> <span class="pre">2]</span></code> on approval, making it eligible
for merging. An incomplete contribution – where you expect to do more work before
receiving a full review – should be prefixed <code class="docutils literal notranslate"><span class="pre">[WIP]</span></code> (to indicate a work
in progress) and changed to <code class="docutils literal notranslate"><span class="pre">[MRG]</span></code> when it matures. WIPs may be useful
to: indicate you are working on something to avoid duplicated work,
request broad review of functionality or API, or seek collaborators.
WIPs often benefit from the inclusion of a
<a class="reference external" href="https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments">task list</a>
in the PR description.</p></li>
<li><p>When adding additional functionality, provide at least one
example script in the <code class="docutils literal notranslate"><span class="pre">examples/</span></code> folder. Have a look at other
examples for reference. Examples should demonstrate why the new
functionality is useful in practice and, if possible, compare it
to other methods available in POT.</p></li>
<li><p>Documentation and high-coverage tests are necessary for enhancements to be
accepted. Bug-fixes or new features should be provided with
<a class="reference external" href="https://en.wikipedia.org/wiki/Non-regression_testing">non-regression tests</a>.
These tests verify the correct behavior of the fix or feature. In this
manner, further modifications on the code base are granted to be consistent
with the desired behavior.
For the Bug-fixes case, at the time of the PR, this tests should fail for
the code base in master and pass for the PR code.</p></li>
<li><p>At least one paragraph of narrative documentation with links to
references in the literature (with PDF links when possible) and
the example.</p></li>
</ul>
<p>You can also check for common programming errors with the following
tools:</p>
<ul>
<li><p>All lint checks pass. You can run the following command to check:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>pre-commit<span class="w"> </span>run<span class="w"> </span>--all-files
</pre></div>
</div>
<p>This will run the pre-commit checks on all files in the repository.</p>
</li>
<li><p>All tests pass. You can run the following command to check:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="w"> </span>$<span class="w"> </span>pytest<span class="w"> </span>--durations<span class="o">=</span><span class="m">20</span><span class="w"> </span>-v<span class="w"> </span>test/<span class="w"> </span>--doctest-modules
</pre></div>
</div>
</li>
</ul>
<p>Bonus points for contributions that include a performance analysis with
a benchmark script and profiling output (please report on the mailing
list or on the GitHub issue).</p>
</section>
<section id="filing-bugs">
<h2>Filing bugs<a class="headerlink" href="#filing-bugs" title="Link to this heading"></a></h2>
<p>We use Github issues to track all bugs and feature requests; feel free to
open an issue if you have found a bug or wish to see a feature implemented.</p>
<p>It is recommended to check that your issue complies with the
following rules before submitting:</p>
<ul class="simple">
<li><p>Verify that your issue is not being currently addressed by other
<a class="reference external" href="https://github.com/rflamary/POT/issues?q=">issues</a>
or <a class="reference external" href="https://github.com/rflamary/POT/pulls?q=">pull requests</a>.</p></li>
<li><p>Please ensure all code snippets and error messages are formatted in
appropriate code blocks.
See <a class="reference external" href="https://help.github.com/articles/creating-and-highlighting-code-blocks">Creating and highlighting code blocks</a>.</p></li>
<li><p>Please include your operating system type and version number, as well
as your Python, POT, numpy, and scipy versions. This information
can be found by running the following code snippet:</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">platform</span><span class="p">;</span> <span class="nb">print</span><span class="p">(</span><span class="n">platform</span><span class="o">.</span><span class="n">platform</span><span class="p">())</span>
<span class="kn">import</span> <span class="nn">sys</span><span class="p">;</span> <span class="nb">print</span><span class="p">(</span><span class="s2">"Python"</span><span class="p">,</span> <span class="n">sys</span><span class="o">.</span><span class="n">version</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">numpy</span><span class="p">;</span> <span class="nb">print</span><span class="p">(</span><span class="s2">"NumPy"</span><span class="p">,</span> <span class="n">numpy</span><span class="o">.</span><span class="n">__version__</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">scipy</span><span class="p">;</span> <span class="nb">print</span><span class="p">(</span><span class="s2">"SciPy"</span><span class="p">,</span> <span class="n">scipy</span><span class="o">.</span><span class="n">__version__</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">ot</span><span class="p">;</span> <span class="nb">print</span><span class="p">(</span><span class="s2">"POT"</span><span class="p">,</span> <span class="n">ot</span><span class="o">.</span><span class="n">__version__</span><span class="p">)</span>
</pre></div>
</div>
<ul class="simple">
<li><p>Please be specific about what estimators and/or functions are involved
and the shape of the data, as appropriate; please include a
<a class="reference external" href="http://stackoverflow.com/help/mcve">reproducible</a> code snippet
or link to a <a class="reference external" href="https://gist.github.com">gist</a>. If an exception is raised,
please provide the traceback.</p></li>
</ul>
</section>
<section id="new-contributor-tips">
<h2>New contributor tips<a class="headerlink" href="#new-contributor-tips" title="Link to this heading"></a></h2>
<p>A great way to start contributing to POT is to pick an item
from the list of <a class="reference external" href="https://github.com/rflamary/POT/issues?labels=Easy">Easy issues</a>
in the issue tracker. Resolving these issues allow you to start
contributing to the project without much prior knowledge. Your
assistance in this area will be greatly appreciated by the more
experienced developers as it helps free up their time to concentrate on
other issues.</p>
</section>
<section id="documentation">
<h2>Documentation<a class="headerlink" href="#documentation" title="Link to this heading"></a></h2>
<p>We are glad to accept any sort of documentation: function docstrings,
reStructuredText documents (like this one), tutorials, etc.
reStructuredText documents live in the source code repository under the
doc/ directory.</p>
<p>You can edit the documentation using any text editor and then generate
the HTML output by typing <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">html</span></code> from the <code class="docutils literal notranslate"><span class="pre">docs/</span></code> directory.
Alternatively, <code class="docutils literal notranslate"><span class="pre">make</span></code> can be used to quickly generate the
documentation without the example gallery with <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">html-noplot</span></code>. The resulting HTML files will
be placed in <code class="docutils literal notranslate"><span class="pre">docs/build/html/</span></code> and are viewable in a web browser.</p>
<p>For building the documentation, you will need
<a class="reference external" href="http://sphinx.pocoo.org/">sphinx</a>,
<a class="reference external" href="http://matplotlib.org/">matplotlib</a>, and
<a class="reference external" href="http://pillow.readthedocs.io/en/latest/">pillow</a>.</p>
<p>When you are writing documentation, it is important to keep a good
compromise between mathematical and algorithmic details, and give
intuition to the reader on what the algorithm does. It is best to always
start with a small paragraph with a hand-waving explanation of what the
method does to the data and a figure (coming from an example)
illustrating it.</p>
<p>This Contribution guide is strongly inspired by the one of the <a class="reference external" href="https://github.com/scikit-learn/scikit-learn">scikit-learn</a> team.</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="contributors.html" class="btn btn-neutral float-left" title="Contributors" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="code_of_conduct.html" class="btn btn-neutral float-right" title="Code of conduct" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>© Copyright 2016-2023, POT Contributors.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" data-toggle="rst-versions" role="note"
aria-label="versions">
<!-- add shift_up to the class for force viewing ,
data-toggle="rst-current-version" -->
<span class="rst-current-version" style="margin-bottom:1mm;">
<span class="fa fa-book"> Python Optimal Transport</span>
<hr style="margin-bottom:1.5mm;margin-top:5mm;">
<!-- versions
<span class="fa fa-caret-down"></span>-->
<span class="rst-current-version" style="display: inline-block;padding:
0px;color:#fcfcfcab;float:left;font-size: 100%;">
Versions:
<a href="https://pythonot.github.io/"
style="padding: 3px;color:#fcfcfc;font-size: 100%;">Release</a>
<a href="https://pythonot.github.io/master"
style="padding: 3px;color:#fcfcfc;font-size: 100%;">Development</a>
<a href="https://github.com/PythonOT/POT"
style="padding: 3px;color:#fcfcfc;font-size: 100%;">Code</a>
</span>
</span>
<!--
<div class="rst-other-versions">
<div class="injected">
<dl>
<dt>Versions</dt>
<dd><a href="https://pythonot.github.io/">Release</a></dd>
<dd><a href="https://pythonot.github.io/master">Development</a></dd>
<dt><a href="https://github.com/PythonOT/POT">Code on Github</a></dt>
</dl>
<hr>
</div>
</div>-->
</div><script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>