quickstart.rst 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. .. _devquickstart:
  2. ======================
  3. Development Quickstart
  4. ======================
  5. .. sidebar:: :ref:`makefile`
  6. For additional developer purpose there are :ref:`makefile`.
  7. This quickstart guide gets your environment set up with searx. Furthermore, it
  8. gives a short introduction to the ``manage.sh`` script.
  9. How to setup your development environment
  10. =========================================
  11. .. sidebar:: :ref:`make pyenv <make pyenv>`
  12. Alternatively use the :ref:`make pyenv`.
  13. First, clone the source code of searx to the desired folder. In this case the
  14. source is cloned to ``~/myprojects/searx``. Then create and activate the
  15. searx-ve virtualenv and install the required packages using ``manage.sh``.
  16. .. code:: sh
  17. cd ~/myprojects
  18. git clone https://github.com/searx/searx.git
  19. cd searx
  20. python3 -m venv searx-ve
  21. . ./searx-ve/bin/activate
  22. ./manage.sh update_dev_packages
  23. How to run tests
  24. ================
  25. .. sidebar:: :ref:`make test.unit <make test>`
  26. Alternatively use the ``test.pep8``, ``test.unit``, ``test.robot`` targets.
  27. Tests can be run using the ``manage.sh`` script. Following tests and checks are
  28. available:
  29. - Unit tests
  30. - Selenium tests
  31. - PEP8 validation
  32. - Unit test coverage check
  33. For example unit tests are run with the command below:
  34. .. code:: sh
  35. ./manage.sh unit_tests
  36. For further test options, please consult the help of the ``manage.sh`` script or
  37. read :ref:`make test`.
  38. How to compile styles and javascript
  39. ====================================
  40. .. _less: http://lesscss.org/
  41. .. _NodeJS: https://nodejs.org
  42. How to build styles
  43. -------------------
  44. Less_ is required to build the styles of searx. Less_ can be installed using
  45. either NodeJS_ or Apt.
  46. .. code:: sh
  47. sudo -H apt-get install nodejs
  48. sudo -H npm install -g less
  49. OR
  50. .. code:: sh
  51. sudo -H apt-get install node-less
  52. After satisfying the requirements styles can be build using ``manage.sh``
  53. .. code:: sh
  54. ./manage.sh styles
  55. How to build the source of the themes
  56. =====================================
  57. .. _grunt: https://gruntjs.com/
  58. Grunt_ must be installed in order to build the javascript sources. It depends on
  59. NodeJS, so first Node has to be installed.
  60. .. code:: sh
  61. sudo -H apt-get install nodejs
  62. make node.env
  63. After installing grunt, the files can be built using the following command:
  64. .. code:: sh
  65. make themes
  66. Tips for debugging/development
  67. ==============================
  68. .. sidebar:: :ref:`make run`
  69. Makefile target ``run`` already enables debug option for your developer
  70. session / see :ref:`make run`.
  71. Turn on debug logging
  72. Whether you are working on a new engine or trying to eliminate a bug, it is
  73. always a good idea to turn on debug logging. When debug logging is enabled a
  74. stack trace appears, instead of the cryptic ``Internal Server Error``
  75. message. It can be turned on by setting ``debug: False`` to ``debug: True`` in
  76. :origin:`settings.yml <searx/settings.yml>`.
  77. .. sidebar:: :ref:`make test`
  78. Alternatively use the :ref:`make test` targets.
  79. Run ``./manage.sh tests`` before creating a PR.
  80. Failing build on Travis is common because of PEP8 checks. So a new commit
  81. must be created containing these format fixes. This phase can be skipped if
  82. ``./manage.sh tests`` is run locally before creating a PR.