Remove Duplicated Dependencies and PEP 517 Support (#2173)
* Remove duplicated dependencies * Specify setuptools as the tool for generating distribution (PEP 517) * Add `isort` to `dev_require` * manage all dependencies in setup.py * Execute `make pretty` * Set usedevelop to true (revert previous change)
This commit is contained in:
parent
a90877ac31
commit
1dd0332e8b
3
pyproject.toml
Normal file
3
pyproject.toml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[build-system]
|
||||||
|
requires = ["setuptools", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
27
setup.py
27
setup.py
|
@ -81,7 +81,7 @@ env_dependency = (
|
||||||
)
|
)
|
||||||
ujson = "ujson>=1.35" + env_dependency
|
ujson = "ujson>=1.35" + env_dependency
|
||||||
uvloop = "uvloop>=0.5.3" + env_dependency
|
uvloop = "uvloop>=0.5.3" + env_dependency
|
||||||
|
types_ujson = "types-ujson" + env_dependency
|
||||||
requirements = [
|
requirements = [
|
||||||
"sanic-routing==0.7.0",
|
"sanic-routing==0.7.0",
|
||||||
"httptools>=0.0.10",
|
"httptools>=0.0.10",
|
||||||
|
@ -95,46 +95,49 @@ requirements = [
|
||||||
tests_require = [
|
tests_require = [
|
||||||
"sanic-testing>=0.6.0",
|
"sanic-testing>=0.6.0",
|
||||||
"pytest==5.2.1",
|
"pytest==5.2.1",
|
||||||
"multidict>=5.0,<6.0",
|
"coverage==5.3",
|
||||||
"gunicorn==20.0.4",
|
"gunicorn==20.0.4",
|
||||||
"pytest-cov",
|
"pytest-cov",
|
||||||
"beautifulsoup4",
|
"beautifulsoup4",
|
||||||
uvloop,
|
|
||||||
ujson,
|
|
||||||
"pytest-sanic",
|
"pytest-sanic",
|
||||||
"pytest-sugar",
|
"pytest-sugar",
|
||||||
"pytest-benchmark",
|
"pytest-benchmark",
|
||||||
|
"chardet==3.*",
|
||||||
|
"flake8",
|
||||||
|
"black",
|
||||||
|
"isort>=5.0.0",
|
||||||
|
"bandit",
|
||||||
|
"mypy>=0.901",
|
||||||
|
"docutils",
|
||||||
|
"pygments",
|
||||||
|
"uvicorn",
|
||||||
|
types_ujson,
|
||||||
]
|
]
|
||||||
|
|
||||||
docs_require = [
|
docs_require = [
|
||||||
"sphinx>=2.1.2",
|
"sphinx>=2.1.2",
|
||||||
"sphinx_rtd_theme",
|
"sphinx_rtd_theme>=0.4.3",
|
||||||
"recommonmark>=0.5.0",
|
"recommonmark>=0.5.0",
|
||||||
"docutils",
|
"docutils",
|
||||||
"pygments",
|
"pygments",
|
||||||
]
|
]
|
||||||
|
|
||||||
dev_require = tests_require + [
|
dev_require = tests_require + [
|
||||||
"aiofiles",
|
|
||||||
"tox",
|
"tox",
|
||||||
"black",
|
|
||||||
"flake8",
|
|
||||||
"bandit",
|
|
||||||
"towncrier",
|
"towncrier",
|
||||||
]
|
]
|
||||||
|
|
||||||
all_require = dev_require + docs_require
|
all_require = list(set(dev_require + docs_require))
|
||||||
|
|
||||||
if strtobool(os.environ.get("SANIC_NO_UJSON", "no")):
|
if strtobool(os.environ.get("SANIC_NO_UJSON", "no")):
|
||||||
print("Installing without uJSON")
|
print("Installing without uJSON")
|
||||||
requirements.remove(ujson)
|
requirements.remove(ujson)
|
||||||
tests_require.remove(ujson)
|
tests_require.remove(types_ujson)
|
||||||
|
|
||||||
# 'nt' means windows OS
|
# 'nt' means windows OS
|
||||||
if strtobool(os.environ.get("SANIC_NO_UVLOOP", "no")):
|
if strtobool(os.environ.get("SANIC_NO_UVLOOP", "no")):
|
||||||
print("Installing without uvLoop")
|
print("Installing without uvLoop")
|
||||||
requirements.remove(uvloop)
|
requirements.remove(uvloop)
|
||||||
tests_require.remove(uvloop)
|
|
||||||
|
|
||||||
extras_require = {
|
extras_require = {
|
||||||
"test": tests_require,
|
"test": tests_require,
|
||||||
|
|
53
tox.ini
53
tox.ini
|
@ -2,23 +2,11 @@
|
||||||
envlist = py37, py38, py39, pyNightly, pypy37, {py37,py38,py39,pyNightly,pypy37}-no-ext, lint, check, security, docs, type-checking
|
envlist = py37, py38, py39, pyNightly, pypy37, {py37,py38,py39,pyNightly,pypy37}-no-ext, lint, check, security, docs, type-checking
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
usedevelop = True
|
usedevelop = true
|
||||||
setenv =
|
setenv =
|
||||||
{py37,py38,py39,pyNightly}-no-ext: SANIC_NO_UJSON=1
|
{py37,py38,py39,pyNightly}-no-ext: SANIC_NO_UJSON=1
|
||||||
{py37,py38,py39,pyNightly}-no-ext: SANIC_NO_UVLOOP=1
|
{py37,py38,py39,pyNightly}-no-ext: SANIC_NO_UVLOOP=1
|
||||||
deps =
|
extras = test
|
||||||
sanic-testing>=0.6.0
|
|
||||||
coverage==5.3
|
|
||||||
pytest==5.2.1
|
|
||||||
pytest-cov
|
|
||||||
pytest-sanic
|
|
||||||
pytest-sugar
|
|
||||||
pytest-benchmark
|
|
||||||
chardet==3.*
|
|
||||||
beautifulsoup4
|
|
||||||
gunicorn==20.0.4
|
|
||||||
uvicorn
|
|
||||||
websockets>=9.0
|
|
||||||
commands =
|
commands =
|
||||||
pytest {posargs:tests --cov sanic}
|
pytest {posargs:tests --cov sanic}
|
||||||
- coverage combine --append
|
- coverage combine --append
|
||||||
|
@ -26,29 +14,16 @@ commands =
|
||||||
coverage html -i
|
coverage html -i
|
||||||
|
|
||||||
[testenv:lint]
|
[testenv:lint]
|
||||||
deps =
|
|
||||||
flake8
|
|
||||||
black
|
|
||||||
isort>=5.0.0
|
|
||||||
bandit
|
|
||||||
|
|
||||||
commands =
|
commands =
|
||||||
flake8 sanic
|
flake8 sanic
|
||||||
black --config ./.black.toml --check --verbose sanic/
|
black --config ./.black.toml --check --verbose sanic/
|
||||||
isort --check-only sanic --profile=black
|
isort --check-only sanic --profile=black
|
||||||
|
|
||||||
[testenv:type-checking]
|
[testenv:type-checking]
|
||||||
deps =
|
|
||||||
mypy>=0.901
|
|
||||||
types-ujson
|
|
||||||
|
|
||||||
commands =
|
commands =
|
||||||
mypy sanic
|
mypy sanic
|
||||||
|
|
||||||
[testenv:check]
|
[testenv:check]
|
||||||
deps =
|
|
||||||
docutils
|
|
||||||
pygments
|
|
||||||
commands =
|
commands =
|
||||||
python setup.py check -r -s
|
python setup.py check -r -s
|
||||||
|
|
||||||
|
@ -60,8 +35,6 @@ markers =
|
||||||
asyncio
|
asyncio
|
||||||
|
|
||||||
[testenv:security]
|
[testenv:security]
|
||||||
deps =
|
|
||||||
bandit
|
|
||||||
|
|
||||||
commands =
|
commands =
|
||||||
bandit --recursive sanic --skip B404,B101 --exclude sanic/reloader_helpers.py
|
bandit --recursive sanic --skip B404,B101 --exclude sanic/reloader_helpers.py
|
||||||
|
@ -69,30 +42,10 @@ commands =
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
platform = linux|linux2|darwin
|
platform = linux|linux2|darwin
|
||||||
whitelist_externals = make
|
whitelist_externals = make
|
||||||
deps =
|
extras = docs
|
||||||
sphinx>=2.1.2
|
|
||||||
sphinx_rtd_theme>=0.4.3
|
|
||||||
recommonmark>=0.5.0
|
|
||||||
docutils
|
|
||||||
pygments
|
|
||||||
gunicorn==20.0.4
|
|
||||||
commands =
|
commands =
|
||||||
make docs-test
|
make docs-test
|
||||||
|
|
||||||
[testenv:coverage]
|
[testenv:coverage]
|
||||||
usedevelop = True
|
|
||||||
deps =
|
|
||||||
sanic-testing>=0.6.0
|
|
||||||
coverage==5.3
|
|
||||||
pytest==5.2.1
|
|
||||||
pytest-cov
|
|
||||||
pytest-sanic
|
|
||||||
pytest-sugar
|
|
||||||
pytest-benchmark
|
|
||||||
chardet==3.*
|
|
||||||
beautifulsoup4
|
|
||||||
gunicorn==20.0.4
|
|
||||||
uvicorn
|
|
||||||
websockets>=9.0
|
|
||||||
commands =
|
commands =
|
||||||
pytest tests --cov=./sanic --cov-report=xml
|
pytest tests --cov=./sanic --cov-report=xml
|
||||||
|
|
Loading…
Reference in New Issue
Block a user