on master help sign in
.github/workflows/data-update.yml+2−3
since splitsnapshots
unifiedsplit
@@ -29,7 +29,7 @@ jobs:
29 - name: Set up Python
29 - name: Set up Python
30 uses: actions/setup-python@v2
30 uses: actions/setup-python@v2
31 with:
31 with:
32− python-version: '3.9'
32+ python-version: '3.10'
33 architecture: 'x64'
33 architecture: 'x64'
34
34
35 - name: Install Python dependencies
35 - name: Install Python dependencies
@@ -40,8 +40,7 @@ jobs:
40 env:
40 env:
41 FETCH_SCRIPT: ./searx_extra/update/${{ matrix.fetch }}
41 FETCH_SCRIPT: ./searx_extra/update/${{ matrix.fetch }}
42 run: |
42 run: |
43− source local/py3/bin/activate
44− $FETCH_SCRIPT
43+ V=1 ./manage pyenv.cmd python "$FETCH_SCRIPT"
45
44
46 - name: Create Pull Request
45 - name: Create Pull Request
47 id: cpr
46 id: cpr
.github/workflows/integration.yml+36−6
@@ -13,7 +13,7 @@ jobs:
13 strategy:
13 strategy:
14 matrix:
14 matrix:
15 os: [ubuntu-20.04]
15 os: [ubuntu-20.04]
16− python-version: [3.6, 3.7, 3.8, 3.9]
16+ python-version: [3.7, 3.8, 3.9, "3.10"]
17 steps:
17 steps:
18 - name: Checkout
18 - name: Checkout
19 uses: actions/checkout@v2
19 uses: actions/checkout@v2
@@ -56,10 +56,21 @@ jobs:
56 uses: actions/checkout@v2
56 uses: actions/checkout@v2
57 - name: Install Ubuntu packages
57 - name: Install Ubuntu packages
58 run: sudo ./utils/searx.sh install packages
58 run: sudo ./utils/searx.sh install packages
59+ - name: Set up Python
60+ uses: actions/setup-python@v2
61+ with:
62+ python-version: '3.9'
63+ architecture: 'x64'
64+ - name: Cache Python dependencies
65+ id: cache-python
66+ uses: actions/cache@v2
67+ with:
68+ path: ./local
69+ key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}
59 - name: Install node dependencies
70 - name: Install node dependencies
60 run: make V=1 node.env
71 run: make V=1 node.env
61 - name: Build themes
72 - name: Build themes
62− run: make V=1 themes
73+ run: make V=1 themes.all
63
74
64 documentation:
75 documentation:
65 name: Documentation
76 name: Documentation
@@ -68,23 +79,31 @@ jobs:
68 - name: Checkout
79 - name: Checkout
69 uses: actions/checkout@v2
80 uses: actions/checkout@v2
70 with:
81 with:
82+ fetch-depth: '0'
71 persist-credentials: false
83 persist-credentials: false
72 - name: Install Ubuntu packages
84 - name: Install Ubuntu packages
73 run: sudo ./utils/searx.sh install buildhost
85 run: sudo ./utils/searx.sh install buildhost
74 - name: Set up Python
86 - name: Set up Python
75 uses: actions/setup-python@v2
87 uses: actions/setup-python@v2
76 with:
88 with:
77− python-version: '3.9'
89+ python-version: '3.10'
78 architecture: 'x64'
90 architecture: 'x64'
91+ - name: Cache Python dependencies
92+ id: cache-python
93+ uses: actions/cache@v2
94+ with:
95+ path: ./local
96+ key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}
79 - name: Build documentation
97 - name: Build documentation
80− run: SEARX_DEBUG=1 make V=1 ci-gh-pages
98+ run: |
99+ make V=1 docs.clean docs.html
81 - name: Deploy
100 - name: Deploy
82 if: github.ref == 'refs/heads/master'
101 if: github.ref == 'refs/heads/master'
83 uses: JamesIves/github-pages-deploy-action@3.7.1
102 uses: JamesIves/github-pages-deploy-action@3.7.1
84 with:
103 with:
85 GITHUB_TOKEN: ${{ github.token }}
104 GITHUB_TOKEN: ${{ github.token }}
86 BRANCH: gh-pages
105 BRANCH: gh-pages
87− FOLDER: build/gh-pages
106+ FOLDER: dist/docs
88 CLEAN: true # Automatically remove deleted files from the deploy branch
107 CLEAN: true # Automatically remove deleted files from the deploy branch
89
108
90 dockers:
109 dockers:
@@ -96,7 +115,7 @@ jobs:
96 - documentation
115 - documentation
97 env:
116 env:
98 DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
117 DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
99− runs-on: ubuntu-18.04
118+ runs-on: ubuntu-20.04
100 steps:
119 steps:
101 - name: Checkout
120 - name: Checkout
102 if: env.DOCKERHUB_USERNAME != null
121 if: env.DOCKERHUB_USERNAME != null
@@ -104,6 +123,17 @@ jobs:
104 with:
123 with:
105 # make sure "make docker.push" can get the git history
124 # make sure "make docker.push" can get the git history
106 fetch-depth: '0'
125 fetch-depth: '0'
126+ - name: Set up Python
127+ uses: actions/setup-python@v2
128+ with:
129+ python-version: '3.9'
130+ architecture: 'x64'
131+ - name: Cache Python dependencies
132+ id: cache-python
133+ uses: actions/cache@v2
134+ with:
135+ path: ./local
136+ key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}
107 - name: Set up QEMU
137 - name: Set up QEMU
108 if: env.DOCKERHUB_USERNAME != null
138 if: env.DOCKERHUB_USERNAME != null
109 uses: docker/setup-qemu-action@v1
139 uses: docker/setup-qemu-action@v1
.gitignore+2
@@ -26,3 +26,5 @@ dist/
26local/
26local/
27gh-pages/
27gh-pages/
28searx.egg-info/
28searx.egg-info/
29+.env
30+geckodriver.log
.pylintrc+1−1
@@ -59,7 +59,7 @@ confidence=
59# --enable=similarities". If you want to run only the classes checker, but have
59# --enable=similarities". If you want to run only the classes checker, but have
60# no Warning level messages displayed, use"--disable=all --enable=classes
60# no Warning level messages displayed, use"--disable=all --enable=classes
61# --disable=W"
61# --disable=W"
62−disable=bad-whitespace, duplicate-code
62+disable=bad-whitespace, duplicate-code, consider-using-f-string
63
63
64# Enable the message, report, category or checker with the given id(s). You can
64# Enable the message, report, category or checker with the given id(s). You can
65# either give multiple identifier separated by comma (,) or put this option
65# either give multiple identifier separated by comma (,) or put this option
AUTHORS.rst+1
@@ -165,3 +165,4 @@ generally made searx better:
165- @jhigginbotham
165- @jhigginbotham
166- @xenrox
166- @xenrox
167- @OliveiraHermogenes
167- @OliveiraHermogenes
168+- Paul Alcock @Guilvareux
Dockerfile+8−5
@@ -1,4 +1,4 @@
1−FROM alpine:3.12
1+FROM alpine:3.15
2ENTRYPOINT ["/sbin/tini","--","/usr/local/searx/dockerfiles/docker-entrypoint.sh"]
2ENTRYPOINT ["/sbin/tini","--","/usr/local/searx/dockerfiles/docker-entrypoint.sh"]
3EXPOSE 8080
3EXPOSE 8080
4VOLUME /etc/searx
4VOLUME /etc/searx
@@ -14,7 +14,9 @@ ENV INSTANCE_NAME=searx \
14 AUTOCOMPLETE= \
14 AUTOCOMPLETE= \
15 BASE_URL= \
15 BASE_URL= \
16 MORTY_KEY= \
16 MORTY_KEY= \
17− MORTY_URL=
17+ MORTY_URL= \
18+ SEARX_SETTINGS_PATH=/etc/searx/settings.yml \
19+ UWSGI_SETTINGS_PATH=/etc/searx/uwsgi.ini
18
20
19WORKDIR /usr/local/searx
21WORKDIR /usr/local/searx
20
22
@@ -44,18 +46,19 @@ RUN apk upgrade --no-cache \
44 uwsgi \
46 uwsgi \
45 uwsgi-python3 \
47 uwsgi-python3 \
46 brotli \
48 brotli \
47− && pip3 install --upgrade pip \
49+ && pip3 install --upgrade pip wheel setuptools \
48 && pip3 install --no-cache -r requirements.txt \
50 && pip3 install --no-cache -r requirements.txt \
49 && apk del build-dependencies \
51 && apk del build-dependencies \
50 && rm -rf /root/.cache
52 && rm -rf /root/.cache
51
53
52−COPY --chown=searx:searx . .
54+COPY searx ./searx
55+COPY dockerfiles ./dockerfiles
53
56
54ARG TIMESTAMP_SETTINGS=0
57ARG TIMESTAMP_SETTINGS=0
55ARG TIMESTAMP_UWSGI=0
58ARG TIMESTAMP_UWSGI=0
56ARG VERSION_GITCOMMIT=unknown
59ARG VERSION_GITCOMMIT=unknown
57
60
58−RUN su searx -c "/usr/bin/python3 -m compileall -q searx"; \
61+RUN /usr/bin/python3 -m compileall -q searx; \
59 touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml; \
62 touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml; \
60 touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini; \
63 touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini; \
61 if [ ! -z $VERSION_GITCOMMIT ]; then\
64 if [ ! -z $VERSION_GITCOMMIT ]; then\
Makefile+78−237
@@ -1,266 +1,107 @@
1# -*- coding: utf-8; mode: makefile-gmake -*-
1# -*- coding: utf-8; mode: makefile-gmake -*-
2+# SPDX-License-Identifier: AGPL-3.0-or-later
3+
2.DEFAULT_GOAL=help
4.DEFAULT_GOAL=help
5+export MTOOLS=./manage
3
6
4include utils/makefile.include
7include utils/makefile.include
5
8
6−PYOBJECTS = searx
7−DOC = docs
8−PY_SETUP_EXTRAS ?= \[test\]
9−PYLINT_SEARX_DISABLE_OPTION := I,C,R,W0105,W0212,W0511,W0603,W0613,W0621,W0702,W0703,W1401,E1136
10−PYLINT_ADDITIONAL_BUILTINS_FOR_ENGINES := supported_languages,language_aliases
11−
12−include utils/makefile.python
13−include utils/makefile.sphinx
14−
15all: clean install
9all: clean install
16
10
17−PHONY += help-min help-all help
11+PHONY += help
18−
19−help: help-min
20− @echo ''
21− @echo 'to get more help: make help-all'
22−
23−help-min:
24− @echo ' test - run developer tests'
25− @echo ' docs - build documentation'
26− @echo ' docs-live - autobuild HTML documentation while editing'
27− @echo ' run - run developer instance'
28− @echo ' install - developer install (./local)'
29− @echo ' uninstall - uninstall (./local)'
30− @echo ' gh-pages - build docs & deploy on gh-pages branch'
31− @echo ' clean - drop builds and environments'
32− @echo ' project - re-build generic files of the searx project'
33− @echo ' buildenv - re-build environment files (aka brand)'
34− @echo ' themes - re-build build the source of the themes'
35− @echo ' docker - build Docker image'
36− @echo ' node.env - download & install npm dependencies locally'
37− @echo ''
38− @$(MAKE) -e -s make-help
39−
40−help-all: help-min
41− @echo ''
42− @$(MAKE) -e -s python-help
43− @echo ''
44− @$(MAKE) -e -s docs-help
45
12
46−PHONY += install
13+help:
47−install: buildenv pyenvinstall
14+ @./manage --help
15+ @echo '----'
16+ @echo 'run - run developer instance'
17+ @echo 'install - developer install of searx into virtualenv'
18+ @echo 'uninstall - uninstall developer installation'
19+ @echo 'clean - clean up working tree'
20+ @echo 'search.checker - check search engines'
21+ @echo 'test - run shell & CI tests'
22+ @echo 'test.sh - test shell scripts'
23+ @echo 'ci.test - run CI tests'
48
24
49−PHONY += uninstall
50−uninstall: pyenvuninstall
51−
52−PHONY += clean
53−clean: pyclean docs-clean node.clean test.clean
54− $(call cmd,common_clean)
55
25
56PHONY += run
26PHONY += run
57−run: buildenv pyenvinstall
27+run: install
58 $(Q) ( \
28 $(Q) ( \
59 sleep 2 ; \
29 sleep 2 ; \
60 xdg-open http://127.0.0.1:8888/ ; \
30 xdg-open http://127.0.0.1:8888/ ; \
61 ) &
31 ) &
62− SEARX_DEBUG=1 $(PY_ENV)/bin/python ./searx/webapp.py
32+ SEARX_DEBUG=1 ./manage pyenv.cmd python ./searx/webapp.py
63−
64−# docs
65−# ----
66−
67−sphinx-doc-prebuilds:: buildenv pyenvinstall prebuild-includes
68−
69−PHONY += docs
70−docs: sphinx-doc-prebuilds
71− $(call cmd,sphinx,html,docs,docs)
72−
73−PHONY += docs-live
74−docs-live: sphinx-doc-prebuilds
75− $(call cmd,sphinx_autobuild,html,docs,docs)
76−
77−PHONY += prebuild-includes
78−prebuild-includes:
79− $(Q)mkdir -p $(DOCS_BUILD)/includes
80− $(Q)./utils/searx.sh doc | cat > $(DOCS_BUILD)/includes/searx.rst
81− $(Q)./utils/filtron.sh doc | cat > $(DOCS_BUILD)/includes/filtron.rst
82− $(Q)./utils/morty.sh doc | cat > $(DOCS_BUILD)/includes/morty.rst
83−
84−
85−$(GH_PAGES)::
86− @echo "doc available at --> $(DOCS_URL)"
87−
88−# update project files
89−# --------------------
90−
91−PHONY += project engines.languages useragents.update buildenv
92−
93−project: buildenv useragents.update engines.languages
94−
95−engines.languages: pyenvinstall
96− $(Q)echo "fetch languages .."
97− $(Q)$(PY_ENV_ACT); python ./searx_extra/update/update_languages.py
98− $(Q)echo "updated searx/data/engines_languages.json"
99− $(Q)echo "updated searx/languages.py"
100−
101−useragents.update: pyenvinstall
102− $(Q)echo "fetch useragents .."
103− $(Q)$(PY_ENV_ACT); python ./searx_extra/update/update_firefox_version.py
104− $(Q)echo "updated searx/data/useragents.json with the most recent versions of Firefox."
105−
106−buildenv: pyenv
107− $(Q)$(PY_ENV_ACT); SEARX_DEBUG=1 python utils/build_env.py
108−
109−# node / npm
110−# ----------
111−
112−node.env: buildenv
113− $(Q)./manage.sh npm_packages
114
33
115−node.clean:
34+PHONY += install uninstall
116− $(Q)echo "CLEAN locally installed npm dependencies"
35+install uninstall:
117− $(Q)rm -rf \
36+ $(Q)./manage pyenv.$@
118− ./node_modules \
119− ./package-lock.json \
120− ./searx/static/themes/oscar/package-lock.json \
121− ./searx/static/themes/oscar/node_modules \
122− ./searx/static/themes/simple/package-lock.json \
123− ./searx/static/themes/simple/node_modules
124
37
125−# build themes
38+PHONY += clean
126−# ------------
39+clean: py.clean docs.clean node.clean test.clean
127−
40+ $(Q)./manage build_msg CLEAN "common files"
128−PHONY += themes themes.oscar themes.simple
41+ $(Q)find . -name '*.orig' -exec rm -f {} +
129−themes: buildenv themes.oscar themes.simple
42+ $(Q)find . -name '*.rej' -exec rm -f {} +
130−
43+ $(Q)find . -name '*~' -exec rm -f {} +
131−quiet_cmd_lessc = LESSC $3
44+ $(Q)find . -name '*.bak' -exec rm -f {} +
132− cmd_lessc = PATH="$$(npm bin):$$PATH" \
45+
133− lessc --clean-css="--s1 --advanced --compatibility=ie9" "searx/static/$2" "searx/static/$3"
134−
135−quiet_cmd_grunt = GRUNT $2
136− cmd_grunt = PATH="$$(npm bin):$$PATH" \
137− grunt --gruntfile "$2"
138−
139−themes.oscar: node.env
140− $(Q)echo '[!] build oscar theme'
141− $(call cmd,grunt,searx/static/themes/oscar/gruntfile.js)
142−
143−themes.simple: node.env
144− $(Q)echo '[!] build simple theme'
145− $(call cmd,grunt,searx/static/themes/simple/gruntfile.js)
146−
147−
148−# docker
149−# ------
150−
151−PHONY += docker
152−docker: buildenv
153− $(Q)./manage.sh docker_build
154−
155−docker.push: buildenv
156− $(Q)./manage.sh docker_build push
157−
158−# gecko
159−# -----
160−
161−PHONY += gecko.driver
162−gecko.driver:
163− $(PY_ENV_ACT); ./manage.sh install_geckodriver
164−
165−# search.checker
46+PHONY += search.checker search.checker.%
166−# --------------
167−
168−search.checker: pyenvinstall
47+search.checker: install
169− $(Q)$(PY_ENV_ACT); searx-checker -v
48+ $(Q)./manage pyenv.cmd searx-checker -v
170−
49+
171−ENGINE_TARGETS=$(patsubst searx/engines/%.py,search.checker.%,$(wildcard searx/engines/[!_]*.py))
50+search.checker.%: install
172−
173−$(ENGINE_TARGETS): pyenvinstall
174− $(Q)$(PY_ENV_ACT); searx-checker -v "$(subst _, ,$(patsubst search.checker.%,%,$@))"
51+ $(Q)./manage pyenv.cmd searx-checker -v "$(subst _, ,$(patsubst search.checker.%,%,$@))"
175−
52+
176−
53+PHONY += ci.test test test.sh
177−# test
178−# ----
179−
180−PHONY += test test.sh test.pylint test.pep8 test.unit test.coverage test.robot
54+ci.test: test.pep8 test.pylint test.unit test.robot
181−test: buildenv test.pylint test.pep8 test.unit gecko.driver test.robot
55+test: ci.test
182−
56+test.sh:
183−PYLINT_FILES=\
57+ $(Q)shellcheck -x -s bash \
184− searx/preferences.py \
58+ utils/brand.env \
185− searx/testing.py \
59+ ./manage \
186− searx/engines/gigablast.py \
60+ utils/lib.sh \
187− searx/engines/deviantart.py \
61+ utils/filtron.sh \
188− searx/engines/digg.py \
62+ utils/searx.sh \
189− searx/engines/google.py \
63+ utils/morty.sh \
190− searx/engines/google_news.py \
64+ utils/lxc.sh \
191− searx/engines/google_videos.py \
65+ utils/lxc-searx.env \
192− searx/engines/google_images.py \
66+ .config.sh
193− searx/engines/mediathekviewweb.py \
67+ $(Q)./manage build_msg TEST "$@ OK"
194− searx/engines/meilisearch.py \
195− searx/engines/solidtorrents.py \
196− searx/engines/solr.py \
197− searx/engines/google_scholar.py \
198− searx/engines/yahoo_news.py \
199− searx/engines/apkmirror.py \
200− searx_extra/update/update_external_bangs.py
201−
202−test.pylint: pyenvinstall
203− $(call cmd,pylint,$(PYLINT_FILES))
204− $(call cmd,pylint,\
205− --disable=$(PYLINT_SEARX_DISABLE_OPTION) \
206− --additional-builtins=$(PYLINT_ADDITIONAL_BUILTINS_FOR_ENGINES) \
207− searx/engines \
208− )
209− $(call cmd,pylint,\
210− --disable=$(PYLINT_SEARX_DISABLE_OPTION) \
211− --ignore=searx/engines \
212− searx tests \
213− )
214
68
215−# ignored rules:
216−# E402 module level import not at top of file
217−# W503 line break before binary operator
218
69
219−# ubu1604: uses shellcheck v0.3.7 (from 04/2015), no longer supported!
70+# wrap ./manage script
220−test.sh:
221− shellcheck -x -s bash utils/brand.env
222− shellcheck -x utils/lib.sh
223− shellcheck -x utils/filtron.sh
224− shellcheck -x utils/searx.sh
225− shellcheck -x utils/morty.sh
226− shellcheck -x utils/lxc.sh
227− shellcheck -x utils/lxc-searx.env
228− shellcheck -x .config.sh
229
71
230−test.pep8: pyenvinstall
72+MANAGE += buildenv
231− @echo "TEST pycodestyle (formerly pep8)"
73+MANAGE += babel.compile
232− $(Q)$(PY_ENV_ACT); pycodestyle --exclude='searx/static, searx/languages.py, $(foreach f,$(PYLINT_FILES),$(f),)' \
74+MANAGE += data.all data.languages data.useragents
233− --max-line-length=120 --ignore "E117,E252,E402,E722,E741,W503,W504,W605" searx tests
75+MANAGE += docs.html docs.live docs.gh-pages docs.prebuild docs.clean
76+MANAGE += docker.build docker.push
77+MANAGE += gecko.driver
78+MANAGE += node.env node.clean
79+MANAGE += py.build py.clean
80+MANAGE += pyenv pyenv.install pyenv.uninstall
81+MANAGE += pypi.upload pypi.upload.test
82+MANAGE += test.pylint test.pep8 test.unit test.coverage test.robot test.clean
83+MANAGE += themes.all themes.oscar themes.simple themes.bootstrap
234
84
235−test.unit: pyenvinstall
85+PHONY += $(MANAGE)
236− @echo "TEST tests/unit"
237− $(Q)$(PY_ENV_ACT); python -m nose2 -s tests/unit
238
86
239−test.coverage: pyenvinstall
87+$(MANAGE):
240− @echo "TEST unit test coverage"
88+ $(Q)$(MTOOLS) $@
241− $(Q)$(PY_ENV_ACT); \
242− python -m nose2 -C --log-capture --with-coverage --coverage searx -s tests/unit \
243− && coverage report \
244− && coverage html \
245
89
246−test.robot: pyenvinstall gecko.driver
90+# deprecated
247− @echo "TEST robot"
248− $(Q)$(PY_ENV_ACT); PYTHONPATH=. python searx/testing.py robot
249
91
250−test.clean:
92+PHONY += docs docs-clean docs-live docker themes
251− @echo "CLEAN intermediate test stuff"
252− $(Q)rm -rf geckodriver.log .coverage coverage/
253
93
94+docs: docs.html
95+ $(Q)./manage build_msg WARN $@ is deprecated use docs.html
254
96
255−# travis
97+docs-clean: docs.clean
256−# ------
98+ $(Q)./manage build_msg WARN $@ is deprecated use docs.clean
257
99
258−PHONY += ci.test
100+docs-live: docs.live
259−ci.test:
101+ $(Q)./manage build_msg WARN $@ is deprecated use docs.live
260− $(PY_ENV_BIN)/python -c "import yaml" || make clean
261− $(MAKE) test
262
102
263−travis.codecov:
103+docker: docker.build
264− $(Q)$(PY_ENV_BIN)/python -m pip install codecov
104+ $(Q)./manage build_msg WARN $@ is deprecated use docker.build
265
105
266−.PHONY: $(PHONY)
106+themes: themes.all
107+ $(Q)./manage build_msg WARN $@ is deprecated use themes.all
README.rst+2−2
@@ -17,7 +17,7 @@
17|OpenCollective searx backers|
17|OpenCollective searx backers|
18|OpenCollective searx sponsors|
18|OpenCollective searx sponsors|
19
19
20−Privacy-respecting, hackable `metasearch engine`_ / *pronunciation* **səːks**.
20+Privacy-respecting, hackable `metasearch engine`_ / *pronunciation* **sɜːks**.
21
21
22.. _metasearch engine: https://en.wikipedia.org/wiki/Metasearch_engine
22.. _metasearch engine: https://en.wikipedia.org/wiki/Metasearch_engine
23
23
@@ -61,7 +61,7 @@ our homepage_.
61.. _homepage: https://searx.github.io/searx
61.. _homepage: https://searx.github.io/searx
62
62
63contact:
63contact:
64− openhub_ // twitter_ // IRC: #searx @ freenode
64+ openhub_ // twitter_ // IRC: #searx @ Libera (irc.libera.chat)
65
65
66.. _openhub: https://www.openhub.net/p/searx
66.. _openhub: https://www.openhub.net/p/searx
67.. _twitter: https://twitter.com/Searx_engine
67.. _twitter: https://twitter.com/Searx_engine
dockerfiles/docker-entrypoint.sh−3
@@ -24,9 +24,6 @@ if [ -z "${BIND_ADDRESS}" ]; then
24 export BIND_ADDRESS="${DEFAULT_BIND_ADDRESS}"
24 export BIND_ADDRESS="${DEFAULT_BIND_ADDRESS}"
25fi
25fi
26
26
27−export UWSGI_SETTINGS_PATH=/etc/searx/uwsgi.ini
28−export SEARX_SETTINGS_PATH=/etc/searx/settings.yml
29−
30# Parse special command line
27# Parse special command line
31# see docs/admin/installation-docker.rst
28# see docs/admin/installation-docker.rst
32# display the help message without the version
29# display the help message without the version
docs/admin/buildhosts.rst+4−4
@@ -49,9 +49,9 @@ Build docs
49 - dvisvgm_
49 - dvisvgm_
50
50
51Most of the sphinx requirements are installed from :origin:`setup.py` and the
51Most 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
52+docs can be build from scratch with ``make docs.html``. For better math and
53−processing additional packages are needed. The XeTeX_ needed not only for PDF
53+image processing additional packages are needed. The XeTeX_ needed not only for
54−creation, its also needed for :ref:`math` when HTML output is build.
54+PDF creation, its also needed for :ref:`math` when HTML output is build.
55
55
56To be able to do :ref:`sphinx:math-support` without CDNs, the math are rendered
56To be able to do :ref:`sphinx:math-support` without CDNs, the math are rendered
57as images (``sphinx.ext.imgmath`` extension).
57as images (``sphinx.ext.imgmath`` extension).
@@ -64,7 +64,7 @@ to ``imgmath``:
64 :start-after: # sphinx.ext.imgmath setup
64 :start-after: # sphinx.ext.imgmath setup
65 :end-before: # sphinx.ext.imgmath setup END
65 :end-before: # sphinx.ext.imgmath setup END
66
66
67−If your docs build (``make docs``) shows warnings like this::
67+If your docs build (``make docs.html``) shows warnings like this::
68
68
69 WARNING: dot(1) not found, for better output quality install \
69 WARNING: dot(1) not found, for better output quality install \
70 graphviz from https://www.graphviz.org
70 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.
51
51
52 git clone https://github.com/searx/searx.git
52 git clone https://github.com/searx/searx.git
53 cd searx
53 cd searx
54− make docker
54+ make docker.build
55
55
56
56
57Public instance
57Public instance
docs/admin/installation-searx.rst+1−1
@@ -61,7 +61,7 @@ from the login (*~/.profile*):
61
61
62.. tip::
62.. tip::
63
63
64− Open a second terminal for the configuration tasks and left the ``(searx)$``
64+ Open a second terminal for the configuration tasks and leave the ``(searx)$``
65 terminal open for the tasks below.
65 terminal open for the tasks below.
66
66
67
67
docs/admin/installation.rst+6−1
@@ -39,13 +39,18 @@ install from ``root``, take into account that the scripts are creating a
39these new created users do need read access to the clone of searx, which is not
39these new created users do need read access to the clone of searx, which is not
40the case if you clone into a folder below ``/root``.
40the case if you clone into a folder below ``/root``.
41
41
42−
43.. code:: bash
42.. code:: bash
44
43
45 $ cd ~/Downloads
44 $ cd ~/Downloads
46 $ git clone https://github.com/searx/searx searx
45 $ git clone https://github.com/searx/searx searx
47 $ cd searx
46 $ cd searx
48
47
48+.. sidebar:: further read
49+
50+ - :ref:`toolboxing`
51+ - :ref:`update searx`
52+ - :ref:`inspect searx`
53+
49**Install** :ref:`searx service <searx.sh>`
54**Install** :ref:`searx service <searx.sh>`
50
55
51This installs searx as described in :ref:`installation basic`.
56This installs searx as described in :ref:`installation basic`.
docs/admin/settings.rst+51−13
@@ -130,14 +130,12 @@ Global Settings
130 request_timeout : 2.0 # default timeout in seconds, can be override by engine
130 request_timeout : 2.0 # default timeout in seconds, can be override by engine
131 # max_request_timeout: 10.0 # the maximum timeout in seconds
131 # max_request_timeout: 10.0 # the maximum timeout in seconds
132 useragent_suffix : "" # informations like an email address to the administrator
132 useragent_suffix : "" # informations like an email address to the administrator
133− pool_connections : 100 # Number of different hosts
133+ pool_connections : 100 # Maximum number of allowable connections, or None for no limits. The default is 100.
134− pool_maxsize : 10 # Number of simultaneous requests by host
134+ pool_maxsize : 10 # Number of allowable keep-alive connections, or None to always allow. The default is 10.
135+ enable_http2: True # See https://www.python-httpx.org/http2/
135 # uncomment below section if you want to use a proxy
136 # uncomment below section if you want to use a proxy
136 # proxies:
137 # proxies:
137− # http:
138+ # all://:
138− # - http://proxy1:8080
139− # - http://proxy2:8080
140− # https:
141 # - http://proxy1:8080
139 # - http://proxy1:8080
142 # - http://proxy2:8080
140 # - http://proxy2:8080
143 # uncomment below section only if you have more than one network interface
141 # uncomment below section only if you have more than one network interface
@@ -145,6 +143,7 @@ Global Settings
145 # source_ips:
143 # source_ips:
146 # - 1.1.1.1
144 # - 1.1.1.1
147 # - 1.1.1.2
145 # - 1.1.1.2
146+ # - fe80::/126
148
147
149
148
150``request_timeout`` :
149``request_timeout`` :
@@ -157,20 +156,46 @@ Global Settings
157 Suffix to the user-agent searx uses to send requests to others engines. If an
156 Suffix to the user-agent searx uses to send requests to others engines. If an
158 engine wish to block you, a contact info here may be useful to avoid that.
157 engine wish to block you, a contact info here may be useful to avoid that.
159
158
160−.. _requests proxies: https://requests.readthedocs.io/en/latest/user/advanced/#proxies
159+``keepalive_expiry``:
161−.. _PySocks: https://pypi.org/project/PySocks/
160+ Number of seconds to keep a connection in the pool. By default 5.0 seconds.
161+
162+.. _httpx proxies: https://www.python-httpx.org/advanced/#http-proxying
162
163
163``proxies`` :
164``proxies`` :
164− Define one or more proxies you wish to use, see `requests proxies`_.
165+ Define one or more proxies you wish to use, see `httpx proxies`_.
165 If there are more than one proxy for one protocol (http, https),
166 If there are more than one proxy for one protocol (http, https),
166 requests to the engines are distributed in a round-robin fashion.
167 requests to the engines are distributed in a round-robin fashion.
167
168
168− - Proxy: `see <https://2.python-requests.org/en/latest/user/advanced/#proxies>`__.
169− - SOCKS proxies are also supported: `see <https://2.python-requests.org/en/latest/user/advanced/#socks>`__
170−
171``source_ips`` :
169``source_ips`` :
172 If you use multiple network interfaces, define from which IP the requests must
170 If you use multiple network interfaces, define from which IP the requests must
173− be made. This parameter is ignored when ``proxies`` is set.
171+ be made. Example:
172+
173+ * ``0.0.0.0`` any local IPv4 address.
174+ * ``::`` any local IPv6 address.
175+ * ``192.168.0.1``
176+ * ``[ 192.168.0.1, 192.168.0.2 ]`` these two specific IP addresses
177+ * ``fe80::60a2:1691:e5a2:ee1f``
178+ * ``fe80::60a2:1691:e5a2:ee1f/126`` all IP addresses in this network.
179+ * ``[ 192.168.0.1, fe80::/126 ]``
180+
181+``retries`` :
182+ Number of retry in case of an HTTP error.
183+ On each retry, searx uses an different proxy and source ip.
184+
185+``retry_on_http_error`` :
186+ Retry request on some HTTP status code.
187+
188+ Example:
189+
190+ * ``true`` : on HTTP status code between 400 and 599.
191+ * ``403`` : on HTTP status code 403.
192+ * ``[403, 429]``: on HTTP status code 403 and 429.
193+
194+``enable_http2`` :
195+ Enable by default. Set to ``False`` to disable HTTP/2.
196+
197+``max_redirects`` :
198+ 30 by default. Maximum redirect before it is an error.
174
199
175
200
176``locales:``
201``locales:``
@@ -216,6 +241,13 @@ Engine settings
216 api_key : 'apikey'
241 api_key : 'apikey'
217 disabled : True
242 disabled : True
218 language : en_US
243 language : en_US
244+ #enable_http: False
245+ #enable_http2: False
246+ #retries: 1
247+ #retry_on_http_error: True # or 403 or [404, 429]
248+ #max_connections: 100
249+ #max_keepalive_connections: 10
250+ #keepalive_expiry: 5.0
219 #proxies:
251 #proxies:
220 # http:
252 # http:
221 # - http://proxy1:8080
253 # - http://proxy1:8080
@@ -270,6 +302,12 @@ Engine settings
270``display_error_messages`` : default ``True``
302``display_error_messages`` : default ``True``
271 When an engine returns an error, the message is displayed on the user interface.
303 When an engine returns an error, the message is displayed on the user interface.
272
304
305+``network``: optional
306+ Use the network configuration from another engine.
307+ In addition, there are two default networks:
308+ * ``ipv4`` set ``local_addresses`` to ``0.0.0.0`` (use only IPv4 local addresses)
309+ * ``ipv6`` set ``local_addresses`` to ``::`` (use only IPv6 local addresses)
310+
273.. note::
311.. note::
274
312
275 A few more options are possible, but they are pretty specific to some
313 A few more options are possible, but they are pretty specific to some
docs/admin/update-searx.rst+46−10
@@ -4,20 +4,56 @@
4How to update
4How to update
5=============
5=============
6
6
7+How to update depends on the :ref:`installation` method. If you have used the
8+:ref:`installation scripts`, use ``update`` command from the scripts.
9+
10+**Update** :ref:`searx service <searx.sh>`
11+
12+.. code:: sh
13+
14+ sudo -H ./utils/searx.sh update searx
15+
16+**Update** :ref:`filtron reverse proxy <filtron.sh>`
17+
7.. code:: sh
18.. code:: sh
8
19
20+ sudo -H ./utils/filtron.sh update filtron
21+
22+**Update** :ref:`result proxy <morty.sh>`
23+
24+.. code:: bash
25+
26+ sudo -H ./utils/morty.sh update morty
27+
9− sudo -H -u searx -i
28+.. _inspect searx:
10− (searx)$ git stash
29+
11− (searx)$ git pull origin master
30+======================
12− (searx)$ git stash apply
31+How to inspect & debug
13− (searx)$ ./manage.sh update_packages
32+======================
33+
34+.. sidebar:: further read
35+
36+ - :ref:`toolboxing`
37+ - :ref:`Makefile`
38+
39+How to debug depends on the :ref:`installation` method. If you have used the
40+:ref:`installation scripts`, use ``inspect`` command from the scripts.
41+
42+**Inspect** :ref:`searx service <searx.sh>`
43+
44+.. code:: sh
45+
46+ sudo -H ./utils/searx.sh inspect service
47+
48+**Inspect** :ref:`filtron reverse proxy <filtron.sh>`
49+
50+.. code:: sh
14
51
15−Restart uwsgi:
52+ sudo -H ./utils/filtron.sh inspect service
16
53
17−.. tabs::
54+**Inspect** :ref:`result proxy <morty.sh>`
18
55
19− .. group-tab:: Ubuntu / debian
56+.. code:: bash
20
57
21− .. code:: sh
58+ sudo -H ./utils/morty.sh inspect service
22
59
23− sudo -H systemctl restart uwsgi
docs/blog/index.rst+5−3
@@ -3,13 +3,15 @@ Blog
3====
3====
4
4
5.. toctree::
5.. toctree::
6− :maxdepth: 2
6+ :titlesonly:
7− :caption: Contents
7+ :reversed:
8
8
9− lxcdev-202006
10 python3
9 python3
11 admin
10 admin
12 intro-offline
11 intro-offline
13 private-engines
12 private-engines
13+ lxcdev-202006
14 command-line-engines
14 command-line-engines
15 search-indexer-engines
15 search-indexer-engines
16+ sql-engines
17+ search-database-engines
docs/blog/lxcdev-202006.rst+3−3
@@ -31,7 +31,7 @@ might fail in some aspects we should not overlook.
31
31
32 The environment in which we run all our development processes matters!
32 The environment in which we run all our development processes matters!
33
33
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
35do not have access to all prerequisites. For example, there may have
35do not have access to all prerequisites. For example, there may have
36dependencies on packages that are installed on the developer's desktop, but
36dependencies on packages that are installed on the developer's desktop, but
37usually are not preinstalled on a server or client system. Another examples
37usually are not preinstalled on a server or client system. Another examples
@@ -356,7 +356,7 @@ daily usage:
356 .. code:: sh
356 .. code:: sh
357
357
358 $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
358 $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
359− make docs
359+ make docs.html
360
360
361.. _blog-lxcdev-202006 abstract:
361.. _blog-lxcdev-202006 abstract:
362
362
@@ -407,7 +407,7 @@ To get remarks from the suite of the archlinux container we can use:
407 ...
407 ...
408 [searx-archlinux] INFO: (eth0) filtron: http://10.174.184.156:4004/ http://10.174.184.156/searx
408 [searx-archlinux] INFO: (eth0) filtron: http://10.174.184.156:4004/ http://10.174.184.156/searx
409 [searx-archlinux] INFO: (eth0) morty: http://10.174.184.156:3000/
409 [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/
411 [searx-archlinux] INFO: (eth0) IPv6: http://[fd42:573b:e0b3:e97e:216:3eff:fea5:9b65]
411 [searx-archlinux] INFO: (eth0) IPv6: http://[fd42:573b:e0b3:e97e:216:3eff:fea5:9b65]
412 ...
412 ...
413
413
docs/blog/search-database-engines.rstnew file+95
@@ -0,0 +1,95 @@
1+===============================
2+Query more of your NoSQL stores
3+===============================
4+
5+From now on, searx lets you to query your NoSQL data stores:
6+
7+* `Redis`_
8+* `MongoDB`_
9+
10+The reference configuration of the engines are included ``settings.yml`` just commented out,
11+as you have to set various options and install dependencies before using them.
12+
13+By default, the engines use ``key-value`` template for displaying results.
14+If you are not satisfied with the original result layout,
15+you can use your owm template by placing the template under
16+``searx/templates/{theme_name}/result_templates/{template_name}`` and setting
17+``result_template`` attribute to ``{template_name}``.
18+
19+Futhermore, if you do not want to expose these engines on a public instance, you can
20+still add them and limit the access by setting ``tokens`` as described in the `blog post about
21+private engines`_.
22+
23+Configuring searx to use the stores
24+===================================
25+
26+NoSQL data stores are used for storing arbitrary data without first defining their
27+structure.
28+
29+Redis
30+-----
31+
32+Reqired package: ``redis``
33+
34+Redis is a key value based data store usually stored in memory.
35+
36+Select a database to search in and set its index in the option ``db``. You can
37+either look for exact matches or use partial keywords to find what you are looking for
38+by configuring ``exact_match_only``.
39+
40+In this example you can search for exact matches in your first database:
41+
42+.. code:: yaml
43+
44+ - name : mystore
45+ engine : redis_server
46+ exact_match_only : True
47+ host : 127.0.0.1
48+ port : 6379
49+ password : secret-password
50+ db : 0
51+ shortcut : rds
52+ enable_http : True
53+
54+
55+MongoDB
56+-------
57+
58+Required package: ``pymongo``
59+
60+MongoDB is a document based database program that handles JSON like data.
61+
62+In order to query MongoDB, you have to select a ``database`` and a ``collection``. Furthermore,
63+you have to select a ``key`` that is going to be searched. MongoDB also supports the option ``exact_match_only``, so configure it
64+as you wish.
65+
66+Above is an example configuration for using a MongoDB collection:
67+
68+.. code:: yaml
69+
70+ - name : mymongo
71+ engine : mongodb
72+ shortcut : md
73+ host : '127.0.0.1'
74+ port : 27017
75+ database : personal
76+ collection : income
77+ key : month
78+ enable_http: True
79+
80+
81+Acknowledgement
82+===============
83+
84+This development was sponsored by `Search and Discovery Fund`_ of `NLnet Foundation`_ .
85+
86+.. _Redis: https://redis.io/
87+.. _MongoDB: https://mongodb.com/
88+.. _blog post about private engines: private-engines.html#private-engines
89+.. _Search and Discovery Fund: https://nlnet.nl/discovery
90+.. _NLnet Foundation: https://nlnet.nl/
91+
92+
93+| Happy hacking.
94+| kvch // 2021.07.13 23:16
95+
docs/blog/sql-engines.rstnew file+117
@@ -0,0 +1,117 @@
1+=================
2+Query SQL servers
3+=================
4+
5+Now you can query SQL servers using searx. The following ones are supported:
6+
7+* `PostgreSQL`_
8+* `MySQL`_
9+* `SQLite`_
10+
11+All of the engines above are added to ``settings.yml`` just commented out, as you have to
12+set the required attributes for the engines, e.g. ``database``. By default, the engines use
13+``key-value`` template for displaying results. If you are not satisfied with the original result layout,
14+you can use your owm template by placing the template under
15+``searx/templates/{theme_name}/result_templates/{template_name}`` and setting
16+``result_template`` attribute to ``{template_name}``.
17+
18+As mentioned in previous blog posts, if you do not wish to expose these engines on a
19+public instance, you can still add them and limit the access by setting ``tokens``
20+as described in the `blog post about private engines`_.
21+
22+Configure the engines
23+=====================
24+
25+The configuration of the new database engines are similar. You must put a valid
26+SELECT SQL query in ``query_str``. At the moment you can only bind at most
27+one parameter in your query. By setting the attribute ``limit`` you can
28+define how many results you want from the SQL server. Basically, it
29+is the same as the LIMIT keyword in SQL.
30+
31+Please, do not include LIMIT or OFFSET in your SQL query as the engines
32+rely on these keywords during paging. If you want to configure the number of returned results
33+use the option ``limit``.
34+
35+PostgreSQL
36+----------
37+
38+PostgreSQL is a powerful and robust open source database.
39+
40+Before configuring the PostgreSQL engine, you must install the dependency ``psychopg2``.
41+
42+You can find an example configuration below:
43+
44+.. code:: yaml
45+
46+ - name : postgresql
47+ engine : postgresql
48+ database : my_database
49+ username : searx
50+ password : password
51+ query_str : 'SELECT * from my_table WHERE my_column = %(query)s'
52+ shortcut : psql
53+
54+
55+MySQL
56+-----
57+
58+MySQL is said to be the most popular open source database.
59+
60+Before enabling MySQL engine, you must install the package ``mysql-connector-python``.
61+
62+The authentication plugin is configurable by setting ``auth_plugin`` in the attributes.
63+By default it is set to ``caching_sha2_password``.
64+
65+This is an example configuration for quering a MySQL server:
66+
67+.. code:: yaml
68+
69+ - name : mysql
70+ engine : mysql_server
71+ database : my_database
72+ username : searx
73+ password : password
74+ limit : 5
75+ query_str : 'SELECT * from my_table WHERE my_column=%(query)s'
76+ shortcut : mysql
77+
78+
79+SQLite
80+------
81+
82+SQLite is a small, fast and reliable SQL database engine. It does not require
83+any extra dependency.
84+
85+You can read from your database ``my_database`` using this example configuration:
86+
87+.. code:: yaml
88+
89+ - name : sqlite
90+ engine : sqlite
91+ shortcut: sq
92+ database : my_database
93+ query_str : 'SELECT * FROM my_table WHERE my_column=:query'
94+
95+
96+Next steps
97+==========
98+
99+The next step is to add support for more data stores, e.g. Redis and MongoDB.
100+
101+Acknowledgement
102+===============
103+
104+This development was sponsored by `Search and Discovery Fund`_ of `NLnet Foundation`_ .
105+
106+.. _PostgreSQL: https://www.postgresql.org/
107+.. _MySQL: https://www.mysql.com/
108+.. _SQLite: https://www.sqlite.org/index.html
109+.. _blog post about private engines: private-engines.html#private-engines
110+.. _Search and Discovery Fund: https://nlnet.nl/discovery
111+.. _NLnet Foundation: https://nlnet.nl/
112+
113+
114+| Happy hacking.
115+| kvch // 2021.05.23 23:16
116+
117+
docs/build-templates/morty.rst+1−1
@@ -32,7 +32,7 @@
32 (${SERVICE_USER}) $ mkdir ${SERVICE_HOME}/local
32 (${SERVICE_USER}) $ mkdir ${SERVICE_HOME}/local
33 (${SERVICE_USER}) $ wget --progress=bar -O \"${GO_TAR}\" \\
33 (${SERVICE_USER}) $ wget --progress=bar -O \"${GO_TAR}\" \\
34 \"${GO_PKG_URL}\"
34 \"${GO_PKG_URL}\"
35− (${SERVICE_USER}) $ tar -C ${SERVICE_HOME}/local/go -xzf \"${GO_TAR}\"
35+ (${SERVICE_USER}) $ tar -C ${SERVICE_HOME}/local -xzf \"${GO_TAR}\"
36 (${SERVICE_USER}) $ which go
36 (${SERVICE_USER}) $ which go
37 ${SERVICE_HOME}/local/go/bin/go
37 ${SERVICE_HOME}/local/go/bin/go
38
38
docs/conf.py+3−8
@@ -1,7 +1,7 @@
1# -*- coding: utf-8 -*-
1# -*- coding: utf-8 -*-
2+# SPDX-License-Identifier: AGPL-3.0-or-later
2
3
3import sys, os
4import sys, os
4−from sphinx_build_tools import load_sphinx_config
5from pallets_sphinx_themes import ProjectLink
5from pallets_sphinx_themes import ProjectLink
6
6
7from searx import brand
7from searx import brand
@@ -10,7 +10,7 @@ from searx.version import VERSION_STRING
10# Project --------------------------------------------------------------
10# Project --------------------------------------------------------------
11
11
12project = u'searx'
12project = u'searx'
13−copyright = u'2015-2020, Adam Tauber, Noémi Ványi'
13+copyright = u'2015-2021, Adam Tauber, Noémi Ványi'
14author = u'Adam Tauber'
14author = u'Adam Tauber'
15release, version = VERSION_STRING, VERSION_STRING
15release, version = VERSION_STRING, VERSION_STRING
16highlight_language = 'none'
16highlight_language = 'none'
@@ -101,6 +101,7 @@ imgmath_font_size = 14
101
101
102html_theme_options = {"index_sidebar_logo": True}
102html_theme_options = {"index_sidebar_logo": True}
103html_context = {"project_links": [] }
103html_context = {"project_links": [] }
104+html_context["project_links"].append(ProjectLink("Blog", "blog/index.html"))
104if brand.GIT_URL:
105if brand.GIT_URL:
105 html_context["project_links"].append(ProjectLink("Source", brand.GIT_URL))
106 html_context["project_links"].append(ProjectLink("Source", brand.GIT_URL))
106if brand.WIKI_URL:
107if brand.WIKI_URL:
@@ -128,9 +129,3 @@ html_show_sourcelink = False
128latex_documents = [
129latex_documents = [
129 (master_doc, "searx-{}.tex".format(VERSION_STRING), html_title, author, "manual")
130 (master_doc, "searx-{}.tex".format(VERSION_STRING), html_title, author, "manual")
130]
131]
131−
132−# ------------------------------------------------------------------------------
133−# Since loadConfig overwrites settings from the global namespace, it has to be
134−# the last statement in the conf.py file
135−# ------------------------------------------------------------------------------
136−load_sphinx_config(globals())
docs/dev/contribution_guide.rst+11−22
@@ -132,11 +132,11 @@ Here is an example which makes a complete rebuild:
132
132
133.. code:: sh
133.. code:: sh
134
134
135− $ make docs-clean docs
135+ $ make docs.clean docs.html
136 ...
136 ...
137 The HTML pages are in dist/docs.
137 The HTML pages are in dist/docs.
138
138
139−.. _make docs-live:
139+.. _make docs.live:
140
140
141live build
141live build
142----------
142----------
@@ -144,19 +144,19 @@ live build
144.. _sphinx-autobuild:
144.. _sphinx-autobuild:
145 https://github.com/executablebooks/sphinx-autobuild/blob/master/README.md
145 https://github.com/executablebooks/sphinx-autobuild/blob/master/README.md
146
146
147−.. sidebar:: docs-clean
147+.. sidebar:: docs.clean
148
148
149 It is recommended to assert a complete rebuild before deploying (use
149 It is recommended to assert a complete rebuild before deploying (use
150− ``docs-clean``).
150+ ``docs.clean``).
151
151
152Live build is like WYSIWYG. If you want to edit the documentation, its
152Live 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
154URL in your favorite browser and rebuilds every time a reST file has been
154URL in your favorite browser and rebuilds every time a reST file has been
155changed.
155changed.
156
156
157.. code:: sh
157.. code:: sh
158
158
159− $ make docs-live
159+ $ make docs.live
160 ...
160 ...
161 The HTML pages are in dist/docs.
161 The HTML pages are in dist/docs.
162 ... Serving on http://0.0.0.0:8000
162 ... Serving on http://0.0.0.0:8000
@@ -169,7 +169,7 @@ argument. E.g to find and use a free port, use:
169
169
170.. code:: sh
170.. code:: sh
171
171
172− $ SPHINXOPTS="--port 0" make docs-live
172+ $ SPHINXOPTS="--port 0" make docs.live
173 ...
173 ...
174 ... Serving on http://0.0.0.0:50593
174 ... Serving on http://0.0.0.0:50593
175 ...
175 ...
@@ -180,21 +180,10 @@ argument. E.g to find and use a free port, use:
180deploy on github.io
180deploy on github.io
181-------------------
181-------------------
182
182
183−To deploy documentation at :docs:`github.io <.>` use Makefile target
183+To deploy documentation at :docs:`github.io <.>` use Makefile target :ref:`make
184−:ref:`make gh-pages`, which will builds the documentation, clones searx into a sub
184+docs.gh-pages`, which builds the documentation and runs all the needed git add,
185−folder ``gh-pages``, cleans it, copies the doc build into and runs all the
186−needed git add, commit and push:
185+commit and push:
187
186
188.. code:: sh
187.. code:: sh
189
188
190− $ make docs-clean gh-pages
189+ $ make docs.clean docs.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
docs/dev/engine_overview.rst+1−1
@@ -171,7 +171,7 @@ headers set HTTP header information
171data set HTTP data information
171data set HTTP data information
172cookies set HTTP cookies
172cookies set HTTP cookies
173verify bool Performing SSL-Validity check
173verify bool Performing SSL-Validity check
174−allow_redirects bool Follow redirects
174+follow_redirects bool Follow redirects
175max_redirects int maximum redirects, hard limit
175max_redirects int maximum redirects, hard limit
176soft_max_redirects int maximum redirects, soft limit. Record an error but don't stop the engine
176soft_max_redirects int maximum redirects, soft limit. Record an error but don't stop the engine
177raise_for_httperror bool True by default: raise an exception if the HTTP code of response is >= 300
177raise_for_httperror bool True by default: raise an exception if the HTTP code of response is >= 300
docs/dev/makefile.rst+116−112
@@ -1,33 +1,33 @@
1.. _makefile:
1.. _makefile:
2
2
3−================
3+========
4−Makefile Targets
4+Makefile
5−================
5+========
6
6
7.. _gnu-make: https://www.gnu.org/software/make/manual/make.html#Introduction
7.. _gnu-make: https://www.gnu.org/software/make/manual/make.html#Introduction
8
8
9.. sidebar:: build environment
9.. sidebar:: build environment
10
10
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`.
12
13
13 To install system requirements follow :ref:`buildhosts`.
14 To install system requirements follow :ref:`buildhosts`.
14
15
15−With the aim to simplify development cycles, started with :pull:`1756` a
16+All relevant build tasks are implemented in :origin:`manage.sh` and for CI or
16−``Makefile`` based boilerplate was added. If you are not familiar with
17+IDE integration a small ``Makefile`` wrapper is available. If you are not
17−Makefiles, we recommend to read gnu-make_ introduction.
18+familiar with Makefiles, we recommend to read gnu-make_ introduction.
18
19
19The usage is simple, just type ``make {target-name}`` to *build* a target.
20The usage is simple, just type ``make {target-name}`` to *build* a target.
20Calling the ``help`` target gives a first overview (``make help``):
21Calling the ``help`` target gives a first overview (``make help``):
21
22
22.. program-output:: bash -c "cd ..; make --no-print-directory help"
23.. program-output:: bash -c "cd ..; make --no-print-directory help"
23
24
24−
25.. contents:: Contents
25.. contents:: Contents
26 :depth: 2
26 :depth: 2
27 :local:
27 :local:
28 :backlinks: entry
28 :backlinks: entry
29
29
30−.. _make pyenv:
30+.. _make install:
31
31
32Python environment
32Python environment
33==================
33==================
@@ -36,31 +36,42 @@ Python environment
36
36
37 ``source ./local/py3/bin/activate``
37 ``source ./local/py3/bin/activate``
38
38
39−With Makefile we do no longer need to build up the virtualenv manually (as
39+We do no longer need to build up the virtualenv manually. Jump into your git
40−described in the :ref:`devquickstart` guide). Jump into your git working tree
41−and release a ``make pyenv``:
40+working tree and release a ``make install`` to get a virtualenv with a
42−
41+*developer install* of searx (:origin:`setup.py`). ::
43−.. code:: sh
44
42
45 $ cd ~/searx-clone
43 $ cd ~/searx-clone
46− $ make pyenv
44+ $ make install
47− PYENV usage: source ./local/py3/bin/activate
45+ PYENV [virtualenv] installing ./requirements*.txt into local/py3
48 ...
46 ...
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
49
54
50−With target ``pyenv`` a development environment (aka virtualenv) was build up in
55+If you release ``make install`` multiple times the installation will only
51−``./local/py3/``. To make a *developer install* of searx (:origin:`setup.py`)
56+rebuild if the sha256 sum of the *requirement files* fails. With other words:
52−into this environment, use make target ``install``:
57+the check fails if you edit the requirements listed in
53−
58+:origin:`requirements-dev.txt` and :origin:`requirements.txt`). ::
54−.. code:: sh
55
59
56 $ make install
60 $ make install
57− PYENV usage: source ./local/py3/bin/activate
61+ PYENV OK
58− PYENV using virtualenv from ./local/py3
62+ PYENV [virtualenv] requirements.sha256 failed
59− PYENV install .
63+ [virtualenv] - 6cea6eb6def9e14a18bf32f8a3e... ./requirements-dev.txt
60−
64+ [virtualenv] - 471efef6c73558e391c3adb35f4... ./requirements.txt
61−You have never to think about intermediate targets like ``pyenv`` or
65+ ...
62−``install``, the ``Makefile`` chains them as requisites. Just run your main
66+ PYENV [virtualenv] installing ./requirements*.txt into local/py3
63−target.
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
64
75
65.. sidebar:: drop environment
76.. sidebar:: drop environment
66
77
@@ -68,10 +79,7 @@ target.
68 <make clean>` first.
79 <make clean>` first.
69
80
70If you think, something goes wrong with your ./local environment or you change
81If you think, something goes wrong with your ./local environment or you change
71−the :origin:`setup.py` file (or the requirements listed in
82+the :origin:`setup.py` file, you have to call :ref:`make clean`.
72−:origin:`requirements-dev.txt` and :origin:`requirements.txt`), you have to call
73−:ref:`make clean`.
74−
75
83
76.. _make run:
84.. _make run:
77
85
@@ -81,117 +89,113 @@ the :origin:`setup.py` file (or the requirements listed in
81To get up a running a developer instance simply call ``make run``. This enables
89To get up a running a developer instance simply call ``make run``. This enables
82*debug* option in :origin:`searx/settings.yml`, starts a ``./searx/webapp.py``
90*debug* option in :origin:`searx/settings.yml`, starts a ``./searx/webapp.py``
83instance, disables *debug* option again and opens the URL in your favorite WEB
91instance, disables *debug* option again and opens the URL in your favorite WEB
84−browser (:man:`xdg-open`):
92+browser (:man:`xdg-open`)::
85−
86−.. code:: sh
87
93
88− $ make run
94+ $ make run
89− PYENV usage: source ./local/py3/bin/activate
95+ PYENV OK
90− PYENV install .
91− ./local/py3/bin/python ./searx/webapp.py
96+ SEARX_DEBUG=1 ./manage.sh pyenv.cmd python ./searx/webapp.py
92− ...
97+ ...
93− INFO:werkzeug: * Running on http://127.0.0.1:8888/ (Press CTRL+C to quit)
98+ INFO:werkzeug: * Running on http://127.0.0.1:8888/ (Press CTRL+C to quit)
94− ...
95
99
96.. _make clean:
100.. _make clean:
97
101
98``make clean``
102``make clean``
99==============
103==============
100
104
101−Drop all intermediate files, all builds, but keep sources untouched. Includes
105+Drop all intermediate files, all builds, but keep sources untouched. Before
102−target ``pyclean`` which drops ./local environment. Before calling ``make
103−clean`` stop all processes using :ref:`make pyenv`.
106+calling ``make clean`` stop all processes using :ref:`make install`. ::
104−
105−.. code:: sh
106
107
107 $ make clean
108 $ make clean
108− CLEAN pyclean
109+ CLEAN pyenv
109− CLEAN clean
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
110
115
111.. _make docs:
116.. _make docs:
112
117
113−``make docs docs-live docs-clean``
118+``make docs docs.autobuild docs.clean``
114−==================================
119+=======================================
115
120
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 /
117Documentation <contrib docs>` section. If you want to edit the documentation
122Documentation <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,
119adjust your :ref:`settings global`.
124adjust your :ref:`settings global`.
120
125
121−.. _make books:
126+.. _make docs.gh-pages:
122
127
123−``make books/{name}.html books/{name}.pdf``
128+``make docs.gh-pages``
124−===========================================
129+======================
125
130
126−.. _intersphinx: https://www.sphinx-doc.org/en/stable/ext/intersphinx.html
131+To deploy on github.io first adjust your :ref:`settings global`. For any
127−.. _XeTeX: https://tug.org/xetex/
132+further read :ref:`deploy on github.io`.
128
133
129−.. sidebar:: info
134+.. _make test:
130
135
131− To build PDF a XeTeX_ is needed, see :ref:`buildhosts`.
136+``make test``
137+=============
132
138
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.::
133
141
134−The ``books/{name}.*`` targets are building *books*. A *book* is a
142+ $ make test.pep8 test.unit test.sh
135−sub-directory containing a ``conf.py`` file. One example is the user handbook
143+ TEST test.pep8 OK
136−which can deployed separately (:origin:`docs/user/conf.py`). Such ``conf.py``
144+ ...
137−do inherit from :origin:`docs/conf.py` and overwrite values to fit *book's*
145+ TEST test.unit OK
138−needs.
146+ ...
147+ TEST test.sh OK
139
148
140−With the help of Intersphinx_ (:ref:`reST smart ref`) the links to searx’s
149+.. _make test.sh:
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.
144
150
145−Use ``make docs-help`` to see which books available:
151+``make test.sh``
152+================
146
153
147−.. program-output:: bash -c "cd ..; make --no-print-directory docs-help"
154+:ref:`sh lint` / if you have changed some bash scripting run this test before
148− :ellipsis: 0,-6
155+commit.
149
156
157+.. _make test.pylint:
150
158
151−.. _make gh-pages:
159+``make test.pylint``
160+====================
152
161
153−``make gh-pages``
162+.. _Pylint: https://www.pylint.org/
154−=================
155
163
156−To deploy on github.io first adjust your :ref:`settings global`. For any
164+Pylint_ is known as one of the best source-code, bug and quality checker for the
157−further read :ref:`deploy on github.io`.
165+Python programming language. The pylint profile we use at searx project is
166+found in project's root folder :origin:`.pylintrc`.
158
167
159−.. _make test:
168+.. _make search.checker:
160
169
161−``make test``
170+``search.checker.{engine name}``
162−=============
171+================================
163
172
164−Runs a series of tests: ``test.pep8``, ``test.unit``, ``test.robot`` and does
173+To check all engines::
165−additional :ref:`pylint checks <make pylint>`. You can run tests selective,
166−e.g.:
167
174
168−.. code:: sh
175+ make search.checker
169
176
170− $ make test.pep8 test.unit test.sh
177+To check a engine with whitespace in the name like *google news* replace space
171− . ./local/py3/bin/activate; ./manage.sh pep8_check
178+by underline::
172− [!] Running pep8 check
173− . ./local/py3/bin/activate; ./manage.sh unit_tests
174− [!] Running unit tests
175
179
176−.. _make pylint:
180+ make search.checker.google_news
177
181
178−``make pylint``
182+To see HTTP requests and more use SEARX_DEBUG::
179−===============
180
183
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
182
187
183−Before commiting its recommend to do some (more) linting. Pylint_ is known as
188+To filter out HTTP redirects (3xx_)::
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`.
189
189
190−Code quality is a ongoing process. Don't try to fix all messages from Pylint,
190+ make SEARX_DEBUG=1 search.checker.google_news | grep -A1 "HTTP/1.1\" 3[0-9][0-9]"
191−run Pylint and check if your changed lines are bringing up new messages. If so,
191+ ...
192−fix it. By this, code quality gets incremental better and if there comes the
192+ Engine google news Checking
193−day, the linting is balanced out, we might decide to add Pylint as a quality
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−gate.
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+ --
195
199
196
200
197``make pybuild``
201``make pybuild``
@@ -200,9 +204,7 @@ gate.
200.. _PyPi: https://pypi.org/
204.. _PyPi: https://pypi.org/
201.. _twine: https://twine.readthedocs.io/en/latest/
205.. _twine: https://twine.readthedocs.io/en/latest/
202
206
203−Build Python packages in ``./dist/py``.
207+Build Python packages in ``./dist/py``::
204−
205−.. code:: sh
206
208
207 $ make pybuild
209 $ make pybuild
208 ...
210 ...
@@ -210,9 +212,11 @@ Build Python packages in ``./dist/py``.
210 running sdist
212 running sdist
211 running egg_info
213 running egg_info
212 ...
214 ...
215+ running bdist_wheel
216+
213− $ ls ./dist/py/
217+ $ ls ./dist
214− searx-0.15.0-py3-none-any.whl searx-0.15.0.tar.gz
218+ searx-0.18.0-py3-none-any.whl searx-0.18.0.tar.gz
215
219
216−To upload packages to PyPi_, there is also a ``upload-pypi`` target. It needs
220+To upload packages to PyPi_, there is also a ``pypi.upload`` target (to test use
217−twine_ to be installed. Since you are not the owner of :pypi:`searx` you will
221+``pypi.upload.test``). Since you are not the owner of :pypi:`searx` you will
218−never need the latter.
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
15:ref:`docs build`.
15:ref:`docs build`.
16
16
17The source files of Searx's documentation are located at :origin:`docs`. Sphinx
17The 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
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.
19+<make docs.live>` to build HTML while editing.
20
20
21.. sidebar:: Further reading
21.. sidebar:: Further reading
22
22
@@ -1276,13 +1276,12 @@ Templating
1276
1276
1277.. sidebar:: Build environment
1277.. sidebar:: Build environment
1278
1278
1279− All *generic-doc* tasks are running in the :ref:`build environment <make
1279+ All *generic-doc* tasks are running in the :ref:`make install`.
1280− pyenv>`.
1281
1280
1282Templating is suitable for documentation which is created generic at the build
1281Templating is suitable for documentation which is created generic at the build
1283−time. The sphinx-jinja_ extension evaluates jinja_ templates in the :ref:`build
1282+time. The sphinx-jinja_ extension evaluates jinja_ templates in the :ref:`make
1284−environment <make pyenv>` (with searx modules installed). We use this e.g. to
1283+install` (with searx modules installed). We use this e.g. to build chapter:
1285−build chapter: :ref:`engines generic`. Below the jinja directive from the
1284+:ref:`engines generic`. Below the jinja directive from the
1286:origin:`docs/admin/engines.rst` is shown:
1285:origin:`docs/admin/engines.rst` is shown:
1287
1286
1288.. literalinclude:: ../admin/engines.rst
1287.. literalinclude:: ../admin/engines.rst
docs/user/conf.pydeleted−21
@@ -1,21 +0,0 @@
1−# -*- coding: utf-8; mode: python -*-
2−"""Configuration for the Searx user handbook
3−"""
4−project = 'Searx User-HB'
5−version = release = VERSION_STRING
6−
7−intersphinx_mapping['searx'] = (brand.DOCS_URL, None)
8−
9−# Grouping the document tree into LaTeX files. List of tuples
10−# (source start file, target name, title,
11−# author, documentclass [howto, manual, or own class]).
12−latex_documents = [
13− ('index' # startdocname
14− , 'searx-user-hb.tex' # targetname
15− , '' # take title from .rst
16− , author # author
17− , 'howto' # documentclass
18− , False # toctree_only
19− ),
20−]
21−
docs/utils/index.rst+3−3
@@ -1,9 +1,9 @@
1.. _searx_utils:
1.. _searx_utils:
2.. _toolboxing:
2.. _toolboxing:
3
3
4−========================================
4+===================
5−Tooling box ``utils`` for administrators
5+Admin's tooling box
6−========================================
6+===================
7
7
8In the folder :origin:`utils/` we maintain some tools useful for administrators.
8In the folder :origin:`utils/` we maintain some tools useful for administrators.
9
9
docs/utils/lxc.sh.rst+3−3
@@ -119,15 +119,15 @@ of coffee).::
119
119
120To build (live) documentation inside a archlinux_ container::
120To build (live) documentation inside a archlinux_ container::
121
121
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
123 ...
123 ...
124 [I 200331 15:00:42 server:296] Serving on http://0.0.0.0:8080
124 [I 200331 15:00:42 server:296] Serving on http://0.0.0.0:8080
125
125
126To get IP of the container and the port number *live docs* is listening::
126To get IP of the container and the port number *live docs* is listening::
127
127
128− $ sudo ./utils/lxc.sh show suite | grep docs-live
128+ $ sudo ./utils/lxc.sh show suite | grep docs.live
129 ...
129 ...
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/
131
131
132
132
133.. _lxc.sh help:
133.. _lxc.sh help:
managenew file+504
@@ -0,0 +1,504 @@
1+#!/usr/bin/env bash
2+# -*- coding: utf-8; mode: sh indent-tabs-mode: nil -*-
3+# SPDX-License-Identifier: AGPL-3.0-or-later
4+# shellcheck disable=SC2031
5+
6+# shellcheck source=utils/lib.sh
7+source "$(dirname "${BASH_SOURCE[0]}")/utils/lib.sh"
8+# shellcheck source=utils/brand.env
9+source "${REPO_ROOT}/utils/brand.env"
10+source_dot_config
11+
12+# config
13+
14+PY_SETUP_EXTRAS='[test]'
15+NPM_PACKAGES="less@2.7 less-plugin-clean-css grunt-cli"
16+GECKODRIVER_VERSION="v0.30.0"
17+# SPHINXOPTS=
18+
19+# These py files are linted by test.pylint(), all other files are linted by
20+# test.pep8()
21+PYLINT_FILES=(
22+ searx/preferences.py
23+ searx/testing.py
24+ searx/engines/gigablast.py
25+ searx/engines/deviantart.py
26+ searx/engines/digg.py
27+ searx/engines/google.py
28+ searx/engines/google_news.py
29+ searx/engines/google_videos.py
30+ searx/engines/google_images.py
31+ searx/engines/mediathekviewweb.py
32+ searx/engines/meilisearch.py
33+ searx/engines/solidtorrents.py
34+ searx/engines/solr.py
35+ searx/engines/sqlite.py
36+ searx/engines/springer.py
37+ searx/engines/google_scholar.py
38+ searx/engines/yahoo_news.py
39+ searx/engines/apkmirror.py
40+ searx/engines/core.py
41+ searx_extra/update/update_external_bangs.py
42+)
43+
44+PYLINT_SEARX_DISABLE_OPTION="\
45+I,C,R,\
46+W0105,W0212,W0511,W0603,W0613,W0621,W0702,W0703,W1401,\
47+E1136"
48+PYLINT_ADDITIONAL_BUILTINS_FOR_ENGINES="supported_languages,language_aliases"
49+PYLINT_OPTIONS="-m pylint -j 0 --rcfile .pylintrc"
50+
51+help() {
52+ cat <<EOF
53+buildenv
54+ rebuild ./utils/brand.env
55+babel.compile
56+ pybabel compile ./searx/translations
57+data.*
58+ all : update searx/languages.py and ./data/*
59+ languages : update searx/data/engines_languages.json & searx/languages.py
60+ useragents: update searx/data/useragents.json with the most recent versions of Firefox.
61+docs.*
62+ html : build HTML documentation
63+ live : autobuild HTML documentation while editing
64+ gh-pages : deploy on gh-pages branch
65+ prebuild : build reST include files (./${DOCS_BUILD}/includes)
66+ clean : clean documentation build
67+docker
68+ build : build docker image
69+ push : build and push docker image
70+gecko.driver
71+ download & install geckodriver if not already installed (required for
72+ robot_tests)
73+node.*
74+ env : download & install npm dependencies locally
75+ clean : drop npm installations
76+py.*
77+ build : Build python packages at ./${PYDIST}
78+ clean : delete virtualenv and intermediate py files
79+pyenv.* :
80+ install : developer install of searx into virtualenv
81+ uninstall : uninstall developer installation
82+ cmd ... : run command ... in virtualenv
83+ OK : test if virtualenv is OK
84+pypi.upload:
85+ Upload python packages to PyPi (to test use pypi.upload.test)
86+test.* :
87+ pylint : lint PYLINT_FILES, searx/engines, searx & tests
88+ pep8 : pycodestyle (pep8) for all files except PYLINT_FILES
89+ unit : run unit tests
90+ coverage : run unit tests with coverage
91+ robot : run robot test
92+ clean : clean intermediate test stuff
93+themes.* :
94+ all : build all themes
95+ oscar : build oscar theme
96+ simple : build simple theme
97+EOF
98+}
99+
100+
101+if [ "$VERBOSE" = "1" ]; then
102+ SPHINX_VERBOSE="-v"
103+ PYLINT_VERBOSE="-v"
104+fi
105+
106+# needed by sphinx-docs
107+export DOCS_BUILD
108+
109+buildenv() {
110+ SEARX_DEBUG=1 pyenv.cmd python utils/build_env.py 2>&1 \
111+ | prefix_stdout "${_Blue}BUILDENV${_creset} "
112+ return "${PIPESTATUS[0]}"
113+}
114+
115+babel.compile() {
116+ build_msg BABEL compile
117+ pyenv.cmd pybabel compile -d "${REPO_ROOT}/searx/translations"
118+ dump_return $?
119+}
120+
121+
122+data.all() {
123+ data.languages
124+ data.useragents
125+ build_msg DATA "update searx/data/ahmia_blacklist.txt"
126+ pyenv.cmd python searx_extra/update/update_ahmia_blacklist.py
127+ build_msg DATA "update searx/data/wikidata_units.json"
128+ pyenv.cmd python searx_extra/update/update_wikidata_units.py
129+ build_msg DATA "update searx/data/currencies.json"
130+ pyenv.cmd python searx_extra/update/update_currencies.py
131+}
132+
133+
134+data.languages() {
135+ ( set -e
136+ build_msg ENGINES "fetch languages .."
137+ pyenv.cmd python searx_extra/update/update_languages.py
138+ build_msg ENGINES "update update searx/languages.py"
139+ build_msg DATA "update searx/data/engines_languages.json"
140+ )
141+ dump_return $?
142+}
143+
144+data.useragents() {
145+ build_msg DATA "update searx/data/useragents.json"
146+ pyenv.cmd python searx_extra/update/update_firefox_version.py
147+ dump_return $?
148+}
149+
150+docs.prebuild() {
151+ build_msg DOCS "build ${DOCS_BUILD}/includes"
152+ (
153+ set -e
154+ [ "$VERBOSE" = "1" ] && set -x
155+ mkdir -p "${DOCS_BUILD}/includes"
156+ ./utils/searx.sh doc | cat > "${DOCS_BUILD}/includes/searx.rst"
157+ ./utils/filtron.sh doc | cat > "${DOCS_BUILD}/includes/filtron.rst"
158+ ./utils/morty.sh doc | cat > "${DOCS_BUILD}/includes/morty.rst"
159+ )
160+ dump_return $?
161+}
162+
163+docker.push() {
164+ docker.build push
165+}
166+
167+# shellcheck disable=SC2119
168+docker.build() {
169+ pyenv.install
170+
171+ build_msg DOCKER build
172+ # run installation in a subprocess and activate pyenv
173+
174+ # See https://www.shellcheck.net/wiki/SC1001 and others ..
175+ # shellcheck disable=SC2031,SC2230,SC2002,SC2236,SC2143,SC1001
176+ ( set -e
177+ # shellcheck source=/dev/null
178+ source "${PY_ENV_BIN}/activate"
179+
180+ # Check if it is a git repository
181+ if [ ! -d .git ]; then
182+ die 1 "This is not Git repository"
183+ fi
184+ if [ ! -x "$(which git)" ]; then
185+ die 1 "git is not installed"
186+ fi
187+
188+ if ! git remote get-url origin 2> /dev/null; then
189+ die 1 "there is no remote origin"
190+ fi
191+
192+ # This is a git repository
193+
194+ # "git describe" to get the Docker version (for example : v0.15.0-89-g0585788e)
195+ # awk to remove the "v" and the "g"
196+ SEARX_GIT_VERSION=$(git describe --match "v[0-9]*\.[0-9]*\.[0-9]*" HEAD 2>/dev/null | awk -F'-' '{OFS="-"; $1=substr($1, 2); if ($3) { $3=substr($3, 2); } print}')
197+
198+ # add the suffix "-dirty" if the repository has uncommited change
199+ # /!\ HACK for searx/searx: ignore utils/brand.env
200+ git update-index -q --refresh
201+ if [ ! -z "$(git diff-index --name-only HEAD -- | grep -v 'utils/brand.env')" ]; then
202+ SEARX_GIT_VERSION="${SEARX_GIT_VERSION}-dirty"
203+ fi
204+
205+ # Get the last git commit id, will be added to the Searx version (see Dockerfile)
206+ VERSION_GITCOMMIT=$(echo "$SEARX_GIT_VERSION" | cut -d- -f2-4)
207+ build_msg DOCKER "Last commit : $VERSION_GITCOMMIT"
208+
209+ # Check consistency between the git tag and the searx/version.py file
210+ # /! HACK : parse Python file with bash /!
211+ # otherwise it is not possible build the docker image without all Python
212+ # dependencies ( version.py loads __init__.py )
213+ # SEARX_PYTHON_VERSION=$(python3 -c "import six; import searx.version; six.print_(searx.version.VERSION_STRING)")
214+ SEARX_PYTHON_VERSION=$(cat searx/version.py | grep "\(VERSION_MAJOR\|VERSION_MINOR\|VERSION_BUILD\) =" | cut -d\= -f2 | sed -e 's/^[[:space:]]*//' | paste -sd "." -)
215+ if [ "$(echo "$SEARX_GIT_VERSION" | cut -d- -f1)" != "$SEARX_PYTHON_VERSION" ]; then
216+ err_msg "git tag: $SEARX_GIT_VERSION"
217+ err_msg "searx/version.py: $SEARX_PYTHON_VERSION"
218+ die 1 "Inconsistency between the last git tag and the searx/version.py file"
219+ fi
220+
221+ # define the docker image name
222+ GITHUB_USER=$(echo "${GIT_URL}" | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
223+ SEARX_IMAGE_NAME="${SEARX_IMAGE_NAME:-${GITHUB_USER:-searx}/searx}"
224+
225+ # build Docker image
226+ build_msg DOCKER "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
227+ docker build \
228+ --build-arg GIT_URL="${GIT_URL}" \
229+ --build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \
230+ --build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \
231+ --build-arg LABEL_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
232+ --build-arg LABEL_VCS_REF="$(git rev-parse HEAD)" \
233+ --build-arg LABEL_VCS_URL="${GIT_URL}" \
234+ --build-arg TIMESTAMP_SETTINGS="$(git log -1 --format="%cd" --date=unix -- searx/settings.yml)" \
235+ --build-arg TIMESTAMP_UWSGI="$(git log -1 --format="%cd" --date=unix -- dockerfiles/uwsgi.ini)" \
236+ -t "${SEARX_IMAGE_NAME}:latest" -t "${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}" .
237+
238+ if [ "$1" = "push" ]; then
239+ docker push "${SEARX_IMAGE_NAME}:latest"
240+ docker push "${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
241+ fi
242+ )
243+ dump_return $?
244+}
245+
246+# shellcheck disable=SC2119
247+gecko.driver() {
248+ pyenv.install
249+
250+ build_msg INSTALL "gecko.driver"
251+ # run installation in a subprocess and activate pyenv
252+ ( set -e
253+ # shellcheck source=/dev/null
254+ source "${PY_ENV_BIN}/activate"
255+
256+ # TODO : check the current geckodriver version
257+ geckodriver -V > /dev/null 2>&1 || NOTFOUND=1
258+ set +e
259+ if [ -z "$NOTFOUND" ]; then
260+ build_msg INSTALL "geckodriver already installed"
261+ return
262+ fi
263+ PLATFORM="$(python3 -c 'import platform; print(platform.system().lower(), platform.architecture()[0])')"
264+ case "$PLATFORM" in
265+ "linux 32bit" | "linux2 32bit") ARCH="linux32";;
266+ "linux 64bit" | "linux2 64bit") ARCH="linux64";;
267+ "windows 32 bit") ARCH="win32";;
268+ "windows 64 bit") ARCH="win64";;
269+ "mac 64bit") ARCH="macos";;
270+ esac
271+ GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";
272+
273+ build_msg GECKO "Installing ${PY_ENV_BIN}/geckodriver from $GECKODRIVER_URL"
274+
275+ FILE="$(mktemp)"
276+ wget -qO "$FILE" -- "$GECKODRIVER_URL" && tar xz -C "${PY_ENV_BIN}" -f "$FILE" geckodriver
277+ rm -- "$FILE"
278+ chmod 755 -- "${PY_ENV_BIN}/geckodriver"
279+ )
280+ dump_return $?
281+}
282+
283+node.env() {
284+ local err=0
285+ pushd "${REPO_ROOT}" &> /dev/null
286+ # shellcheck disable=SC2230
287+ which npm &> /dev/null || die 1 'node.env - npm is not found!'
288+
289+ ( set -e
290+ # shellcheck disable=SC2030
291+ PATH="$(npm bin):$PATH"
292+ export PATH
293+
294+ build_msg INSTALL "npm install $NPM_PACKAGES"
295+ # shellcheck disable=SC2086
296+ npm install $NPM_PACKAGES
297+
298+ cd "${REPO_ROOT}/searx/static/themes/oscar"
299+ build_msg INSTALL "($(pwd)) npm install"
300+ npm install
301+
302+ build_msg INSTALL "($(pwd)) npm install"
303+ cd "${REPO_ROOT}/searx/static/themes/simple"
304+ npm install
305+ )
306+ err=$?
307+ popd &> /dev/null
308+ dump_return "$err"
309+}
310+
311+node.clean() {
312+
313+ build_msg CLEAN "locally installed npm dependencies"
314+ rm -rf \
315+ ./node_modules \
316+ ./package-lock.json \
317+ ./searx/static/themes/oscar/package-lock.json \
318+ ./searx/static/themes/oscar/node_modules \
319+ ./searx/static/themes/simple/package-lock.json \
320+ ./searx/static/themes/simple/node_modules
321+ dump_return $?
322+}
323+
324+py.build() {
325+ build_msg BUILD "[pylint] python package ${PYDIST}"
326+ pyenv.cmd python setup.py \
327+ sdist -d "${PYDIST}" \
328+ bdist_wheel --bdist-dir "${PYBUILD}" -d "${PYDIST}"
329+}
330+
331+py.clean() {
332+ build_msg CLEAN pyenv
333+ ( set -e
334+ pyenv.drop
335+ [ "$VERBOSE" = "1" ] && set -x
336+ rm -rf "${PYDIST}" "${PYBUILD}" "${PY_ENV}" ./.tox ./*.egg-info
337+ find . -name '*.pyc' -exec rm -f {} +
338+ find . -name '*.pyo' -exec rm -f {} +
339+ find . -name __pycache__ -exec rm -rf {} +
340+ )
341+}
342+
343+pyenv.check() {
344+ cat <<EOF
345+import yaml
346+print('import yaml --> OK')
347+EOF
348+}
349+
350+pyenv.install() {
351+
352+ if ! pyenv.OK; then
353+ py.clean > /dev/null
354+ fi
355+ if pyenv.install.OK > /dev/null; then
356+ return 0
357+ fi
358+ ( set -e
359+ pyenv
360+ build_msg PYENV "[install] pip install -e 'searx${PY_SETUP_EXTRAS}'"
361+ "${PY_ENV_BIN}/python" -m pip install -e ".${PY_SETUP_EXTRAS}"
362+ buildenv
363+ ) || die 42 "error while build & install pyenv (${PY_ENV_BIN})"
364+}
365+
366+pyenv.uninstall() {
367+ build_msg PYENV "[pyenv.uninstall] uninstall packages: ${PYOBJECTS}"
368+ pyenv.cmd python setup.py develop --uninstall 2>&1 \
369+ | prefix_stdout "${_Blue}PYENV ${_creset}[pyenv.uninstall] "
370+
371+}
372+
373+pypi.upload() {
374+ py.clean
375+ py.build
376+ # https://github.com/pypa/twine
377+ pyenv.cmd twine upload "${PYDIST}"/*
378+}
379+
380+pypi.upload.test() {
381+ py.clean
382+ py.build
383+ pyenv.cmd twine upload -r testpypi "${PYDIST}"/*
384+}
385+
386+test.pylint() {
387+ # shellcheck disable=SC2086
388+ ( set -e
389+ build_msg TEST "[pylint] \$PYLINT_FILES"
390+ pyenv.cmd python ${PYLINT_OPTIONS} ${PYLINT_VERBOSE} \
391+ "${PYLINT_FILES[@]}"
392+
393+ build_msg TEST "[pylint] searx/engines"
394+ pyenv.cmd python ${PYLINT_OPTIONS} ${PYLINT_VERBOSE} \
395+ --disable="${PYLINT_SEARX_DISABLE_OPTION}" \
396+ --additional-builtins="${PYLINT_ADDITIONAL_BUILTINS_FOR_ENGINES}" \
397+ searx/engines
398+
399+ build_msg TEST "[pylint] searx tests"
400+ pyenv.cmd python ${PYLINT_OPTIONS} ${PYLINT_VERBOSE} \
401+ --disable="${PYLINT_SEARX_DISABLE_OPTION}" \
402+ --ignore=searx/engines \
403+ tests
404+ )
405+ dump_return $?
406+}
407+
408+test.pep8() {
409+ build_msg TEST 'pycodestyle (formerly pep8)'
410+ local _exclude=""
411+ printf -v _exclude '%s, ' "${PYLINT_FILES[@]}"
412+ pyenv.cmd pycodestyle \
413+ --exclude="searx/static, searx/languages.py, $_exclude " \
414+ --max-line-length=120 \
415+ --ignore "E117,E252,E402,E722,E741,W503,W504,W605" \
416+ searx tests
417+ dump_return $?
418+}
419+
420+test.unit() {
421+ build_msg TEST 'tests/unit'
422+ pyenv.cmd python -m nose2 -s tests/unit
423+ dump_return $?
424+}
425+
426+test.coverage() {
427+ build_msg TEST 'unit test coverage'
428+ ( set -e
429+ pyenv.cmd python -m nose2 -C --log-capture --with-coverage --coverage searx -s tests/unit
430+ pyenv.cmd coverage report
431+ pyenv.cmd coverage html
432+ )
433+ dump_return $?
434+}
435+
436+test.robot() {
437+ build_msg TEST 'robot'
438+ gecko.driver
439+ PYTHONPATH=. pyenv.cmd python searx/testing.py robot
440+ dump_return $?
441+}
442+
443+test.clean() {
444+ build_msg CLEAN "test stuff"
445+ rm -rf geckodriver.log .coverage coverage/
446+ dump_return $?
447+}
448+
449+themes.all() {
450+ ( set -e
451+ node.env
452+ themes.oscar
453+ themes.simple
454+ )
455+ dump_return $?
456+}
457+
458+themes.oscar() {
459+ local gruntfile=searx/static/themes/oscar/gruntfile.js
460+ build_msg GRUNT "${gruntfile}"
461+ PATH="$(npm bin):$PATH" grunt --gruntfile "${gruntfile}"
462+ dump_return $?
463+}
464+
465+themes.simple() {
466+ local gruntfile=searx/static/themes/simple/gruntfile.js
467+ build_msg GRUNT "${gruntfile}"
468+ PATH="$(npm bin):$PATH" grunt --gruntfile "${gruntfile}"
469+ dump_return $?
470+}
471+
472+# shellcheck disable=SC2119
473+main() {
474+
475+ local _type
476+ local cmd="$1"; shift
477+
478+ if [ "$cmd" == "" ]; then
479+ help
480+ err_msg "missing command"
481+ return 42
482+ fi
483+
484+ case "$cmd" in
485+ --getenv) var="$1"; echo "${!var}";;
486+ --help) help;;
487+ --*)
488+ help
489+ err_msg "unknown option $cmd"
490+ return 42
491+ ;;
492+ *)
493+ _type="$(type -t "$cmd")"
494+ if [ "$_type" != 'function' ]; then
495+ err_msg "unknown command $1 / use --help"
496+ return 42
497+ else
498+ "$cmd" "$@"
499+ fi
500+ ;;
501+ esac
502+}
503+
504+main "$@"
manage.shdeleted−205
@@ -1,205 +0,0 @@
1−#!/bin/sh
2−
3−export LANG=C
4−
5−BASE_DIR="$(dirname -- "`readlink -f -- "$0"`")"
6−
7−cd -- "$BASE_DIR"
8−set -e
9−
10−# subshell
11−PYTHONPATH="$BASE_DIR"
12−SEARX_DIR="$BASE_DIR/searx"
13−ACTION="$1"
14−
15−. "${BASE_DIR}/utils/brand.env"
16−
17−#
18−# Python
19−#
20−
21−update_packages() {
22− pip install --upgrade pip
23− pip install --upgrade setuptools
24− pip install -Ur "$BASE_DIR/requirements.txt"
25−}
26−
27−update_dev_packages() {
28− update_packages
29− pip install -Ur "$BASE_DIR/requirements-dev.txt"
30−}
31−
32−install_geckodriver() {
33− echo '[!] Checking geckodriver'
34− # TODO : check the current geckodriver version
35− set -e
36− geckodriver -V > /dev/null 2>&1 || NOTFOUND=1
37− set +e
38− if [ -z "$NOTFOUND" ]; then
39− return
40− fi
41− GECKODRIVER_VERSION="v0.28.0"
42− PLATFORM="`python3 -c "import platform; print(platform.system().lower(), platform.architecture()[0])"`"
43− case "$PLATFORM" in
44− "linux 32bit" | "linux2 32bit") ARCH="linux32";;
45− "linux 64bit" | "linux2 64bit") ARCH="linux64";;
46− "windows 32 bit") ARCH="win32";;
47− "windows 64 bit") ARCH="win64";;
48− "mac 64bit") ARCH="macos";;
49− esac
50− GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";
51−
52− if [ -z "$1" ]; then
53− if [ -z "$VIRTUAL_ENV" ]; then
54− printf "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n %s" "$GECKODRIVER_URL"
55− exit
56− else
57− GECKODRIVER_DIR="$VIRTUAL_ENV/bin"
58− fi
59− else
60− GECKODRIVER_DIR="$1"
61− mkdir -p -- "$GECKODRIVER_DIR"
62− fi
63−
64− printf "Installing %s/geckodriver from\n %s" "$GECKODRIVER_DIR" "$GECKODRIVER_URL"
65−
66− FILE="`mktemp`"
67− wget -qO "$FILE" -- "$GECKODRIVER_URL" && tar xz -C "$GECKODRIVER_DIR" -f "$FILE" geckodriver
68− rm -- "$FILE"
69− chmod 777 -- "$GECKODRIVER_DIR/geckodriver"
70−}
71−
72−locales() {
73− pybabel compile -d "$SEARX_DIR/translations"
74−}
75−
76−
77−#
78−# Web
79−#
80−
81−npm_path_setup() {
82− which npm || (printf 'Error: npm is not found\n'; exit 1)
83− export PATH="$(npm bin)":$PATH
84−}
85−
86−npm_packages() {
87− npm_path_setup
88−
89− echo '[!] install NPM packages'
90− cd -- "$BASE_DIR"
91− npm install less@2.7 less-plugin-clean-css grunt-cli
92−
93− echo '[!] install NPM packages for oscar theme'
94− cd -- "$BASE_DIR/searx/static/themes/oscar"
95− npm install
96−
97− echo '[!] install NPM packages for simple theme'
98− cd -- "$BASE_DIR/searx/static/themes/simple"
99− npm install
100−}
101−
102−docker_build() {
103− # Check if it is a git repository
104− if [ ! -d .git ]; then
105− echo "This is not Git repository"
106− exit 1
107− fi
108−
109− if [ ! -x "$(which git)" ]; then
110− echo "git is not installed"
111− exit 1
112− fi
113−
114− if [ ! git remote get-url origin 2> /dev/null ]; then
115− echo "there is no remote origin"
116− exit 1
117− fi
118−
119− # This is a git repository
120−
121− # "git describe" to get the Docker version (for example : v0.15.0-89-g0585788e)
122− # awk to remove the "v" and the "g"
123− SEARX_GIT_VERSION=$(git describe --match "v[0-9]*\.[0-9]*\.[0-9]*" HEAD 2>/dev/null | awk -F'-' '{OFS="-"; $1=substr($1, 2); if ($3) { $3=substr($3, 2); } print}')
124−
125− # add the suffix "-dirty" if the repository has uncommited change
126− # /!\ HACK for searx/searx: ignore utils/brand.env
127− git update-index -q --refresh
128− if [ ! -z "$(git diff-index --name-only HEAD -- | grep -v 'utils/brand.env')" ]; then
129− SEARX_GIT_VERSION="${SEARX_GIT_VERSION}-dirty"
130− fi
131−
132− # Get the last git commit id, will be added to the Searx version (see Dockerfile)
133− VERSION_GITCOMMIT=$(echo $SEARX_GIT_VERSION | cut -d- -f2-4)
134− echo "Last commit : $VERSION_GITCOMMIT"
135−
136− # Check consistency between the git tag and the searx/version.py file
137− # /!\ HACK : parse Python file with bash /!\
138− # otherwise it is not possible build the docker image without all Python dependencies ( version.py loads __init__.py )
139− # SEARX_PYTHON_VERSION=$(python3 -c "import six; import searx.version; six.print_(searx.version.VERSION_STRING)")
140− SEARX_PYTHON_VERSION=$(cat searx/version.py | grep "\(VERSION_MAJOR\|VERSION_MINOR\|VERSION_BUILD\) =" | cut -d\= -f2 | sed -e 's/^[[:space:]]*//' | paste -sd "." -)
141− if [ $(echo "$SEARX_GIT_VERSION" | cut -d- -f1) != "$SEARX_PYTHON_VERSION" ]; then
142− echo "Inconsistency between the last git tag and the searx/version.py file"
143− echo "git tag: $SEARX_GIT_VERSION"
144− echo "searx/version.py: $SEARX_PYTHON_VERSION"
145− exit 1
146− fi
147−
148− # define the docker image name
149− GITHUB_USER=$(echo "${GIT_URL}" | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
150− SEARX_IMAGE_NAME="${SEARX_IMAGE_NAME:-${GITHUB_USER:-searx}/searx}"
151−
152− # build Docker image
153− echo "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
154− sudo docker build \
155− --build-arg GIT_URL="${GIT_URL}" \
156− --build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \
157− --build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \
158− --build-arg LABEL_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
159− --build-arg LABEL_VCS_REF=$(git rev-parse HEAD) \
160− --build-arg LABEL_VCS_URL="${GIT_URL}" \
161− --build-arg TIMESTAMP_SETTINGS=$(git log -1 --format="%cd" --date=unix -- searx/settings.yml) \
162− --build-arg TIMESTAMP_UWSGI=$(git log -1 --format="%cd" --date=unix -- dockerfiles/uwsgi.ini) \
163− -t ${SEARX_IMAGE_NAME}:latest -t ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION} .
164−
165− if [ "$1" = "push" ]; then
166− sudo docker push ${SEARX_IMAGE_NAME}:latest
167− sudo docker push ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}
168− fi
169−}
170−
171−#
172−# Help
173−#
174−
175−help() {
176− [ -z "$1" ] || printf 'Error: %s\n' "$1"
177− echo "Searx manage.sh help
178−
179−Commands
180−========
181− help - This text
182−
183− Build requirements
184− ------------------
185− update_packages - Check & update production dependency changes
186− update_dev_packages - Check & update development and production dependency changes
187− install_geckodriver - Download & install geckodriver if not already installed (required for robot_tests)
188− npm_packages - Download & install npm dependencies
189−
190− Build
191− -----
192− locales - Compile locales
193−
194−Environment:
195− GIT_URL: ${GIT_URL}
196− ISSUE_URL: ${ISSUE_URL}
197− SEARX_URL: ${SEARX_URL}
198− DOCS_URL: ${DOCS_URL}
199− PUBLIC_INSTANCES: ${PUBLIC_INSTANCES}
200−"
201−}
202−
203−[ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
204− && help "action not found" \
205− || "$ACTION" "$2"
requirements-dev.txt+14−12
@@ -1,18 +1,20 @@
1mock==4.0.3
1mock==4.0.3
2nose2[coverage_plugin]==0.10.0
2nose2[coverage_plugin]==0.10.0
3cov-core==1.15.0
3cov-core==1.15.0
4−pycodestyle==2.7.0
4+pycodestyle==2.8.0
5−pylint==2.7.4
5+pylint==2.12.2
6−splinter==0.14.0
6+splinter==0.17.0
7−transifex-client==0.14.2
7+transifex-client==0.14.3; python_version < '3.10'
8+transifex-client==0.12.1; python_version == '3.10'
8−selenium==3.141.0
9+selenium==4.1.0
9−twine==3.4.1
10+twine==3.7.1
10−Pallets-Sphinx-Themes==1.2.3
11+Pallets-Sphinx-Themes==2.0.2
11docutils==0.16
12docutils==0.16
12−Sphinx==3.5.3
13+Sphinx==4.4.0
13−sphinx-issues==1.2.0
14+sphinx-issues==3.0.1
14−sphinx-jinja==1.1.1
15+sphinx-jinja==1.4.0
15−sphinx-tabs==2.1.0
16+sphinx-tabs==3.2.0
16sphinxcontrib-programoutput==0.17
17sphinxcontrib-programoutput==0.17
17sphinx-autobuild==2021.3.14
18sphinx-autobuild==2021.3.14
18−linuxdoc==20210324
19+linuxdoc==20211220
20+aiounittest==1.4.1
requirements.txt+14−10
@@ -1,12 +1,16 @@
1−certifi==2020.12.05
1+certifi==2021.10.8
2−babel==2.9.0
2+babel==2.9.1
3flask-babel==2.0.0
3flask-babel==2.0.0
4−flask==1.1.2
4+flask==2.0.2
5−idna==2.10
6−jinja2==2.11.3
5+jinja2==3.0.3
7−lxml==4.6.3
6+lxml==4.7.1
8pygments==2.8.0
7pygments==2.8.0
9−python-dateutil==2.8.1
8+python-dateutil==2.8.2
10−pyyaml==5.4.1
9+pyyaml==6.0
11−requests[socks]==2.25.1
10+httpx[http2]==0.21.3
11+Brotli==1.0.9
12+uvloop==0.16.0; python_version >= '3.7'
13+uvloop==0.14.0; python_version < '3.7'
14+httpx-socks[asyncio]==0.7.2
12−langdetect==1.0.8
15+langdetect==1.0.9
16+setproctitle==1.2.2
searx/autocomplete.py+28−10
@@ -20,10 +20,12 @@ from lxml import etree
20from json import loads
20from json import loads
21from urllib.parse import urlencode
21from urllib.parse import urlencode
22
22
23−from requests import RequestException
23+from httpx import HTTPError
24+
24
25
25from searx import settings
26from searx import settings
27+from searx.data import ENGINES_LANGUAGES
26−from searx.poolrequests import get as http_get
28+from searx.network import get as http_get
27from searx.exceptions import SearxEngineResponseException
29from searx.exceptions import SearxEngineResponseException
28
30
29
31
@@ -34,6 +36,22 @@ def get(*args, **kwargs):
34 return http_get(*args, **kwargs)
36 return http_get(*args, **kwargs)
35
37
36
38
39+def brave(query, lang):
40+ # brave search autocompleter
41+ url = 'https://search.brave.com/api/suggest?{query}'
42+
43+ resp = get(url.format(query=urlencode({'q': query})))
44+
45+ results = []
46+
47+ if resp.ok:
48+ data = loads(resp.text)
49+ for suggestion in data[1]:
50+ results.append(suggestion)
51+
52+ return results
53+
54+
37def dbpedia(query, lang):
55def dbpedia(query, lang):
38 # dbpedia autocompleter, no HTTPS
56 # dbpedia autocompleter, no HTTPS
39 autocomplete_url = 'https://lookup.dbpedia.org/api/search.asmx/KeywordSearch?'
57 autocomplete_url = 'https://lookup.dbpedia.org/api/search.asmx/KeywordSearch?'
@@ -76,12 +94,11 @@ def google(query, lang):
76
94
77def startpage(query, lang):
95def startpage(query, lang):
78 # startpage autocompleter
96 # startpage autocompleter
97+ lui = ENGINES_LANGUAGES['startpage'].get(lang, 'english')
79− url = 'https://startpage.com/do/suggest?{query}'
98+ url = 'https://startpage.com/suggestions?{query}'
80−
81− resp = get(url.format(query=urlencode({'query': query}))).text.split('\n')
99+ resp = get(url.format(query=urlencode({'q': query, 'segment': 'startpage.udog', 'lui': lui})))
82− if len(resp) > 1:
100+ data = resp.json()
83− return resp
101+ return [e['text'] for e in data.get('suggestions', []) if 'text' in e]
84− return []
85
102
86
103
87def swisscows(query, lang):
104def swisscows(query, lang):
@@ -119,7 +136,8 @@ def wikipedia(query, lang):
119 return []
136 return []
120
137
121
138
139+backends = {'brave': brave,
122−backends = {'dbpedia': dbpedia,
140+ 'dbpedia': dbpedia,
123 'duckduckgo': duckduckgo,
141 'duckduckgo': duckduckgo,
124 'google': google,
142 'google': google,
125 'startpage': startpage,
143 'startpage': startpage,
@@ -136,5 +154,5 @@ def search_autocomplete(backend_name, query, lang):
136
154
137 try:
155 try:
138 return backend(query, lang)
156 return backend(query, lang)
139− except (RequestException, SearxEngineResponseException):
157+ except (HTTPError, SearxEngineResponseException):
140 return []
158 return []
searx/data/__init__.py+39−14
@@ -1,25 +1,50 @@
1+# SPDX-License-Identifier: AGPL-3.0-or-later
2+# lint: pylint
3+"""This module holds the *data* created by::
4+
5+ make data.all
6+
7+"""
8+
9+__all__ = [
10+ 'ENGINES_LANGUAGES',
11+ 'CURRENCIES',
12+ 'USER_AGENTS',
13+ 'EXTERNAL_URLS',
14+ 'WIKIDATA_UNITS',
15+ 'EXTERNAL_BANGS',
16+ 'OSM_KEYS_TAGS',
17+ 'ahmia_blacklist_loader',
18+]
19+
1import json
20import json
2from pathlib import Path
21from pathlib import Path
3
22
4−
5−__init__ = ['ENGINES_LANGUGAGES', 'CURRENCIES', 'USER_AGENTS', 'EXTERNAL_URLS', 'WIKIDATA_UNITS', 'EXTERNAL_BANGS',
6− 'bangs_loader', 'ahmia_blacklist_loader']
7data_dir = Path(__file__).parent
23data_dir = Path(__file__).parent
8
24
9
25
10−def load(filename):
26+def _load(filename):
11− with open(data_dir / filename, encoding='utf-8') as fd:
27+ with open(data_dir / filename, encoding='utf-8') as f:
12− return json.load(fd)
28+ return json.load(f)
13
29
14
30
15def ahmia_blacklist_loader():
31def ahmia_blacklist_loader():
32+ """Load data from `ahmia_blacklist.txt` and return a list of MD5 values of onion
33+ names. The MD5 values are fetched by::
34+
35+ searx_extra/update/update_ahmia_blacklist.py
36+
37+ This function is used by :py:mod:`searx.plugins.ahmia_filter`.
38+
39+ """
16− with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as fd:
40+ with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as f:
17− return fd.read().split()
41+ return f.read().split()
18
42
19
43
20−ENGINES_LANGUAGES = load('engines_languages.json')
44+ENGINES_LANGUAGES = _load('engines_languages.json')
21−CURRENCIES = load('currencies.json')
45+CURRENCIES = _load('currencies.json')
22−USER_AGENTS = load('useragents.json')
46+USER_AGENTS = _load('useragents.json')
23−EXTERNAL_URLS = load('external_urls.json')
47+EXTERNAL_URLS = _load('external_urls.json')
24−WIKIDATA_UNITS = load('wikidata_units.json')
48+WIKIDATA_UNITS = _load('wikidata_units.json')
25−EXTERNAL_BANGS = load('external_bangs.json')
49+EXTERNAL_BANGS = _load('external_bangs.json')
50+OSM_KEYS_TAGS = _load('osm_keys_tags.json')
searx/data/ahmia_blacklist.txt+11140

This diff is too big to show here.

searx/data/currencies.json+303−334

This diff is too big to show here.

searx/data/engines_languages.json+197−497

This diff is too big to show here.

searx/data/external_bangs.json+5826−5825

This diff is too big to show here.

searx/data/osm_keys_tags.jsonnew file+15416

This diff is too big to show here.

searx/data/useragents.json+4−3

This diff is too big to show here.

searx/data/wikidata_units.json+129−20

This diff is too big to show here.

searx/engines/__init__.py+6−6

This diff is too big to show here.

searx/engines/ahmia.py+2−2

This diff is too big to show here.

searx/engines/bandcamp.pynew file+73

This diff is too big to show here.

searx/engines/command.py+1−1

This diff is too big to show here.

searx/engines/core.pynew file+82

This diff is too big to show here.

searx/engines/dictzone.py+1−1

This diff is too big to show here.

searx/engines/duckduckgo.py+97−48

This diff is too big to show here.

searx/engines/duckduckgo_images.py+1−1

This diff is too big to show here.

searx/engines/elasticsearch.py+1−2

This diff is too big to show here.

searx/engines/gigablast.py+25−14

This diff is too big to show here.

searx/engines/google.py+81−54

This diff is too big to show here.

searx/engines/google_images.py+6−7

This diff is too big to show here.

searx/engines/google_news.py+6−7

This diff is too big to show here.

searx/engines/google_scholar.py+4−5

This diff is too big to show here.

searx/engines/google_videos.py+5−6

This diff is too big to show here.

searx/engines/imdb.pynew file+55

This diff is too big to show here.

searx/engines/invidious.py+2−2

This diff is too big to show here.

searx/engines/meilisearch.py+1−1

This diff is too big to show here.

searx/engines/mongodb.pynew file+61

This diff is too big to show here.

searx/engines/mysql_server.pynew file+62

This diff is too big to show here.

searx/engines/not_evil.pydeleted−67

This diff is too big to show here.

searx/engines/onesearch.pynew file+57

This diff is too big to show here.

searx/engines/openstreetmap.py+397−67

This diff is too big to show here.

searx/engines/postgresql.pynew file+69

This diff is too big to show here.

searx/engines/prowlarr.pynew file+80

This diff is too big to show here.

searx/engines/pubmed.py+1−1

This diff is too big to show here.

searx/engines/qwant.py+184−78

This diff is too big to show here.

searx/engines/redis_server.pynew file+69

This diff is too big to show here.

searx/engines/rumble.py+1−1

This diff is too big to show here.

searx/engines/seznam.py+5−6

This diff is too big to show here.

searx/engines/sjp.pynew file+92

This diff is too big to show here.

searx/engines/solidtorrents.py+1−1

This diff is too big to show here.

searx/engines/soundcloud.py+1−1

This diff is too big to show here.

searx/engines/spotify.py+3−2

This diff is too big to show here.

searx/engines/springer.pynew file+74

This diff is too big to show here.

searx/engines/sqlite.pynew file+51

This diff is too big to show here.

searx/engines/stackexchange.pynew file+67

This diff is too big to show here.

searx/engines/stackoverflow.pydeleted−65

This diff is too big to show here.

searx/engines/startpage.py+100−20

This diff is too big to show here.

searx/engines/tineye.pynew file+86

This diff is too big to show here.

searx/engines/wikidata.py+1−1

This diff is too big to show here.

searx/engines/wikipedia.py+1−1

This diff is too big to show here.

searx/engines/wolframalpha_noapi.py+1−1

This diff is too big to show here.

searx/engines/wordnik.py+1−1

This diff is too big to show here.

searx/engines/xpath.py+3−1

This diff is too big to show here.

searx/engines/xpath_flex.pynew file+121

This diff is too big to show here.

searx/engines/yacy.py+2−2

This diff is too big to show here.

searx/engines/yahoo.py+93−91

This diff is too big to show here.

searx/engines/yggtorrent.py+3−3

This diff is too big to show here.

searx/engines/youtube_noapi.py+2

This diff is too big to show here.

searx/external_urls.py+14−2

This diff is too big to show here.

searx/metrology/error_recorder.py+9−9

This diff is too big to show here.

searx/network/__init__.pynew file+188

This diff is too big to show here.

searx/network/client.pynew file+219

This diff is too big to show here.

searx/network/network.pynew file+358

This diff is too big to show here.

searx/raise_for_httperror.py → searx/network/raise_for_httperror.pyrenamed

The content is the same.

searx/plugins/__init__.py+2

This diff is too big to show here.

searx/plugins/hostname_replace.pynew file+28

This diff is too big to show here.

searx/plugins/self_info.py+1−1

This diff is too big to show here.

searx/plugins/tracker_url_remover.py+1−1

This diff is too big to show here.

searx/poolrequests.pydeleted−235

This diff is too big to show here.

searx/preferences.py+7−7

This diff is too big to show here.

searx/results.py+20−6

This diff is too big to show here.

searx/search/__init__.py+5−2

This diff is too big to show here.

searx/search/checker/impl.py+6−6

This diff is too big to show here.

searx/search/processors/online.py+23−26

This diff is too big to show here.

searx/settings.yml+447−57

This diff is too big to show here.

searx/settings_loader.py+2−2

This diff is too big to show here.

searx/settings_robot.yml+8−2

This diff is too big to show here.

searx/static/themes/simple/js/searx_src/searx_imageresult.js → searx/static/themes/__common__/js/image_layout.jsrenamed+61−49

This diff is too big to show here.

searx/static/themes/oscar/css/logicodev-dark.css+29−2

This diff is too big to show here.

searx/static/themes/oscar/css/logicodev-dark.min.css+1−1

This diff is too big to show here.

searx/static/themes/oscar/css/logicodev-dark.min.css.map+1−1

This diff is too big to show here.

searx/static/themes/oscar/css/logicodev.css+29−2

This diff is too big to show here.

searx/static/themes/oscar/css/logicodev.min.css+1−1

This diff is too big to show here.

searx/static/themes/oscar/css/logicodev.min.css.map+1−1

This diff is too big to show here.

searx/static/themes/oscar/gruntfile.js+2−2

This diff is too big to show here.

searx/static/themes/oscar/img/icons/bandcamp.pngnew file

Binary file not shown.

searx/static/themes/oscar/js/searx.js+172−83

This diff is too big to show here.

searx/static/themes/oscar/js/searx.min.js+2−2

This diff is too big to show here.

searx/static/themes/oscar/js/searx.min.js.map+1−1

This diff is too big to show here.

searx/static/themes/oscar/src/js/01_init.js+3

This diff is too big to show here.

searx/static/themes/oscar/src/js/element_modifiers.js+6

This diff is too big to show here.

searx/static/themes/oscar/src/js/leaflet_map.js−83

This diff is too big to show here.

searx/static/themes/oscar/src/less/logicodev/results.less+59−2

This diff is too big to show here.

searx/static/themes/oscar/src/less/logicodev/search.less+2

This diff is too big to show here.

searx/static/themes/simple/css/searx-rtl.css+1−1

This diff is too big to show here.

searx/static/themes/simple/css/searx-rtl.min.css+1−1

This diff is too big to show here.

searx/static/themes/simple/css/searx.css+1−1

This diff is too big to show here.

searx/static/themes/simple/css/searx.min.css+1−1

This diff is too big to show here.

searx/static/themes/simple/gruntfile.js+2−2

This diff is too big to show here.

searx/static/themes/simple/js/searx.head.min.js+1−1

This diff is too big to show here.

searx/static/themes/simple/js/searx.js+164−239

This diff is too big to show here.

searx/static/themes/simple/js/searx.min.js+5−4

This diff is too big to show here.

searx/static/themes/simple/js/searx.min.js.map+1−1

This diff is too big to show here.

searx/static/themes/simple/js/searx_src/searx_mapresult.js−87

This diff is too big to show here.

searx/static/themes/simple/js/searx_src/searx_results.js+1−1

This diff is too big to show here.

searx/static/themes/simple/less/style.less+32

This diff is too big to show here.

searx/templates/oscar/base.html+1−1

This diff is too big to show here.

searx/templates/oscar/preferences.html+1−1

This diff is too big to show here.

searx/templates/oscar/result_templates/default.html+2−2

This diff is too big to show here.

searx/templates/oscar/result_templates/key-value.html+2−2

This diff is too big to show here.

searx/templates/oscar/result_templates/map.html+52−48

This diff is too big to show here.

searx/templates/oscar/result_templates/products.html+2−1

This diff is too big to show here.

searx/templates/simple/result_templates/map.html+35−52

This diff is too big to show here.

searx/testing.py+3−3

This diff is too big to show here.

searx/utils.py+13−7

This diff is too big to show here.

searx/webadapter.py+1−1

This diff is too big to show here.

searx/webapp.py+125−48

This diff is too big to show here.

searx_extra/standalone_searx.py+1−1

This diff is too big to show here.

searx_extra/update/update_engine_descriptions.py+3−3

This diff is too big to show here.

searx_extra/update/update_external_bangs.py+4−4

This diff is too big to show here.

searx_extra/update/update_osm_keys_tags.pynew file+209

This diff is too big to show here.

tests/unit/network/__init__.pynew file

No changes to the content.

tests/unit/network/test_network.pynew file+239

This diff is too big to show here.

tests/unit/test_engines_init.py+1−1

This diff is too big to show here.

tests/unit/test_external_bangs.py−6

This diff is too big to show here.

tests/unit/test_poolrequests.pydeleted−89

This diff is too big to show here.

tests/unit/test_query.py+10−5

This diff is too big to show here.

tests/unit/test_results.py+4−4

This diff is too big to show here.

tests/unit/test_utils.py+2−2

This diff is too big to show here.

tests/unit/test_webapp.py+12−3

This diff is too big to show here.

utils/filtron.sh+2−2

This diff is too big to show here.

utils/lib.sh+311−4

This diff is too big to show here.

utils/lxc.sh+2−2

This diff is too big to show here.

utils/makefile.include+10−49

This diff is too big to show here.

utils/makefile.pythondeleted−269

This diff is too big to show here.

utils/makefile.sphinxdeleted−199

This diff is too big to show here.

utils/searx.sh+3−3

This diff is too big to show here.

utils/site-python/sphinx_build_tools.pydeleted−48

This diff is too big to show here.