diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..9787c3bd --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 0e25fb7a..3bdd68b0 100644 --- a/setup.py +++ b/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, diff --git a/tests/test_config.py b/tests/test_config.py index ce790800..42a7e3ec 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -13,7 +13,7 @@ from sanic.exceptions import PyFileError @contextmanager def temp_path(): - """ a simple cross platform replacement for NamedTemporaryFile """ + """a simple cross platform replacement for NamedTemporaryFile""" with TemporaryDirectory() as td: yield Path(td, "file") diff --git a/tests/test_logging.py b/tests/test_logging.py index 5f531670..ba9f93a8 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -111,7 +111,7 @@ def test_logging_pass_customer_logconfig(): ), ) def test_log_connection_lost(app, debug, monkeypatch): - """ Should not log Connection lost exception on non debug """ + """Should not log Connection lost exception on non debug""" stream = StringIO() error = logging.getLogger("sanic.error") error.addHandler(logging.StreamHandler(stream)) diff --git a/tox.ini b/tox.ini index 590dc25a..3d4e35b8 100644 --- a/tox.ini +++ b/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