mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Version: rely on pyproject.toml and setuptools_scm
Move brand information to Python package rather than settings.yml `pip install .` works with the right version. Dependencies are moved to setup.py requirements.txt contains the dev dependencies. requirements-dev.txt is removed "make install" is broken
This commit is contained in:
parent
675dc04917
commit
3a14cf0efe
6 changed files with 98 additions and 76 deletions
8
pyproject.toml
Normal file
8
pyproject.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
[build-system]
|
||||
requires = [
|
||||
"setuptools>=45",
|
||||
"setuptools_scm[toml]>=6.2",
|
||||
"wheel",
|
||||
"pyaml"
|
||||
]
|
||||
build-backend = "setuptools.build_meta"
|
|
@ -1,22 +0,0 @@
|
|||
mock==5.0.1
|
||||
nose2[coverage_plugin]==0.12.0
|
||||
cov-core==1.15.0
|
||||
black==22.12.0
|
||||
pylint==2.16.1
|
||||
splinter==0.19.0
|
||||
selenium==4.8.0
|
||||
twine==4.0.2
|
||||
Pallets-Sphinx-Themes==2.0.3
|
||||
Sphinx==5.3.0
|
||||
sphinx-issues==3.0.1
|
||||
sphinx-jinja==2.0.2
|
||||
sphinx-tabs==3.4.1
|
||||
sphinxcontrib-programoutput==0.17
|
||||
sphinx-autobuild==2021.3.14
|
||||
sphinx-notfound-page==0.8.3
|
||||
myst-parser==0.18.1
|
||||
linuxdoc==20221127
|
||||
aiounittest==1.4.2
|
||||
yamllint==1.29.0
|
||||
wlc==1.13
|
||||
coloredlogs==15.0.1
|
|
@ -1,18 +1,23 @@
|
|||
certifi==2022.12.7
|
||||
babel==2.11.0
|
||||
flask-babel==3.0.1
|
||||
flask==2.2.2
|
||||
jinja2==3.1.2
|
||||
lxml==4.9.2
|
||||
pygments==2.14.0
|
||||
python-dateutil==2.8.2
|
||||
pyyaml==6.0
|
||||
httpx[http2]==0.21.2
|
||||
Brotli==1.0.9
|
||||
uvloop==0.17.0
|
||||
httpx-socks[asyncio]==0.7.2
|
||||
setproctitle==1.3.2
|
||||
redis==4.5.1
|
||||
markdown-it-py==2.1.0
|
||||
typing_extensions==4.4.0
|
||||
fasttext-predict==0.9.2.1
|
||||
-e .
|
||||
mock==5.0.1
|
||||
nose2[coverage_plugin]==0.12.0
|
||||
cov-core==1.15.0
|
||||
black==22.12.0
|
||||
pylint==2.16.1
|
||||
splinter==0.19.0
|
||||
selenium==4.8.0
|
||||
twine==4.0.2
|
||||
Pallets-Sphinx-Themes==2.0.3
|
||||
Sphinx==5.3.0
|
||||
sphinx-issues==3.0.1
|
||||
sphinx-jinja==2.0.2
|
||||
sphinx-tabs==3.4.1
|
||||
sphinxcontrib-programoutput==0.17
|
||||
sphinx-autobuild==2021.3.14
|
||||
sphinx-notfound-page==0.8.3
|
||||
myst-parser==0.18.1
|
||||
linuxdoc==20221127
|
||||
aiounittest==1.4.2
|
||||
yamllint==1.29.0
|
||||
wlc==1.13
|
||||
coloredlogs==15.0.1
|
|
@ -11,9 +11,26 @@ import os
|
|||
import logging
|
||||
from base64 import b64decode
|
||||
from os.path import dirname, abspath
|
||||
from importlib import metadata
|
||||
|
||||
from searx.languages import language_codes as languages
|
||||
|
||||
try:
|
||||
metadata = metadata.metadata('searxng')
|
||||
project_urls = {}
|
||||
for k, v in metadata.items():
|
||||
if k == 'Project-URL':
|
||||
url_type, url = v.split(',')
|
||||
project_urls[url_type.strip()] = url.strip()
|
||||
except metadata.PackageNotFoundError:
|
||||
project_urls = {
|
||||
"Code": "https://github.com/searxng/searxng",
|
||||
"Documentation": 'https://docs.searxng.org/',
|
||||
"Issue tracker": 'https://github.com/searxng/searxng/issues',
|
||||
"New issue": 'https://github.com/searxng/searxng/issues/new',
|
||||
'Public instances': 'https//searx.space',
|
||||
}
|
||||
|
||||
searx_dir = abspath(dirname(__file__))
|
||||
|
||||
logger = logging.getLogger('searx')
|
||||
|
@ -146,11 +163,10 @@ SCHEMA = {
|
|||
'enable_metrics': SettingsValue(bool, True),
|
||||
},
|
||||
'brand': {
|
||||
'issue_url': SettingsValue(str, 'https://github.com/searxng/searxng/issues'),
|
||||
'new_issue_url': SettingsValue(str, 'https://github.com/searxng/searxng/issues/new'),
|
||||
'docs_url': SettingsValue(str, 'https://docs.searxng.org'),
|
||||
'public_instances': SettingsValue((False, str), 'https://searx.space'),
|
||||
'wiki_url': SettingsValue(str, 'https://github.com/searxng/searxng/wiki'),
|
||||
'issue_url': SettingsValue(str, project_urls['Issue tracker']),
|
||||
'new_issue_url': SettingsValue(str, project_urls['New issue']),
|
||||
'docs_url': SettingsValue(str, project_urls['Documentation']),
|
||||
'public_instances': SettingsValue((False, str), project_urls['Public instances']),
|
||||
},
|
||||
'search': {
|
||||
'safe_search': SettingsValue((0, 1, 2), 0),
|
||||
|
|
71
setup.py
71
setup.py
|
@ -1,31 +1,41 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Installer for SearXNG package."""
|
||||
|
||||
from setuptools import setup
|
||||
from setuptools import find_packages
|
||||
|
||||
from searx.version import VERSION_TAG, GIT_URL
|
||||
from searx import get_setting
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
with open('README.rst', encoding='utf-8') as f:
|
||||
long_description = f.read()
|
||||
|
||||
with open('requirements.txt') as f:
|
||||
requirements = [ l.strip() for l in f.readlines()]
|
||||
|
||||
with open('requirements-dev.txt') as f:
|
||||
dev_requirements = [ l.strip() for l in f.readlines()]
|
||||
def version_yyyymmdd_tag():
|
||||
from setuptools_scm.version import ScmVersion
|
||||
|
||||
def custom_version_scheme(version: ScmVersion):
|
||||
return f"{version.node_date.year}.{version.node_date.month}.{version.node_date.day}+{version.node}"
|
||||
|
||||
def custom_local_scheme(version: ScmVersion):
|
||||
return '.dirty' if version.dirty else ''
|
||||
|
||||
return {
|
||||
'write_to': 'searx/_version.py',
|
||||
'version_scheme': custom_version_scheme,
|
||||
'local_scheme': custom_local_scheme
|
||||
}
|
||||
|
||||
|
||||
setup(
|
||||
name='searxng',
|
||||
python_requires=">=3.7",
|
||||
version=VERSION_TAG,
|
||||
description="A privacy-respecting, hackable metasearch engine",
|
||||
long_description=long_description,
|
||||
url=get_setting('brand.docs_url'),
|
||||
use_scm_version=version_yyyymmdd_tag,
|
||||
url='https://docs.searxng.org/',
|
||||
project_urls={
|
||||
"Code": GIT_URL,
|
||||
"Issue tracker": get_setting('brand.issue_url')
|
||||
"Code": 'https://github.com/searxng/searxng',
|
||||
"Documentation": 'https://docs.searxng.org/',
|
||||
"Issue tracker": 'https://github.com/searxng/searxng/issues',
|
||||
"New issue": 'https://github.com/searxng/searxng/issues/new',
|
||||
'Public instances': 'https//searx.space',
|
||||
},
|
||||
classifiers=[
|
||||
"Development Status :: 4 - Beta",
|
||||
|
@ -39,24 +49,38 @@ setup(
|
|||
author='SearXNG dev team',
|
||||
author_email='contact@searxng.org',
|
||||
license='GNU Affero General Public License',
|
||||
packages=find_packages(exclude=["tests*", "searxng_extra"]),
|
||||
packages=find_packages(exclude=["tests*", "searxng_extra*"]),
|
||||
zip_safe=False,
|
||||
install_requires=requirements,
|
||||
extras_require={
|
||||
'test': dev_requirements
|
||||
},
|
||||
install_requires=[
|
||||
'certifi==2022.12.7',
|
||||
'babel==2.11.0',
|
||||
'flask-babel==3.0.1',
|
||||
'flask==2.2.2',
|
||||
'jinja2==3.1.2',
|
||||
'lxml==4.9.2',
|
||||
'pygments==2.14.0',
|
||||
'python-dateutil==2.8.2',
|
||||
'pyyaml==6.0',
|
||||
'httpx[http2]==0.21.2',
|
||||
'Brotli==1.0.9',
|
||||
'uvloop==0.17.0',
|
||||
'httpx-socks[asyncio]==0.7.2',
|
||||
'setproctitle==1.3.2',
|
||||
'redis==4.5.1',
|
||||
'markdown-it-py==2.1.0',
|
||||
'typing_extensions==4.4.0',
|
||||
'fasttext-predict==0.9.2.1',
|
||||
],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'searx-run = searx.webapp:run',
|
||||
'searx-checker = searx.search.checker.__main__:main'
|
||||
'searxng = searx.webapp:run',
|
||||
'searxng-checker = searx.search.checker.__main__:main'
|
||||
]
|
||||
},
|
||||
package_data={
|
||||
'searx': [
|
||||
'settings.yml',
|
||||
'../README.rst',
|
||||
'../requirements.txt',
|
||||
'../requirements-dev.txt',
|
||||
'data/*',
|
||||
'info/*',
|
||||
'info/*/*',
|
||||
|
@ -68,9 +92,6 @@ setup(
|
|||
'static/*/*/*/*/*.*',
|
||||
'templates/*/*.*',
|
||||
'templates/*/*/*.*',
|
||||
'tests/*',
|
||||
'tests/*/*',
|
||||
'tests/*/*/*',
|
||||
'translations/*/*/*'
|
||||
],
|
||||
},
|
||||
|
|
|
@ -488,9 +488,6 @@ EOF
|
|||
info_msg "install needed python packages"
|
||||
tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
|
||||
pip install -U pip
|
||||
pip install -U setuptools
|
||||
pip install -U wheel
|
||||
pip install -U pyyaml
|
||||
cd ${SEARXNG_SRC}
|
||||
pip install -e .
|
||||
EOF
|
||||
|
@ -558,9 +555,6 @@ cd ${SEARXNG_SRC}
|
|||
git fetch origin "$GIT_BRANCH"
|
||||
git reset --hard "origin/$GIT_BRANCH"
|
||||
pip install -U pip
|
||||
pip install -U setuptools
|
||||
pip install -U wheel
|
||||
pip install -U pyyaml
|
||||
pip install -U -e .
|
||||
EOF
|
||||
rst_para "update instance's settings.yml from ${SEARXNG_SETTINGS_PATH}"
|
||||
|
|
Loading…
Add table
Reference in a new issue