2016-04-21 13:15:04 +02:00
|
|
|
.. _devquickstart:
|
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
======================
|
2016-02-01 21:28:13 +01:00
|
|
|
Development Quickstart
|
2019-12-12 19:20:56 +01:00
|
|
|
======================
|
2016-02-01 21:28:13 +01:00
|
|
|
|
2019-12-18 16:11:05 +01:00
|
|
|
.. sidebar:: :ref:`makefile`
|
|
|
|
|
|
|
|
For additional developer purpose there are :ref:`makefile`.
|
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
This quickstart guide gets your environment set up with searx. Furthermore, it
|
|
|
|
gives a short introduction to the ``manage.sh`` script.
|
2016-02-01 21:28:13 +01:00
|
|
|
|
|
|
|
How to setup your development environment
|
2019-12-12 19:20:56 +01:00
|
|
|
=========================================
|
2016-02-01 21:28:13 +01:00
|
|
|
|
2019-12-18 16:11:05 +01:00
|
|
|
.. sidebar:: :ref:`make pyenv <make pyenv>`
|
|
|
|
|
|
|
|
Alternatively use the :ref:`make pyenv`.
|
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
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
|
2019-12-18 16:11:05 +01:00
|
|
|
searx-ve virtualenv and install the required packages using ``manage.sh``.
|
2016-02-01 21:28:13 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
cd ~/myprojects
|
2020-09-28 16:44:14 +02:00
|
|
|
git clone https://github.com/searx/searx.git
|
2016-02-01 21:28:13 +01:00
|
|
|
cd searx
|
2020-03-08 18:35:38 +01:00
|
|
|
python3 -m venv searx-ve
|
2016-02-01 21:28:13 +01:00
|
|
|
. ./searx-ve/bin/activate
|
|
|
|
./manage.sh update_dev_packages
|
|
|
|
|
|
|
|
|
|
|
|
How to run tests
|
2019-12-12 19:20:56 +01:00
|
|
|
================
|
2016-02-01 21:28:13 +01:00
|
|
|
|
2019-12-18 16:11:05 +01:00
|
|
|
.. sidebar:: :ref:`make test.unit <make test>`
|
|
|
|
|
|
|
|
Alternatively use the ``test.pep8``, ``test.unit``, ``test.robot`` targets.
|
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
Tests can be run using the ``manage.sh`` script. Following tests and checks are
|
|
|
|
available:
|
2016-02-01 21:28:13 +01:00
|
|
|
|
|
|
|
- Unit tests
|
|
|
|
- Selenium tests
|
|
|
|
- PEP8 validation
|
|
|
|
- Unit test coverage check
|
|
|
|
|
|
|
|
For example unit tests are run with the command below:
|
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
./manage.sh unit_tests
|
2016-02-01 21:28:13 +01:00
|
|
|
|
2019-12-18 16:11:05 +01:00
|
|
|
For further test options, please consult the help of the ``manage.sh`` script or
|
|
|
|
read :ref:`make test`.
|
2016-02-01 21:28:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
How to compile styles and javascript
|
2019-12-12 19:20:56 +01:00
|
|
|
====================================
|
|
|
|
|
2020-12-04 16:50:26 +01:00
|
|
|
.. _less: https://lesscss.org/
|
2019-12-12 19:20:56 +01:00
|
|
|
.. _NodeJS: https://nodejs.org
|
2016-02-01 21:28:13 +01:00
|
|
|
|
|
|
|
How to build styles
|
2019-12-12 19:20:56 +01:00
|
|
|
-------------------
|
2016-02-01 21:28:13 +01:00
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
Less_ is required to build the styles of searx. Less_ can be installed using
|
|
|
|
either NodeJS_ or Apt.
|
2016-02-01 21:28:13 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
sudo -H apt-get install nodejs
|
|
|
|
sudo -H npm install -g less
|
2016-02-01 21:28:13 +01:00
|
|
|
|
|
|
|
OR
|
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
sudo -H apt-get install node-less
|
2016-02-01 21:28:13 +01:00
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
After satisfying the requirements styles can be build using ``manage.sh``
|
2016-02-01 21:28:13 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
./manage.sh styles
|
2016-02-01 21:28:13 +01:00
|
|
|
|
|
|
|
|
2020-03-25 14:09:47 +01:00
|
|
|
How to build the source of the themes
|
|
|
|
=====================================
|
2016-02-01 21:28:13 +01:00
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
.. _grunt: https://gruntjs.com/
|
|
|
|
|
|
|
|
Grunt_ must be installed in order to build the javascript sources. It depends on
|
|
|
|
NodeJS, so first Node has to be installed.
|
2016-02-01 21:28:13 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
sudo -H apt-get install nodejs
|
2020-03-25 16:38:52 +01:00
|
|
|
make node.env
|
2016-02-01 21:28:13 +01:00
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
After installing grunt, the files can be built using the following command:
|
2016-02-01 21:28:13 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
2020-03-25 14:09:47 +01:00
|
|
|
make themes
|
2016-04-21 13:15:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
Tips for debugging/development
|
2019-12-12 19:20:56 +01:00
|
|
|
==============================
|
|
|
|
|
2019-12-18 16:11:05 +01:00
|
|
|
.. sidebar:: :ref:`make run`
|
|
|
|
|
|
|
|
Makefile target ``run`` already enables debug option for your developer
|
|
|
|
session / see :ref:`make run`.
|
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
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
|
|
|
|
:origin:`settings.yml <searx/settings.yml>`.
|
|
|
|
|
2019-12-18 16:11:05 +01:00
|
|
|
.. sidebar:: :ref:`make test`
|
|
|
|
|
|
|
|
Alternatively use the :ref:`make test` targets.
|
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
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.
|