Files
cristallina_analysis_package/docs/_build/html/contributing.html
2026-02-03 11:06:33 +01:00

357 lines
26 KiB
HTML
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<title>TODO &#8212; cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="License" href="license.html" />
<link rel="prev" title="cristallina" href="readme.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="todo">
<h1>TODO<a class="headerlink" href="#todo" title="Permalink to this heading"></a></h1>
<p>This is a general guide to contribute to python based projects and does not yet contain any <code class="docutils literal notranslate"><span class="pre">cristallina</span></code> specific information.</p>
</section>
<section id="contributing">
<h1>Contributing<a class="headerlink" href="#contributing" title="Permalink to this heading"></a></h1>
<p>Welcome to <code class="docutils literal notranslate"><span class="pre">cristallina</span></code> contributors guide.</p>
<p>This document focuses on getting any potential contributor familiarized
with the development processes, but <a class="reference external" href="https://opensource.guide/how-to-contribute">other kinds of contributions</a> are also
appreciated.</p>
<p>If you are new to using <a class="reference external" href="https://git-scm.com">git</a> or have never collaborated in a project previously,
please have a look at <a class="reference external" href="https://www.contribution-guide.org/">contribution-guide.org</a>. Other resources are also
listed in the excellent <a class="reference external" href="https://github.com/FreeCodeCamp/how-to-contribute-to-open-source">guide created by FreeCodeCamp</a> <a class="footnote-reference brackets" href="#contrib1" id="id4" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>.</p>
<p>Please notice, all users and contributors are expected to be <strong>open,
considerate, reasonable, and respectful</strong>. When in doubt, <a class="reference external" href="https://www.python.org/psf/conduct/">Python Software
Foundations Code of Conduct</a> is a good reference in terms of behavior
guidelines.</p>
<section id="issue-reports">
<h2>Issue Reports<a class="headerlink" href="#issue-reports" title="Permalink to this heading"></a></h2>
<p>If you experience bugs or general issues with <code class="docutils literal notranslate"><span class="pre">cristallina</span></code>, please have a look
on the <a class="reference external" href="https://github.com/&lt;USERNAME&gt;/cristallina/issues">issue tracker</a>. If you dont see anything useful there, please feel
free to fire an issue report.</p>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>Please dont forget to include the closed issues in your search.
Sometimes a solution was already reported, and the problem is considered
<strong>solved</strong>.</p>
</div>
<p>New issue reports should include information about your programming environment
(e.g., operating system, Python version) and steps to reproduce the problem.
Please try also to simplify the reproduction steps to a very minimal example
that still illustrates the problem you are facing. By removing other factors,
you help us to identify the root cause of the issue.</p>
</section>
<section id="documentation-improvements">
<h2>Documentation Improvements<a class="headerlink" href="#documentation-improvements" title="Permalink to this heading"></a></h2>
<p>You can help improve <code class="docutils literal notranslate"><span class="pre">cristallina</span></code> docs by making them more readable and coherent, or
by adding missing information and correcting mistakes.</p>
<p><code class="docutils literal notranslate"><span class="pre">cristallina</span></code> documentation uses <a class="reference external" href="https://www.sphinx-doc.org/en/master/">Sphinx</a> as its main documentation compiler.
This means that the docs are kept in the same repository as the project code, and
that any documentation update is done in the same way was a code contribution.</p>
<p>When working on documentation changes in your local machine, you can
compile them using <a class="reference external" href="https://tox.wiki/en/stable/"><code class="docutils literal notranslate"><span class="pre">tox</span></code></a>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">tox</span> <span class="o">-</span><span class="n">e</span> <span class="n">docs</span>
</pre></div>
</div>
<p>and use Pythons built-in web server for a preview in your web browser
(<code class="docutils literal notranslate"><span class="pre">http://localhost:8000</span></code>):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">http</span><span class="o">.</span><span class="n">server</span> <span class="o">--</span><span class="n">directory</span> <span class="s1">&#39;docs/_build/html&#39;</span>
</pre></div>
</div>
</section>
<section id="code-contributions">
<h2>Code Contributions<a class="headerlink" href="#code-contributions" title="Permalink to this heading"></a></h2>
<section id="submit-an-issue">
<h3>Submit an issue<a class="headerlink" href="#submit-an-issue" title="Permalink to this heading"></a></h3>
<p>Before you work on any non-trivial code contribution its best to first create
a report in the <a class="reference external" href="https://github.com/&lt;USERNAME&gt;/cristallina/issues">issue tracker</a> to start a discussion on the subject.
This often provides additional considerations and avoids unnecessary work.</p>
</section>
<section id="create-an-environment">
<h3>Create an environment<a class="headerlink" href="#create-an-environment" title="Permalink to this heading"></a></h3>
<p>Before you start coding, we recommend creating an isolated <a class="reference external" href="https://realpython.com/python-virtual-environments-a-primer/">virtual
environment</a> to avoid any problems with your installed Python packages.
This can easily be done via either <a class="reference external" href="https://virtualenv.pypa.io/en/stable/"><code class="docutils literal notranslate"><span class="pre">virtualenv</span></code></a>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">virtualenv</span> <span class="o">&lt;</span><span class="n">PATH</span> <span class="n">TO</span> <span class="n">VENV</span><span class="o">&gt;</span>
<span class="n">source</span> <span class="o">&lt;</span><span class="n">PATH</span> <span class="n">TO</span> <span class="n">VENV</span><span class="o">&gt;/</span><span class="nb">bin</span><span class="o">/</span><span class="n">activate</span>
</pre></div>
</div>
<p>or <a class="reference external" href="https://docs.conda.io/en/latest/miniconda.html">Miniconda</a>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">conda</span> <span class="n">create</span> <span class="o">-</span><span class="n">n</span> <span class="n">cristallina</span> <span class="n">python</span><span class="o">=</span><span class="mi">3</span> <span class="n">six</span> <span class="n">virtualenv</span> <span class="n">pytest</span> <span class="n">pytest</span><span class="o">-</span><span class="n">cov</span>
<span class="n">conda</span> <span class="n">activate</span> <span class="n">cristallina</span>
</pre></div>
</div>
</section>
<section id="clone-the-repository">
<h3>Clone the repository<a class="headerlink" href="#clone-the-repository" title="Permalink to this heading"></a></h3>
<ol class="arabic">
<li><p>Create an user account on GitHub if you do not already have one.</p></li>
<li><p>Fork the project <a class="reference external" href="https://github.com/&lt;USERNAME&gt;/cristallina">repository</a>: click on the <em>Fork</em> button near the top of the
page. This creates a copy of the code under your account on GitHub.</p></li>
<li><p>Clone this copy to your local disk:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">clone</span> <span class="n">git</span><span class="nd">@github</span><span class="o">.</span><span class="n">com</span><span class="p">:</span><span class="n">YourLogin</span><span class="o">/</span><span class="n">cristallina</span><span class="o">.</span><span class="n">git</span>
<span class="n">cd</span> <span class="n">cristallina</span>
</pre></div>
</div>
</li>
<li><p>You should run:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="o">-</span><span class="n">U</span> <span class="n">pip</span> <span class="n">setuptools</span> <span class="o">-</span><span class="n">e</span> <span class="o">.</span>
</pre></div>
</div>
<p>to be able to import the package under development in the Python REPL.</p>
</li>
<li><p>Install <a class="reference external" href="https://pre-commit.com/"><code class="docutils literal notranslate"><span class="pre">pre-commit</span></code></a>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="n">pre</span><span class="o">-</span><span class="n">commit</span>
<span class="n">pre</span><span class="o">-</span><span class="n">commit</span> <span class="n">install</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">cristallina</span></code> comes with a lot of hooks configured to automatically help the
developer to check the code being written.</p>
</li>
</ol>
</section>
<section id="implement-your-changes">
<h3>Implement your changes<a class="headerlink" href="#implement-your-changes" title="Permalink to this heading"></a></h3>
<ol class="arabic">
<li><p>Create a branch to hold your changes:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">checkout</span> <span class="o">-</span><span class="n">b</span> <span class="n">my</span><span class="o">-</span><span class="n">feature</span>
</pre></div>
</div>
<p>and start making changes. Never work on the main branch!</p>
</li>
<li><p>Start your work on this branch. Dont forget to add <a class="reference external" href="https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html">docstrings</a> to new
functions, modules and classes, especially if they are part of public APIs.</p></li>
<li><p>Add yourself to the list of contributors in <code class="docutils literal notranslate"><span class="pre">AUTHORS.rst</span></code>.</p></li>
<li><p>When youre done editing, do:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">add</span> <span class="o">&lt;</span><span class="n">MODIFIED</span> <span class="n">FILES</span><span class="o">&gt;</span>
<span class="n">git</span> <span class="n">commit</span>
</pre></div>
</div>
<p>to record your changes in <a class="reference external" href="https://git-scm.com">git</a>.</p>
<p>Please make sure to see the validation messages from <a class="reference external" href="https://pre-commit.com/"><code class="docutils literal notranslate"><span class="pre">pre-commit</span></code></a> and fix
any eventual issues.
This should automatically use <a class="reference external" href="https://flake8.pycqa.org/en/stable/">flake8</a>/<a class="reference external" href="https://pypi.org/project/black/">black</a> to check/fix the code style
in a way that is compatible with the project.</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>Dont forget to add unit tests and documentation in case your
contribution adds an additional feature and is not just a bugfix.</p>
<p>Moreover, writing a <a class="reference external" href="https://chris.beams.io/posts/git-commit">descriptive commit message</a> is highly recommended.
In case of doubt, you can check the commit history with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">log</span> <span class="o">--</span><span class="n">graph</span> <span class="o">--</span><span class="n">decorate</span> <span class="o">--</span><span class="n">pretty</span><span class="o">=</span><span class="n">oneline</span> <span class="o">--</span><span class="n">abbrev</span><span class="o">-</span><span class="n">commit</span> <span class="o">--</span><span class="nb">all</span>
</pre></div>
</div>
<p>to look for recurring communication patterns.</p>
</div>
</li>
<li><p>Please check that your changes dont break any unit tests with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">tox</span>
</pre></div>
</div>
<p>(after having installed <a class="reference external" href="https://tox.wiki/en/stable/"><code class="docutils literal notranslate"><span class="pre">tox</span></code></a> with <code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">tox</span></code> or <code class="docutils literal notranslate"><span class="pre">pipx</span></code>).</p>
<p>You can also use <a class="reference external" href="https://tox.wiki/en/stable/"><code class="docutils literal notranslate"><span class="pre">tox</span></code></a> to run several other pre-configured tasks in the
repository. Try <code class="docutils literal notranslate"><span class="pre">tox</span> <span class="pre">-av</span></code> to see a list of the available checks.</p>
</li>
</ol>
</section>
<section id="submit-your-contribution">
<h3>Submit your contribution<a class="headerlink" href="#submit-your-contribution" title="Permalink to this heading"></a></h3>
<ol class="arabic">
<li><p>If everything works fine, push your local branch to GitHub with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">push</span> <span class="o">-</span><span class="n">u</span> <span class="n">origin</span> <span class="n">my</span><span class="o">-</span><span class="n">feature</span>
</pre></div>
</div>
</li>
<li><p>Go to the web page of your fork and click “Create pull request”
to send your changes for review.</p>
</li>
</ol>
</section>
<section id="troubleshooting">
<h3>Troubleshooting<a class="headerlink" href="#troubleshooting" title="Permalink to this heading"></a></h3>
<p>The following tips can be used when facing problems to build or test the
package:</p>
<ol class="arabic">
<li><p>Make sure to fetch all the tags from the upstream <a class="reference external" href="https://github.com/&lt;USERNAME&gt;/cristallina">repository</a>.
The command <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">describe</span> <span class="pre">--abbrev=0</span> <span class="pre">--tags</span></code> should return the version you
are expecting. If you are trying to run CI scripts in a fork repository,
make sure to push all the tags.
You can also try to remove all the egg files or the complete egg folder, i.e.,
<code class="docutils literal notranslate"><span class="pre">.eggs</span></code>, as well as the <code class="docutils literal notranslate"><span class="pre">*.egg-info</span></code> folders in the <code class="docutils literal notranslate"><span class="pre">src</span></code> folder or
potentially in the root of your project.</p></li>
<li><p>Sometimes <a class="reference external" href="https://tox.wiki/en/stable/"><code class="docutils literal notranslate"><span class="pre">tox</span></code></a> misses out when new dependencies are added, especially to
<code class="docutils literal notranslate"><span class="pre">setup.cfg</span></code> and <code class="docutils literal notranslate"><span class="pre">docs/requirements.txt</span></code>. If you find any problems with
missing dependencies when running a command with <a class="reference external" href="https://tox.wiki/en/stable/"><code class="docutils literal notranslate"><span class="pre">tox</span></code></a>, try to recreate the
<code class="docutils literal notranslate"><span class="pre">tox</span></code> environment using the <code class="docutils literal notranslate"><span class="pre">-r</span></code> flag. For example, instead of:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">tox</span> <span class="o">-</span><span class="n">e</span> <span class="n">docs</span>
</pre></div>
</div>
<p>Try running:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">tox</span> <span class="o">-</span><span class="n">r</span> <span class="o">-</span><span class="n">e</span> <span class="n">docs</span>
</pre></div>
</div>
</li>
<li><p>Make sure to have a reliable <a class="reference external" href="https://tox.wiki/en/stable/"><code class="docutils literal notranslate"><span class="pre">tox</span></code></a> installation that uses the correct
Python version (e.g., 3.7+). When in doubt you can run:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">tox</span> <span class="o">--</span><span class="n">version</span>
<span class="c1"># OR</span>
<span class="n">which</span> <span class="n">tox</span>
</pre></div>
</div>
<p>If you have trouble and are seeing weird errors upon running <a class="reference external" href="https://tox.wiki/en/stable/"><code class="docutils literal notranslate"><span class="pre">tox</span></code></a>, you can
also try to create a dedicated <a class="reference external" href="https://realpython.com/python-virtual-environments-a-primer/">virtual environment</a> with a <a class="reference external" href="https://tox.wiki/en/stable/"><code class="docutils literal notranslate"><span class="pre">tox</span></code></a> binary
freshly installed. For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">virtualenv</span> <span class="o">.</span><span class="n">venv</span>
<span class="n">source</span> <span class="o">.</span><span class="n">venv</span><span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="n">activate</span>
<span class="o">.</span><span class="n">venv</span><span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="n">pip</span> <span class="n">install</span> <span class="n">tox</span>
<span class="o">.</span><span class="n">venv</span><span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="n">tox</span> <span class="o">-</span><span class="n">e</span> <span class="nb">all</span>
</pre></div>
</div>
</li>
<li><p><a class="reference external" href="https://docs.pytest.org/en/stable/how-to/failures.html#using-python-library-pdb-with-pytest">Pytest can drop you</a> in an interactive session in the case an error occurs.
In order to do that you need to pass a <code class="docutils literal notranslate"><span class="pre">--pdb</span></code> option (for example by
running <code class="docutils literal notranslate"><span class="pre">tox</span> <span class="pre">--</span> <span class="pre">-k</span> <span class="pre">&lt;NAME</span> <span class="pre">OF</span> <span class="pre">THE</span> <span class="pre">FALLING</span> <span class="pre">TEST&gt;</span> <span class="pre">--pdb</span></code>).
You can also setup breakpoints manually instead of using the <code class="docutils literal notranslate"><span class="pre">--pdb</span></code> option.</p></li>
</ol>
</section>
</section>
<section id="maintainer-tasks">
<h2>Maintainer tasks<a class="headerlink" href="#maintainer-tasks" title="Permalink to this heading"></a></h2>
<section id="releases">
<h3>Releases<a class="headerlink" href="#releases" title="Permalink to this heading"></a></h3>
<p>If you are part of the group of maintainers and have correct user permissions
on <a class="reference external" href="https://pypi.org/">PyPI</a>, the following steps can be used to release a new version for
<code class="docutils literal notranslate"><span class="pre">cristallina</span></code>:</p>
<ol class="arabic simple">
<li><p>Make sure all unit tests are successful.</p></li>
<li><p>Tag the current commit on the main branch with a release tag, e.g., <code class="docutils literal notranslate"><span class="pre">v1.2.3</span></code>.</p></li>
<li><p>Push the new tag to the upstream <a class="reference external" href="https://github.com/&lt;USERNAME&gt;/cristallina">repository</a>, e.g., <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">push</span> <span class="pre">upstream</span> <span class="pre">v1.2.3</span></code></p></li>
<li><p>Clean up the <code class="docutils literal notranslate"><span class="pre">dist</span></code> and <code class="docutils literal notranslate"><span class="pre">build</span></code> folders with <code class="docutils literal notranslate"><span class="pre">tox</span> <span class="pre">-e</span> <span class="pre">clean</span></code>
(or <code class="docutils literal notranslate"><span class="pre">rm</span> <span class="pre">-rf</span> <span class="pre">dist</span> <span class="pre">build</span></code>)
to avoid confusion with old builds and Sphinx docs.</p></li>
<li><p>Run <code class="docutils literal notranslate"><span class="pre">tox</span> <span class="pre">-e</span> <span class="pre">build</span></code> and check that the files in <code class="docutils literal notranslate"><span class="pre">dist</span></code> have
the correct version (no <code class="docutils literal notranslate"><span class="pre">.dirty</span></code> or <a class="reference external" href="https://git-scm.com">git</a> hash) according to the <a class="reference external" href="https://git-scm.com">git</a> tag.
Also check the sizes of the distributions, if they are too big (e.g., &gt;
500KB), unwanted clutter may have been accidentally included.</p></li>
<li><p>Run <code class="docutils literal notranslate"><span class="pre">tox</span> <span class="pre">-e</span> <span class="pre">publish</span> <span class="pre">--</span> <span class="pre">--repository</span> <span class="pre">pypi</span></code> and check that everything was
uploaded to <a class="reference external" href="https://pypi.org/">PyPI</a> correctly.</p></li>
</ol>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="contrib1" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id4">1</a><span class="fn-bracket">]</span></span>
<p>Even though, these resources focus on open source projects and
communities, the general ideas behind collaborating with other developers
to collectively create software are general and can be applied to all sorts
of environments, including private companies and proprietary code bases.</p>
</aside>
</aside>
</section>
</section>
</section>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">cristallina</a></h1>
<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="readme.html">Overview</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">TODO</a></li>
<li class="toctree-l1"><a class="reference internal" href="#contributing">Contributing</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#issue-reports">Issue Reports</a></li>
<li class="toctree-l2"><a class="reference internal" href="#documentation-improvements">Documentation Improvements</a></li>
<li class="toctree-l2"><a class="reference internal" href="#code-contributions">Code Contributions</a></li>
<li class="toctree-l2"><a class="reference internal" href="#maintainer-tasks">Maintainer tasks</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="license.html">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="authors.html">Authors</a></li>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a></li>
<li class="toctree-l1"><a class="reference internal" href="api/modules.html">Module Reference</a></li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="readme.html" title="previous chapter">cristallina</a></li>
<li>Next: <a href="license.html" title="next chapter">License</a></li>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2023, Alexander Steppke.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
<a href="_sources/contributing.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>