searxng/docs/dev/quickstart.rst
Markus Heiser 04ad648105 makefile.python: remove python2 support
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2020-03-08 18:35:38 +01:00

3.3 KiB

Development Quickstart

makefile

For additional developer purpose there are makefile.

This quickstart guide gets your environment set up with searx. Furthermore, it gives a short introduction to the manage.sh script.

How to setup your development environment

make pyenv <make pyenv>

Alternatively use the make pyenv.

First, clone the source code of searx to the desired folder. In this case the source is cloned to ~/myprojects/searx. Then create and activate the searx-ve virtualenv and install the required packages using manage.sh.

cd ~/myprojects
git clone https://github.com/asciimoo/searx.git
cd searx
python3 -m venv searx-ve
. ./searx-ve/bin/activate
./manage.sh update_dev_packages

How to run tests

make test.unit <make test>

Alternatively use the test.pep8, test.unit, test.robot targets.

Tests can be run using the manage.sh script. Following tests and checks are available:

  • Unit tests
  • Selenium tests
  • PEP8 validation
  • Unit test coverage check

For example unit tests are run with the command below:

./manage.sh unit_tests

For further test options, please consult the help of the manage.sh script or read make test.

How to compile styles and javascript

How to build styles

Less is required to build the styles of searx. Less can be installed using either NodeJS or Apt.

sudo -H apt-get install nodejs
sudo -H npm install -g less

OR

sudo -H apt-get install node-less

After satisfying the requirements styles can be build using manage.sh

./manage.sh styles

How to build the source of the oscar theme

Grunt must be installed in order to build the javascript sources. It depends on NodeJS, so first Node has to be installed.

sudo -H apt-get install nodejs
sudo -H npm install -g grunt-cli

After installing grunt, the files can be built using the following command:

./manage.sh grunt_build

Tips for debugging/development

make run

Makefile target run already enables debug option for your developer session / see make run.

Turn on debug logging

Whether you are working on a new engine or trying to eliminate a bug, it is always a good idea to turn on debug logging. When debug logging is enabled a stack trace appears, instead of the cryptic Internal Server Error message. It can be turned on by setting debug: False to debug: True in settings.yml <searx/settings.yml>.

make test

Alternatively use the make test targets.

Run ./manage.sh tests before creating a PR.

Failing build on Travis is common because of PEP8 checks. So a new commit must be created containing these format fixes. This phase can be skipped if ./manage.sh tests is run locally before creating a PR.