You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
searxng/dev/contribution_guide.html

295 lines
18 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>How to contribute &#8212; SearXNG Documentation (2023.1.23+522ba9a1)</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/searxng.css" />
<link rel="stylesheet" type="text/css" href="../_static/tabs.css" />
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/_sphinx_javascript_frameworks_compat.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="Engine Overview" href="engine_overview.html" />
<link rel="prev" title="Development Quickstart" href="quickstart.html" />
</head><body>
<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="engine_overview.html" title="Engine Overview"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="quickstart.html" title="Development Quickstart"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">SearXNG Documentation (2023.1.23+522ba9a1)</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Developer documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">How to contribute</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="how-to-contribute">
<span id="id1"></span><h1>How to contribute<a class="headerlink" href="#how-to-contribute" title="Permalink to this heading"></a></h1>
<nav class="contents local" id="contents">
<p class="topic-title">Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#prime-directives-privacy-hackability" id="id3">Prime directives: Privacy, Hackability</a></p>
<ul>
<li><p><a class="reference internal" href="#privacy-by-design" id="id4">Privacy-by-design</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#code" id="id5">Code</a></p></li>
<li><p><a class="reference internal" href="#translation" id="id6">Translation</a></p></li>
<li><p><a class="reference internal" href="#documentation" id="id7">Documentation</a></p>
<ul>
<li><p><a class="reference internal" href="#live-build" id="id8">live build</a></p></li>
<li><p><a class="reference internal" href="#deploy-on-github-io" id="id9">deploy on github.io</a></p></li>
</ul>
</li>
</ul>
</nav>
<section id="prime-directives-privacy-hackability">
<h2><a class="toc-backref" href="#id3" role="doc-backlink">Prime directives: Privacy, Hackability</a><a class="headerlink" href="#prime-directives-privacy-hackability" title="Permalink to this heading"></a></h2>
<p>SearXNG has two prime directives, <strong>privacy-by-design and hackability</strong> . The
hackability comes in three levels:</p>
<ul class="simple">
<li><p>support of search engines</p></li>
<li><p>plugins to alter search behaviour</p></li>
<li><p>hacking SearXNG itself</p></li>
</ul>
<p>Note the lack of “world domination” among the directives. SearXNG has no
intention of wide mass-adoption, rounded corners, etc. The prime directive
“privacy” deserves a separate chapter, as its quite uncommon unfortunately.</p>
<section id="privacy-by-design">
<h3><a class="toc-backref" href="#id4" role="doc-backlink">Privacy-by-design</a><a class="headerlink" href="#privacy-by-design" title="Permalink to this heading"></a></h3>
<p>SearXNG was born out of the need for a <strong>privacy-respecting</strong> search tool which
can be extended easily to maximize both, its search and its privacy protecting
capabilities.</p>
<p>A few widely used features work differently or turned off by default or not
implemented at all <strong>as a consequence of privacy-by-design</strong>.</p>
<p>If a feature reduces the privacy preserving aspects of searx, it should be
switched off by default or should not implemented at all. There are plenty of
search engines already providing such features. If a feature reduces the
protection of searx, users must be informed about the effect of choosing to
enable it. Features that protect privacy but differ from the expectations of
the user should also be explained.</p>
<p>Also, if you think that something works weird with searx, its might be because
of the tool you use is designed in a way to interfere with the privacy respect.
Submitting a bugreport to the vendor of the tool that misbehaves might be a good
feedback to reconsider the disrespect to its customers (e.g. <code class="docutils literal notranslate"><span class="pre">GET</span></code> vs <code class="docutils literal notranslate"><span class="pre">POST</span></code>
requests in various browsers).</p>
<p>Remember the other prime directive of SearXNG is to be hackable, so if the above
privacy concerns do not fancy you, simply fork it.</p>
<blockquote>
<div><p><em>Happy hacking.</em></p>
</div></blockquote>
</section>
</section>
<section id="code">
<h2><a class="toc-backref" href="#id5" role="doc-backlink">Code</a><a class="headerlink" href="#code" title="Permalink to this heading"></a></h2>
<aside class="sidebar">
<p class="sidebar-title">Create good commits!</p>
<ul class="simple">
<li><p><a class="reference external" href="https://wiki.openstack.org/wiki/GitCommitMessages#Structural_split_of_changes">Structural split of changes</a></p></li>
<li><p><a class="reference external" href="https://www.conventionalcommits.org/">Conventional Commits</a></p></li>
<li><p><a class="reference external" href="https://wiki.openstack.org/wiki/GitCommitMessages">Git Commit Good Practice</a></p></li>
<li><p>some like to use: <a class="reference external" href="https://gitmoji.carloscuesta.me/">gitmoji</a></p></li>
<li><p>not yet active: <a class="reference external" href="https://github.com/zeke/semantic-pull-requests">Semantic PR</a></p></li>
</ul>
</aside>
<p>In order to submit a patch, please follow the steps below:</p>
<ul>
<li><p>Follow coding conventions.</p>
<ul class="simple">
<li><p><a class="reference external" href="https://www.python.org/dev/peps/pep-0008/">PEP8</a> standards apply, except the convention of line length</p></li>
<li><p>Maximum line length is 120 characters</p></li>
</ul>
</li>
<li><p>The cardinal rule for creating good commits is to ensure there is only one
<em>logical change</em> per commit / read <a class="reference external" href="https://wiki.openstack.org/wiki/GitCommitMessages#Structural_split_of_changes">Structural split of changes</a></p></li>
<li><p>Check if your code breaks existing tests. If so, update the tests or fix your
code.</p></li>
<li><p>If your code can be unit-tested, add unit tests.</p></li>
<li><p>Add yourself to the <a class="reference external" href="https://github.com/searxng/searxng/blob/master/AUTHORS.rst">git://AUTHORS.rst</a> file.</p></li>
<li><p>Choose meaningful commit messages, read <a class="reference external" href="https://www.conventionalcommits.org/">Conventional Commits</a></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;</span><span class="nb">type</span><span class="o">&gt;</span><span class="p">[</span><span class="n">optional</span> <span class="n">scope</span><span class="p">]:</span> <span class="o">&lt;</span><span class="n">description</span><span class="o">&gt;</span>
<span class="p">[</span><span class="n">optional</span> <span class="n">body</span><span class="p">]</span>
<span class="p">[</span><span class="n">optional</span> <span class="n">footer</span><span class="p">(</span><span class="n">s</span><span class="p">)]</span>
</pre></div>
</div>
</li>
<li><p>Create a pull request.</p></li>
</ul>
<p>For more help on getting started with SearXNG development, see <a class="reference internal" href="quickstart.html#devquickstart"><span class="std std-ref">Development Quickstart</span></a>.</p>
</section>
<section id="translation">
<h2><a class="toc-backref" href="#id6" role="doc-backlink">Translation</a><a class="headerlink" href="#translation" title="Permalink to this heading"></a></h2>
<p>Translation currently takes place on <a class="reference internal" href="translation.html#translation"><span class="std std-ref">weblate</span></a>.</p>
</section>
<section id="documentation">
<span id="contrib-docs"></span><h2><a class="toc-backref" href="#id7" role="doc-backlink">Documentation</a><a class="headerlink" href="#documentation" title="Permalink to this heading"></a></h2>
<aside class="sidebar">
<p class="sidebar-title">The reST sources</p>
<p>has been moved from <code class="docutils literal notranslate"><span class="pre">gh-branch</span></code> into <code class="docutils literal notranslate"><span class="pre">master</span></code> (<a class="reference external" href="https://github.com/searxng/searxng/blob/master/docs">git://docs</a>).</p>
</aside>
<p>The documentation is built using <a class="reference external" href="https://www.sphinx-doc.org">Sphinx</a>. So in order to be able to generate
the required files, you have to install it on your system. Much easier, use
our <a class="reference internal" href="makefile.html#makefile"><span class="std std-ref">Makefile</span></a>.</p>
<p>Here is an example which makes a complete rebuild:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>make<span class="w"> </span>docs.clean<span class="w"> </span>docs.html
...
The<span class="w"> </span>HTML<span class="w"> </span>pages<span class="w"> </span>are<span class="w"> </span><span class="k">in</span><span class="w"> </span>dist/docs.
</pre></div>
</div>
<section id="live-build">
<span id="make-docs-live"></span><h3><a class="toc-backref" href="#id8" role="doc-backlink">live build</a><a class="headerlink" href="#live-build" title="Permalink to this heading"></a></h3>
<aside class="sidebar">
<p class="sidebar-title">docs.clean</p>
<p>It is recommended to assert a complete rebuild before deploying (use
<code class="docutils literal notranslate"><span class="pre">docs.clean</span></code>).</p>
</aside>
<p>Live build is like WYSIWYG. If you want to edit the documentation, its
recommended to use. The Makefile target <code class="docutils literal notranslate"><span class="pre">docs.live</span></code> builds the docs, opens
URL in your favorite browser and rebuilds every time a reST file has been
changed.</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>make<span class="w"> </span>docs.live
...
The<span class="w"> </span>HTML<span class="w"> </span>pages<span class="w"> </span>are<span class="w"> </span><span class="k">in</span><span class="w"> </span>dist/docs.
...<span class="w"> </span>Serving<span class="w"> </span>on<span class="w"> </span>http://0.0.0.0:8000
...<span class="w"> </span>Start<span class="w"> </span>watching<span class="w"> </span>changes
</pre></div>
</div>
<p>Live builds are implemented by <a class="reference external" href="https://github.com/executablebooks/sphinx-autobuild/blob/master/README.md">sphinx-autobuild</a>. Use environment
<code class="docutils literal notranslate"><span class="pre">$(SPHINXOPTS)</span></code> to pass arguments to the <a class="reference external" href="https://github.com/executablebooks/sphinx-autobuild/blob/master/README.md">sphinx-autobuild</a> command. Except
option <code class="docutils literal notranslate"><span class="pre">--host</span></code> (which is always set to <code class="docutils literal notranslate"><span class="pre">0.0.0.0</span></code>) you can pass any
argument. E.g to find and use a free port, use:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span><span class="nv">SPHINXOPTS</span><span class="o">=</span><span class="s2">&quot;--port 0&quot;</span><span class="w"> </span>make<span class="w"> </span>docs.live
...
...<span class="w"> </span>Serving<span class="w"> </span>on<span class="w"> </span>http://0.0.0.0:50593
...
</pre></div>
</div>
</section>
<section id="deploy-on-github-io">
<span id="id2"></span><h3><a class="toc-backref" href="#id9" role="doc-backlink">deploy on github.io</a><a class="headerlink" href="#deploy-on-github-io" title="Permalink to this heading"></a></h3>
<p>To deploy documentation at <a class="reference external" href="https://docs.searxng.org//.">github.io</a> use Makefile target <a class="reference internal" href="makefile.html#make-docs-gh-pages"><span class="std std-ref">make docs.gh-pages</span></a>, which builds the documentation and runs all the needed git add,
commit and push:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>make<span class="w"> </span>docs.clean<span class="w"> </span>docs.gh-pages
</pre></div>
</div>
</section>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<span id="sidebar-top"></span>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/searxng-wordmark.svg" alt="Logo"/>
</a></p>
<h3><a href="../index.html">Table of Contents</a></h3>
<p class="caption" role="heading"><span class="caption-text">Contents</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../user/index.html">User information</a></li>
<li class="toctree-l1"><a class="reference internal" href="../own-instance.html">Why use a private instance?</a></li>
<li class="toctree-l1"><a class="reference internal" href="../admin/index.html">Administrator documentation</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Developer documentation</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="quickstart.html">Development Quickstart</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">How to contribute</a></li>
<li class="toctree-l2"><a class="reference internal" href="engine_overview.html">Engine Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="offline_engines.html">Offline Engines</a></li>
<li class="toctree-l2"><a class="reference internal" href="search_api.html">Search API</a></li>
<li class="toctree-l2"><a class="reference internal" href="plugins.html">Plugins</a></li>
<li class="toctree-l2"><a class="reference internal" href="translation.html">Translation</a></li>
<li class="toctree-l2"><a class="reference internal" href="lxcdev.html">Developing in Linux Containers</a></li>
<li class="toctree-l2"><a class="reference internal" href="makefile.html">Makefile</a></li>
<li class="toctree-l2"><a class="reference internal" href="reST.html">reST primer</a></li>
<li class="toctree-l2"><a class="reference internal" href="searxng_extra/index.html">Tooling box <code class="docutils literal notranslate"><span class="pre">searxng_extra</span></code></a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../utils/index.html">DevOps tooling box</a></li>
<li class="toctree-l1"><a class="reference internal" href="../src/index.html">Source-Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="../donate.html">Donate to searxng.org</a></li>
</ul>
<h3>Project Links</h3>
<ul>
<li><a href="https://github.com/searxng/searxng/tree/master">Source</a>
<li><a href="https://github.com/searxng/searxng/wiki">Wiki</a>
<li><a href="https://searx.space">Public instances</a>
<li><a href="https://github.com/searxng/searxng/issues">Issue Tracker</a>
</ul><h3>Navigation</h3>
<ul>
<li><a href="../index.html">Overview</a>
<ul>
<li><a href="index.html">Developer documentation</a>
<ul>
<li>Previous: <a href="quickstart.html" title="previous chapter">Development Quickstart</a>
<li>Next: <a href="engine_overview.html" title="next chapter">Engine Overview</a></ul>
</li>
</ul>
</li>
</ul>
<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 role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/dev/contribution_guide.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2021 SearXNG team, 2015-2021 Adam Tauber, Noémi Ványi.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.3.0.
</div>
<script src="../_static/version_warning_offset.js"></script>
</body>
</html>