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
|
||||
uvloop = "uvloop>=0.5.3" + env_dependency
|
||||
|
||||
types_ujson = "types-ujson" + env_dependency
|
||||
requirements = [
|
||||
"sanic-routing==0.7.0",
|
||||
"httptools>=0.0.10",
|
||||
|
@ -95,46 +95,49 @@ requirements = [
|
|||
tests_require = [
|
||||
"sanic-testing>=0.6.0",
|
||||
"pytest==5.2.1",
|
||||
"multidict>=5.0,<6.0",
|
||||
"coverage==5.3",
|
||||
"gunicorn==20.0.4",
|
||||
"pytest-cov",
|
||||
"beautifulsoup4",
|
||||
uvloop,
|
||||
ujson,
|
||||
"pytest-sanic",
|
||||
"pytest-sugar",
|
||||
"pytest-benchmark",
|
||||
"chardet==3.*",
|
||||
"flake8",
|
||||
"black",
|
||||
"isort>=5.0.0",
|
||||
"bandit",
|
||||
"mypy>=0.901",
|
||||
"docutils",
|
||||
"pygments",
|
||||
"uvicorn",
|
||||
types_ujson,
|
||||
]
|
||||
|
||||
docs_require = [
|
||||
"sphinx>=2.1.2",
|
||||
"sphinx_rtd_theme",
|
||||
"sphinx_rtd_theme>=0.4.3",
|
||||
"recommonmark>=0.5.0",
|
||||
"docutils",
|
||||
"pygments",
|
||||
]
|
||||
|
||||
dev_require = tests_require + [
|
||||
"aiofiles",
|
||||
"tox",
|
||||
"black",
|
||||
"flake8",
|
||||
"bandit",
|
||||
"towncrier",
|
||||
]
|
||||
|
||||
all_require = dev_require + docs_require
|
||||
all_require = list(set(dev_require + docs_require))
|
||||
|
||||
if strtobool(os.environ.get("SANIC_NO_UJSON", "no")):
|
||||
print("Installing without uJSON")
|
||||
requirements.remove(ujson)
|
||||
tests_require.remove(ujson)
|
||||
tests_require.remove(types_ujson)
|
||||
|
||||
# 'nt' means windows OS
|
||||
if strtobool(os.environ.get("SANIC_NO_UVLOOP", "no")):
|
||||
print("Installing without uvLoop")
|
||||
requirements.remove(uvloop)
|
||||
tests_require.remove(uvloop)
|
||||
|
||||
extras_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
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
usedevelop = true
|
||||
setenv =
|
||||
{py37,py38,py39,pyNightly}-no-ext: SANIC_NO_UJSON=1
|
||||
{py37,py38,py39,pyNightly}-no-ext: SANIC_NO_UVLOOP=1
|
||||
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
|
||||
extras = test
|
||||
commands =
|
||||
pytest {posargs:tests --cov sanic}
|
||||
- coverage combine --append
|
||||
|
@ -26,29 +14,16 @@ commands =
|
|||
coverage html -i
|
||||
|
||||
[testenv:lint]
|
||||
deps =
|
||||
flake8
|
||||
black
|
||||
isort>=5.0.0
|
||||
bandit
|
||||
|
||||
commands =
|
||||
flake8 sanic
|
||||
black --config ./.black.toml --check --verbose sanic/
|
||||
isort --check-only sanic --profile=black
|
||||
|
||||
[testenv:type-checking]
|
||||
deps =
|
||||
mypy>=0.901
|
||||
types-ujson
|
||||
|
||||
commands =
|
||||
mypy sanic
|
||||
|
||||
[testenv:check]
|
||||
deps =
|
||||
docutils
|
||||
pygments
|
||||
commands =
|
||||
python setup.py check -r -s
|
||||
|
||||
|
@ -60,8 +35,6 @@ markers =
|
|||
asyncio
|
||||
|
||||
[testenv:security]
|
||||
deps =
|
||||
bandit
|
||||
|
||||
commands =
|
||||
bandit --recursive sanic --skip B404,B101 --exclude sanic/reloader_helpers.py
|
||||
|
@ -69,30 +42,10 @@ commands =
|
|||
[testenv:docs]
|
||||
platform = linux|linux2|darwin
|
||||
whitelist_externals = make
|
||||
deps =
|
||||
sphinx>=2.1.2
|
||||
sphinx_rtd_theme>=0.4.3
|
||||
recommonmark>=0.5.0
|
||||
docutils
|
||||
pygments
|
||||
gunicorn==20.0.4
|
||||
extras = docs
|
||||
commands =
|
||||
make docs-test
|
||||
|
||||
[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 =
|
||||
pytest tests --cov=./sanic --cov-report=xml
|
||||
|
|
Loading…
Reference in New Issue
Block a user