on master help sign in
[doc] modify docs to fit to the new build boilerplate

Signed-off-by: Markus Heiser <markus@darmarit.de>

commit34abad95dfbb8811af67f8865592131e547e6e63 authorMarkus Heiser <markus.heiser@darmarit.de> dateSat 27 Feb 2021, 18:31 (6 years ago) parentf55babc
7 files changed+144−152
docs/admin/buildhosts.rst+4−4 docs/admin/installation-docker.rst+1−1 docs/blog/lxcdev-202006.rst+3−3 docs/dev/contribution_guide.rst+11−22 docs/dev/makefile.rst+116−112 docs/dev/reST.rst+6−7 docs/utils/lxc.sh.rst+3−3
docs/admin/buildhosts.rst+4−4
@@ -49,9 +49,9 @@ Build docs
4949 - dvisvgm_
5050
5151Most of the sphinx requirements are installed from :origin:`setup.py` and the
52−docs can be build from scratch with ``make docs``. For better math and image
53−processing additional packages are needed. The XeTeX_ needed not only for PDF
54−creation, its also needed for :ref:`math` when HTML output is build.
52+docs can be build from scratch with ``make docs.html``. For better math and
53+image processing additional packages are needed. The XeTeX_ needed not only for
54+PDF creation, its also needed for :ref:`math` when HTML output is build.
5555
5656To be able to do :ref:`sphinx:math-support` without CDNs, the math are rendered
5757as images (``sphinx.ext.imgmath`` extension).
@@ -64,7 +64,7 @@ to ``imgmath``:
6464 :start-after: # sphinx.ext.imgmath setup
6565 :end-before: # sphinx.ext.imgmath setup END
6666
67−If your docs build (``make docs``) shows warnings like this::
67+If your docs build (``make docs.html``) shows warnings like this::
6868
6969 WARNING: dot(1) not found, for better output quality install \
7070 graphviz from https://www.graphviz.org
docs/admin/installation-docker.rst+1−1
@@ -51,7 +51,7 @@ It's also possible to build searx from the embedded Dockerfile.
5151
5252 git clone https://github.com/searx/searx.git
5353 cd searx
54− make docker
54+ make docker.build
5555
5656
5757Public instance
docs/blog/lxcdev-202006.rst+3−3
@@ -31,7 +31,7 @@ might fail in some aspects we should not overlook.
3131
3232 The environment in which we run all our development processes matters!
3333
34−The :ref:`makefile` and the :ref:`make pyenv` encapsulate a lot for us, but they
34+The :ref:`makefile` and the :ref:`make install` encapsulate a lot for us, but they
3535do not have access to all prerequisites. For example, there may have
3636dependencies on packages that are installed on the developer's desktop, but
3737usually are not preinstalled on a server or client system. Another examples
@@ -356,7 +356,7 @@ daily usage:
356356 .. code:: sh
357357
358358 $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
359− make docs
359+ make docs.html
360360
361361.. _blog-lxcdev-202006 abstract:
362362
@@ -407,7 +407,7 @@ To get remarks from the suite of the archlinux container we can use:
407407 ...
408408 [searx-archlinux] INFO: (eth0) filtron: http://10.174.184.156:4004/ http://10.174.184.156/searx
409409 [searx-archlinux] INFO: (eth0) morty: http://10.174.184.156:3000/
410− [searx-archlinux] INFO: (eth0) docs-live: http://10.174.184.156:8080/
410+ [searx-archlinux] INFO: (eth0) docs.live: http://10.174.184.156:8080/
411411 [searx-archlinux] INFO: (eth0) IPv6: http://[fd42:573b:e0b3:e97e:216:3eff:fea5:9b65]
412412 ...
413413
docs/dev/contribution_guide.rst+11−22
@@ -132,11 +132,11 @@ Here is an example which makes a complete rebuild:
132132
133133.. code:: sh
134134
135− $ make docs-clean docs
135+ $ make docs.clean docs.html
136136 ...
137137 The HTML pages are in dist/docs.
138138
139−.. _make docs-live:
139+.. _make docs.live:
140140
141141live build
142142----------
@@ -144,19 +144,19 @@ live build
144144.. _sphinx-autobuild:
145145 https://github.com/executablebooks/sphinx-autobuild/blob/master/README.md
146146
147−.. sidebar:: docs-clean
147+.. sidebar:: docs.clean
148148
149149 It is recommended to assert a complete rebuild before deploying (use
150− ``docs-clean``).
150+ ``docs.clean``).
151151
152152Live build is like WYSIWYG. If you want to edit the documentation, its
153−recommended to use. The Makefile target ``docs-live`` builds the docs, opens
153+recommended to use. The Makefile target ``docs.live`` builds the docs, opens
154154URL in your favorite browser and rebuilds every time a reST file has been
155155changed.
156156
157157.. code:: sh
158158
159− $ make docs-live
159+ $ make docs.live
160160 ...
161161 The HTML pages are in dist/docs.
162162 ... Serving on http://0.0.0.0:8000
@@ -169,7 +169,7 @@ argument. E.g to find and use a free port, use:
169169
170170.. code:: sh
171171
172− $ SPHINXOPTS="--port 0" make docs-live
172+ $ SPHINXOPTS="--port 0" make docs.live
173173 ...
174174 ... Serving on http://0.0.0.0:50593
175175 ...
@@ -180,21 +180,10 @@ argument. E.g to find and use a free port, use:
180180deploy on github.io
181181-------------------
182182
183−To deploy documentation at :docs:`github.io <.>` use Makefile target
184−:ref:`make gh-pages`, which will builds the documentation, clones searx into a sub
185−folder ``gh-pages``, cleans it, copies the doc build into and runs all the
186−needed git add, commit and push:
183+To deploy documentation at :docs:`github.io <.>` use Makefile target :ref:`make
184+docs.gh-pages`, which builds the documentation and runs all the needed git add,
185+commit and push:
187186
188187.. code:: sh
189188
190− $ make docs-clean gh-pages
191− ...
192− SPHINX docs --> file://<...>/dist/docs
193− The HTML pages are in dist/docs.
194− ...
195− Cloning into 'gh-pages' ...
196− ...
197− cd gh-pages; git checkout gh-pages >/dev/null
198− Switched to a new branch 'gh-pages'
199− ...
200− doc available at --> https://searx.github.io/searx
189+ $ make docs.clean docs.gh-pages
docs/dev/makefile.rst+116−112
@@ -1,33 +1,33 @@
11.. _makefile:
22
3−================
4−Makefile Targets
5−================
3+========
4+Makefile
5+========
66
77.. _gnu-make: https://www.gnu.org/software/make/manual/make.html#Introduction
88
99.. sidebar:: build environment
1010
11− Before looking deeper at the targets, first read about :ref:`make pyenv`.
11+ Before looking deeper at the targets, first read about :ref:`make
12+ install`.
1213
1314 To install system requirements follow :ref:`buildhosts`.
1415
15−With the aim to simplify development cycles, started with :pull:`1756` a
16−``Makefile`` based boilerplate was added. If you are not familiar with
17−Makefiles, we recommend to read gnu-make_ introduction.
16+All relevant build tasks are implemented in :origin:`manage.sh` and for CI or
17+IDE integration a small ``Makefile`` wrapper is available. If you are not
18+familiar with Makefiles, we recommend to read gnu-make_ introduction.
1819
1920The usage is simple, just type ``make {target-name}`` to *build* a target.
2021Calling the ``help`` target gives a first overview (``make help``):
2122
2223.. program-output:: bash -c "cd ..; make --no-print-directory help"
2324
24−
2525.. contents:: Contents
2626 :depth: 2
2727 :local:
2828 :backlinks: entry
2929
30−.. _make pyenv:
30+.. _make install:
3131
3232Python environment
3333==================
@@ -36,31 +36,42 @@ Python environment
3636
3737 ``source ./local/py3/bin/activate``
3838
39−With Makefile we do no longer need to build up the virtualenv manually (as
40−described in the :ref:`devquickstart` guide). Jump into your git working tree
41−and release a ``make pyenv``:
42−
43−.. code:: sh
39+We do no longer need to build up the virtualenv manually. Jump into your git
40+working tree and release a ``make install`` to get a virtualenv with a
41+*developer install* of searx (:origin:`setup.py`). ::
4442
4543 $ cd ~/searx-clone
46− $ make pyenv
47− PYENV usage: source ./local/py3/bin/activate
44+ $ make install
45+ PYENV [virtualenv] installing ./requirements*.txt into local/py3
4846 ...
47+ PYENV OK
48+ PYENV [install] pip install -e 'searx[test]'
49+ ...
50+ Successfully installed argparse-1.4.0 searx
51+ BUILDENV INFO:searx:load the default settings from ./searx/settings.yml
52+ BUILDENV INFO:searx:Initialisation done
53+ BUILDENV build utils/brand.env
4954
50−With target ``pyenv`` a development environment (aka virtualenv) was build up in
51−``./local/py3/``. To make a *developer install* of searx (:origin:`setup.py`)
52−into this environment, use make target ``install``:
53−
54−.. code:: sh
55+If you release ``make install`` multiple times the installation will only
56+rebuild if the sha256 sum of the *requirement files* fails. With other words:
57+the check fails if you edit the requirements listed in
58+:origin:`requirements-dev.txt` and :origin:`requirements.txt`). ::
5559
5660 $ make install
57− PYENV usage: source ./local/py3/bin/activate
58− PYENV using virtualenv from ./local/py3
59− PYENV install .
60−
61−You have never to think about intermediate targets like ``pyenv`` or
62−``install``, the ``Makefile`` chains them as requisites. Just run your main
63−target.
61+ PYENV OK
62+ PYENV [virtualenv] requirements.sha256 failed
63+ [virtualenv] - 6cea6eb6def9e14a18bf32f8a3e... ./requirements-dev.txt
64+ [virtualenv] - 471efef6c73558e391c3adb35f4... ./requirements.txt
65+ ...
66+ PYENV [virtualenv] installing ./requirements*.txt into local/py3
67+ ...
68+ PYENV OK
69+ PYENV [install] pip install -e 'searx[test]'
70+ ...
71+ Successfully installed argparse-1.4.0 searx
72+ BUILDENV INFO:searx:load the default settings from ./searx/settings.yml
73+ BUILDENV INFO:searx:Initialisation done
74+ BUILDENV build utils/brand.env
6475
6576.. sidebar:: drop environment
6677
@@ -68,10 +79,7 @@ target.
6879 <make clean>` first.
6980
7081If you think, something goes wrong with your ./local environment or you change
71−the :origin:`setup.py` file (or the requirements listed in
72−:origin:`requirements-dev.txt` and :origin:`requirements.txt`), you have to call
73−:ref:`make clean`.
74−
82+the :origin:`setup.py` file, you have to call :ref:`make clean`.
7583
7684.. _make run:
7785
@@ -81,117 +89,113 @@ the :origin:`setup.py` file (or the requirements listed in
8189To get up a running a developer instance simply call ``make run``. This enables
8290*debug* option in :origin:`searx/settings.yml`, starts a ``./searx/webapp.py``
8391instance, disables *debug* option again and opens the URL in your favorite WEB
84−browser (:man:`xdg-open`):
85−
86−.. code:: sh
92+browser (:man:`xdg-open`)::
8793
88− $ make run
89− PYENV usage: source ./local/py3/bin/activate
90− PYENV install .
91− ./local/py3/bin/python ./searx/webapp.py
92− ...
93− INFO:werkzeug: * Running on http://127.0.0.1:8888/ (Press CTRL+C to quit)
94− ...
94+ $ make run
95+ PYENV OK
96+ SEARX_DEBUG=1 ./manage.sh pyenv.cmd python ./searx/webapp.py
97+ ...
98+ INFO:werkzeug: * Running on http://127.0.0.1:8888/ (Press CTRL+C to quit)
9599
96100.. _make clean:
97101
98102``make clean``
99103==============
100104
101−Drop all intermediate files, all builds, but keep sources untouched. Includes
102−target ``pyclean`` which drops ./local environment. Before calling ``make
103−clean`` stop all processes using :ref:`make pyenv`.
104−
105−.. code:: sh
105+Drop all intermediate files, all builds, but keep sources untouched. Before
106+calling ``make clean`` stop all processes using :ref:`make install`. ::
106107
107108 $ make clean
108− CLEAN pyclean
109− CLEAN clean
109+ CLEAN pyenv
110+ PYENV [virtualenv] drop ./local/py3
111+ CLEAN docs -- ./build/docs ./dist/docs
112+ CLEAN locally installed npm dependencies
113+ CLEAN test stuff
114+ CLEAN common files
110115
111116.. _make docs:
112117
113−``make docs docs-live docs-clean``
114−==================================
118+``make docs docs.autobuild docs.clean``
119+=======================================
115120
116−We describe the usage of the ``doc*`` targets in the :ref:`How to contribute /
121+We describe the usage of the ``doc.*`` targets in the :ref:`How to contribute /
117122Documentation <contrib docs>` section. If you want to edit the documentation
118−read our :ref:`make docs-live` section. If you are working in your own brand,
123+read our :ref:`make docs.live` section. If you are working in your own brand,
119124adjust your :ref:`settings global`.
120125
121−.. _make books:
126+.. _make docs.gh-pages:
122127
123−``make books/{name}.html books/{name}.pdf``
124−===========================================
128+``make docs.gh-pages``
129+======================
125130
126−.. _intersphinx: https://www.sphinx-doc.org/en/stable/ext/intersphinx.html
127−.. _XeTeX: https://tug.org/xetex/
131+To deploy on github.io first adjust your :ref:`settings global`. For any
132+further read :ref:`deploy on github.io`.
128133
129−.. sidebar:: info
134+.. _make test:
130135
131− To build PDF a XeTeX_ is needed, see :ref:`buildhosts`.
136+``make test``
137+=============
132138
139+Runs a series of tests: :ref:`make test.pylint`, ``test.pep8``, ``test.unit``
140+and ``test.robot``. You can run tests selective, e.g.::
133141
134−The ``books/{name}.*`` targets are building *books*. A *book* is a
135−sub-directory containing a ``conf.py`` file. One example is the user handbook
136−which can deployed separately (:origin:`docs/user/conf.py`). Such ``conf.py``
137−do inherit from :origin:`docs/conf.py` and overwrite values to fit *book's*
138−needs.
142+ $ make test.pep8 test.unit test.sh
143+ TEST test.pep8 OK
144+ ...
145+ TEST test.unit OK
146+ ...
147+ TEST test.sh OK
139148
140−With the help of Intersphinx_ (:ref:`reST smart ref`) the links to searx’s
141−documentation outside of the book will be bound by the object inventory of
142−``DOCS_URL``. Take into account that URLs will be picked from the inventary at
143−documentation's build time.
149+.. _make test.sh:
144150
145−Use ``make docs-help`` to see which books available:
151+``make test.sh``
152+================
146153
147−.. program-output:: bash -c "cd ..; make --no-print-directory docs-help"
148− :ellipsis: 0,-6
154+:ref:`sh lint` / if you have changed some bash scripting run this test before
155+commit.
149156
157+.. _make test.pylint:
150158
151−.. _make gh-pages:
159+``make test.pylint``
160+====================
152161
153−``make gh-pages``
154−=================
162+.. _Pylint: https://www.pylint.org/
155163
156−To deploy on github.io first adjust your :ref:`settings global`. For any
157−further read :ref:`deploy on github.io`.
164+Pylint_ is known as one of the best source-code, bug and quality checker for the
165+Python programming language. The pylint profile we use at searx project is
166+found in project's root folder :origin:`.pylintrc`.
158167
159−.. _make test:
168+.. _make search.checker:
160169
161−``make test``
162−=============
170+``search.checker.{engine name}``
171+================================
163172
164−Runs a series of tests: ``test.pep8``, ``test.unit``, ``test.robot`` and does
165−additional :ref:`pylint checks <make pylint>`. You can run tests selective,
166−e.g.:
173+To check all engines::
167174
168−.. code:: sh
175+ make search.checker
169176
170− $ make test.pep8 test.unit test.sh
171− . ./local/py3/bin/activate; ./manage.sh pep8_check
172− [!] Running pep8 check
173− . ./local/py3/bin/activate; ./manage.sh unit_tests
174− [!] Running unit tests
177+To check a engine with whitespace in the name like *google news* replace space
178+by underline::
175179
176−.. _make pylint:
180+ make search.checker.google_news
177181
178−``make pylint``
179−===============
182+To see HTTP requests and more use SEARX_DEBUG::
180183
181−.. _Pylint: https://www.pylint.org/
184+ make SEARX_DEBUG=1 search.checker.google_news
185+
186+.. _3xx: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_redirection
182187
183−Before commiting its recommend to do some (more) linting. Pylint_ is known as
184−one of the best source-code, bug and quality checker for the Python programming
185−language. Pylint_ is not yet a quality gate within our searx project (like
186−:ref:`test.pep8 <make test>` it is), but Pylint_ can help to improve code
187−quality anyway. The pylint profile we use at searx project is found in
188−project's root folder :origin:`.pylintrc`.
188+To filter out HTTP redirects (3xx_)::
189189
190−Code quality is a ongoing process. Don't try to fix all messages from Pylint,
191−run Pylint and check if your changed lines are bringing up new messages. If so,
192−fix it. By this, code quality gets incremental better and if there comes the
193−day, the linting is balanced out, we might decide to add Pylint as a quality
194−gate.
190+ make SEARX_DEBUG=1 search.checker.google_news | grep -A1 "HTTP/1.1\" 3[0-9][0-9]"
191+ ...
192+ Engine google news Checking
193+ https://news.google.com:443 "GET /search?q=life&hl=en&lr=lang_en&ie=utf8&oe=utf8&ceid=US%3Aen&gl=US HTTP/1.1" 302 0
194+ https://news.google.com:443 "GET /search?q=life&hl=en-US&lr=lang_en&ie=utf8&oe=utf8&ceid=US:en&gl=US HTTP/1.1" 200 None
195+ --
196+ https://news.google.com:443 "GET /search?q=computer&hl=en&lr=lang_en&ie=utf8&oe=utf8&ceid=US%3Aen&gl=US HTTP/1.1" 302 0
197+ https://news.google.com:443 "GET /search?q=computer&hl=en-US&lr=lang_en&ie=utf8&oe=utf8&ceid=US:en&gl=US HTTP/1.1" 200 None
198+ --
195199
196200
197201``make pybuild``
@@ -200,9 +204,7 @@ gate.
200204.. _PyPi: https://pypi.org/
201205.. _twine: https://twine.readthedocs.io/en/latest/
202206
203−Build Python packages in ``./dist/py``.
204−
205−.. code:: sh
207+Build Python packages in ``./dist/py``::
206208
207209 $ make pybuild
208210 ...
@@ -210,9 +212,11 @@ Build Python packages in ``./dist/py``.
210212 running sdist
211213 running egg_info
212214 ...
213− $ ls ./dist/py/
214− searx-0.15.0-py3-none-any.whl searx-0.15.0.tar.gz
215+ running bdist_wheel
216+
217+ $ ls ./dist
218+ searx-0.18.0-py3-none-any.whl searx-0.18.0.tar.gz
215219
216−To upload packages to PyPi_, there is also a ``upload-pypi`` target. It needs
217−twine_ to be installed. Since you are not the owner of :pypi:`searx` you will
218−never need the latter.
220+To upload packages to PyPi_, there is also a ``pypi.upload`` target (to test use
221+``pypi.upload.test``). Since you are not the owner of :pypi:`searx` you will
222+never need to upload.
docs/dev/reST.rst+6−7
@@ -15,8 +15,8 @@ generated and deployed at :docs:`github.io <.>`. For build prerequisites read
1515:ref:`docs build`.
1616
1717The source files of Searx's documentation are located at :origin:`docs`. Sphinx
18−assumes source files to be encoded in UTF-8 by defaul. Run :ref:`make docs-live
19−<make docs-live>` to build HTML while editing.
18+assumes source files to be encoded in UTF-8 by defaul. Run :ref:`make docs.live
19+<make docs.live>` to build HTML while editing.
2020
2121.. sidebar:: Further reading
2222
@@ -1276,13 +1276,12 @@ Templating
12761276
12771277.. sidebar:: Build environment
12781278
1279− All *generic-doc* tasks are running in the :ref:`build environment <make
1280− pyenv>`.
1279+ All *generic-doc* tasks are running in the :ref:`make install`.
12811280
12821281Templating is suitable for documentation which is created generic at the build
1283−time. The sphinx-jinja_ extension evaluates jinja_ templates in the :ref:`build
1284−environment <make pyenv>` (with searx modules installed). We use this e.g. to
1285−build chapter: :ref:`engines generic`. Below the jinja directive from the
1282+time. The sphinx-jinja_ extension evaluates jinja_ templates in the :ref:`make
1283+install` (with searx modules installed). We use this e.g. to build chapter:
1284+:ref:`engines generic`. Below the jinja directive from the
12861285:origin:`docs/admin/engines.rst` is shown:
12871286
12881287.. literalinclude:: ../admin/engines.rst
docs/utils/lxc.sh.rst+3−3
@@ -119,15 +119,15 @@ of coffee).::
119119
120120To build (live) documentation inside a archlinux_ container::
121121
122− sudo -H ./utils/lxc.sh cmd searx-archlinux make docs-clean docs-live
122+ sudo -H ./utils/lxc.sh cmd searx-archlinux make docs.clean docs.live
123123 ...
124124 [I 200331 15:00:42 server:296] Serving on http://0.0.0.0:8080
125125
126126To get IP of the container and the port number *live docs* is listening::
127127
128− $ sudo ./utils/lxc.sh show suite | grep docs-live
128+ $ sudo ./utils/lxc.sh show suite | grep docs.live
129129 ...
130− [searx-archlinux] INFO: (eth0) docs-live: http://n.n.n.12:8080/
130+ [searx-archlinux] INFO: (eth0) docs.live: http://n.n.n.12:8080/
131131
132132
133133.. _lxc.sh help: