<spanid="makefile"></span><h1>Makefile Targets<aclass="headerlink"href="#makefile-targets"title="Permalink to this headline">¶</a></h1>
<divclass="sidebar">
<pclass="sidebar-title">build environment</p>
<p>Before looking deeper at the targets, first read about <aclass="reference internal"href="#makefile-setup"><spanclass="std std-ref">Setup</span></a>
and <aclass="reference internal"href="#make-pyenv"><spanclass="std std-ref">Python environment</span></a>.</p>
</div>
<p>With the aim to simplify development cycles, started with <aclass="reference external"href="https://github.com/asciimoo/searx/pull/1756">PR 1756</a> a
<codeclass="docutils literal notranslate"><spanclass="pre">Makefile</span></code> based boilerplate was added. If you are not familiar with
Makefiles, we recommend to read <aclass="reference external"href="https://www.gnu.org/software/make/manual/make.html#Introduction">gnu-make</a> introduction.</p>
<p>The usage is simple, just type <codeclass="docutils literal notranslate"><spanclass="pre">make</span><spanclass="pre">{target-name}</span></code> to <em>build</em> a target.
Calling the <codeclass="docutils literal notranslate"><spanclass="pre">help</span></code> target gives a first overview:</p>
<divclass="highlight-none notranslate"><divclass="highlight"><pre><span></span>$ make help
test - run developer tests
docs - build documentation
docs-live - autobuild HTML documentation while editing
run - run developer instance
install - developer install (./local)
uninstall - uninstall (./local)
gh-pages - build docs & deploy on gh-pages branch
<spanid="makefile-setup"></span><h2><aclass="toc-backref"href="#id6">Setup</a><aclass="headerlink"href="#setup"title="Permalink to this headline">¶</a></h2>
<p>The main setup is done in the <aclass="reference external"href="https://github.com/asciimoo/searx/blob/master/Makefile">git://Makefile</a>:</p>
<p>Commit changes in your (local) branch, fork or whatever, but do not push them
upstream / <aclass="reference external"href="https://git-scm.com/docs/git-stash">git stash</a> is your friend.</p>
</div>
<dlclass="field-list simple">
<dtclass="field-odd">GIT_URL</dt>
<ddclass="field-odd"><p>Changes this, to point to your searx fork.</p>
</dd>
<dtclass="field-even">SEARX_URL</dt>
<ddclass="field-even"><p>Changes this, to point to your searx instance.</p>
</dd>
<dtclass="field-odd">DOCS_URL</dt>
<ddclass="field-odd"><p>If you host your own (branded) documentation, change this URL.</p>
</dd>
</dl>
</div>
<divclass="section"id="python-environment">
<spanid="make-pyenv"></span><h2><aclass="toc-backref"href="#id7">Python environment</a><aclass="headerlink"href="#python-environment"title="Permalink to this headline">¶</a></h2>
<p>With Makefile we do no longer need to build up the virualenv manually (as
described in the <aclass="reference internal"href="quickstart.html#devquickstart"><spanclass="std std-ref">Development Quickstart</span></a> guide). Jump into your git working tree
and release a <codeclass="docutils literal notranslate"><spanclass="pre">make</span><spanclass="pre">pyenv</span></code>:</p>
<p>With target <codeclass="docutils literal notranslate"><spanclass="pre">pyenv</span></code> a development environment (aka virtualenv) was build up in
<codeclass="docutils literal notranslate"><spanclass="pre">./local/py3/</span></code>. To make a <em>developer install</em> of searx (<aclass="reference external"href="https://github.com/asciimoo/searx/blob/master/setup.py">git://setup.py</a>)
into this environment, use make target <codeclass="docutils literal notranslate"><spanclass="pre">install</span></code>:</p>
<divclass="highlight-sh notranslate"><divclass="highlight"><pre><span></span>$ make install
<p>You have never to think about intermediate targets like <codeclass="docutils literal notranslate"><spanclass="pre">pyenv</span></code> or
<codeclass="docutils literal notranslate"><spanclass="pre">install</span></code>, the <codeclass="docutils literal notranslate"><spanclass="pre">Makefile</span></code> chains them as requisites. Just run your main
target.</p>
<divclass="sidebar">
<pclass="sidebar-title">drop environment</p>
<p>To get rid of the existing environment before re-build use <aclass="reference internal"href="#make-clean"><spanclass="std std-ref">clean target</span></a> first.</p>
</div>
<p>If you think, something goes wrong with your ./local environment or you change
the <aclass="reference external"href="https://github.com/asciimoo/searx/blob/master/setup.py">git://setup.py</a> file (or the requirements listed in
<aclass="reference external"href="https://github.com/asciimoo/searx/blob/master/requirements-dev.txt">git://requirements-dev.txt</a> and <aclass="reference external"href="https://github.com/asciimoo/searx/blob/master/requirements.txt">git://requirements.txt</a>), you have to call
<spanid="id1"></span><h2><aclass="toc-backref"href="#id8"><codeclass="docutils literal notranslate"><spanclass="pre">make</span><spanclass="pre">run</span></code></a><aclass="headerlink"href="#make-run"title="Permalink to this headline">¶</a></h2>
<p>To get up a running a developer instance simply call <codeclass="docutils literal notranslate"><spanclass="pre">make</span><spanclass="pre">run</span></code>. This enables
<em>debug</em> option in <aclass="reference external"href="https://github.com/asciimoo/searx/blob/master/searx/settings.yml">git://searx/settings.yml</a>, starts a <codeclass="docutils literal notranslate"><spanclass="pre">./searx/webapp.py</span></code>
instance, disables <em>debug</em> option again and opens the URL in your favorite WEB
INFO:werkzeug: * Running on http://127.0.0.1:8888/ <spanclass="o">(</span>Press CTRL+C to quit<spanclass="o">)</span>
...
</pre></div>
</div>
</div>
<divclass="section"id="make-clean">
<spanid="id2"></span><h2><aclass="toc-backref"href="#id9"><codeclass="docutils literal notranslate"><spanclass="pre">make</span><spanclass="pre">clean</span></code></a><aclass="headerlink"href="#make-clean"title="Permalink to this headline">¶</a></h2>
<p>Drop all intermediate files, all builds, but keep sources untouched. Includes
target <codeclass="docutils literal notranslate"><spanclass="pre">pyclean</span></code> which drops ./local environment. Before calling <codeclass="docutils literal notranslate"><spanclass="pre">make</span>
<spanclass="pre">clean</span></code> stop all processes using <aclass="reference internal"href="#make-pyenv"><spanclass="std std-ref">Python environment</span></a>.</p>
<divclass="highlight-sh notranslate"><divclass="highlight"><pre><span></span>$ make clean
<spanid="make-docs"></span><h2><aclass="toc-backref"href="#id10"><codeclass="docutils literal notranslate"><spanclass="pre">make</span><spanclass="pre">docs</span><spanclass="pre">docs-live</span><spanclass="pre">docs-clean</span></code></a><aclass="headerlink"href="#make-docs-docs-live-docs-clean"title="Permalink to this headline">¶</a></h2>
<p>We describe the usage of the <codeclass="docutils literal notranslate"><spanclass="pre">doc*</span></code> targets in the <aclass="reference internal"href="contribution_guide.html#contrib-docs"><spanclass="std std-ref">How to contribute /
Documentation</span></a> section. If you want to edit the documentation
read our <aclass="reference internal"href="contribution_guide.html#make-docs-live"><spanclass="std std-ref">live build</span></a> section. If you are working in your own brand,
adjust your <aclass="reference internal"href="#makefile-setup"><spanclass="std std-ref">Makefile setup</span></a>.</p>
</div>
<divclass="section"id="make-gh-pages">
<spanid="id3"></span><h2><aclass="toc-backref"href="#id11"><codeclass="docutils literal notranslate"><spanclass="pre">make</span><spanclass="pre">gh-pages</span></code></a><aclass="headerlink"href="#make-gh-pages"title="Permalink to this headline">¶</a></h2>
<p>To deploy on github.io first adjust your <aclass="reference internal"href="#makefile-setup"><spanclass="std std-ref">Makefile setup</span></a>. For any further read <aclass="reference internal"href="contribution_guide.html#deploy-on-github-io"><spanclass="std std-ref">deploy on github.io</span></a>.</p>
</div>
<divclass="section"id="make-test">
<spanid="id4"></span><h2><aclass="toc-backref"href="#id12"><codeclass="docutils literal notranslate"><spanclass="pre">make</span><spanclass="pre">test</span></code></a><aclass="headerlink"href="#make-test"title="Permalink to this headline">¶</a></h2>
<p>Runs a series of tests: <codeclass="docutils literal notranslate"><spanclass="pre">test.pep8</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">test.unit</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">test.robot</span></code> and does
additional <aclass="reference internal"href="#make-pylint"><spanclass="std std-ref">pylint checks</span></a>. You can run tests selective,
e.g.:</p>
<divclass="highlight-sh notranslate"><divclass="highlight"><pre><span></span>$ make test.pep8 test.unit
<spanclass="o">[</span>!<spanclass="o">]</span> Running unit tests
</pre></div>
</div>
</div>
<divclass="section"id="make-pylint">
<spanid="id5"></span><h2><aclass="toc-backref"href="#id13"><codeclass="docutils literal notranslate"><spanclass="pre">make</span><spanclass="pre">pylint</span></code></a><aclass="headerlink"href="#make-pylint"title="Permalink to this headline">¶</a></h2>
<p>Before commiting its recommend to do some (more) linting. <aclass="reference external"href="https://www.pylint.org/">Pylint</a> is known as
one of the best source-code, bug and quality checker for the Python programming
language. <aclass="reference external"href="https://www.pylint.org/">Pylint</a> is not yet a quality gate within our searx project (like
<aclass="reference internal"href="#make-test"><spanclass="std std-ref">test.pep8</span></a> it is), but <aclass="reference external"href="https://www.pylint.org/">Pylint</a> can help to improve code
quality anyway. The pylint profile we use at searx project is found in
<p>Code quality is a ongoing process. Don’t try to fix all messages from Pylint,
run Pylint and check if your changed lines are bringing up new messages. If so,
fix it. By this, code quality gets incremental better and if there comes the
day, the linting is balanced out, we might decide to add Pylint as a quality
gate.</p>
</div>
<divclass="section"id="make-pybuild">
<h2><aclass="toc-backref"href="#id14"><codeclass="docutils literal notranslate"><spanclass="pre">make</span><spanclass="pre">pybuild</span></code></a><aclass="headerlink"href="#make-pybuild"title="Permalink to this headline">¶</a></h2>
<p>Build Python packages in <codeclass="docutils literal notranslate"><spanclass="pre">./dist/py</span></code>.</p>
<divclass="highlight-sh notranslate"><divclass="highlight"><pre><span></span>$ make pybuild
...
BUILD pybuild
running sdist
running egg_info
...
$ ls ./dist/py/
searx-0.15.0-py3-none-any.whl searx-0.15.0.tar.gz
</pre></div>
</div>
<p>To upload packages to <aclass="reference external"href="https://pypi.org/">PyPi</a>, there is also a <codeclass="docutils literal notranslate"><spanclass="pre">upload-pypi</span></code> target. It needs
<aclass="reference external"href="https://twine.readthedocs.io/en/latest/">twine</a> to be installed. Since you are not the owner of <aclass="reference external"href="https://pypi.org/project/searx">PyPi: searx</a> you will