Use tox.ini formatter (#1948)
This commit is contained in:
parent
8636e51747
commit
864e9c49ba
3 changed files with 147 additions and 127 deletions
2
.github/workflows/check.yml
vendored
2
.github/workflows/check.yml
vendored
|
|
@ -39,7 +39,7 @@ jobs:
|
|||
- pypy2
|
||||
include:
|
||||
- {os: MacOs, py: brew@py3}
|
||||
- {os: MacOs, py: brew@py2}
|
||||
- {os: MacOs, py: https://raw.githubusercontent.com/Homebrew/homebrew-core/86a44a0a552c673a05f11018459c9f5faae3becc/Formula/python@2.rb}
|
||||
- {os: Ubuntu, py: 3.9-dev}
|
||||
steps:
|
||||
- name: install OS dependencies
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ repos:
|
|||
hooks:
|
||||
- id: pyupgrade
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.5.2
|
||||
rev: 5.5.3
|
||||
hooks:
|
||||
- id: isort
|
||||
- repo: https://github.com/ambv/black
|
||||
|
|
@ -35,13 +35,17 @@ repos:
|
|||
rev: v1.6.0
|
||||
hooks:
|
||||
- id: rst-backticks
|
||||
- repo: https://github.com/tox-dev/tox-ini-fmt
|
||||
rev: "8cbca0caa1e3ea4a7606e974da3966169c375988"
|
||||
hooks:
|
||||
- id: tox-ini-fmt
|
||||
- repo: https://github.com/asottile/setup-cfg-fmt
|
||||
rev: v1.11.0
|
||||
hooks:
|
||||
- id: setup-cfg-fmt
|
||||
args: [--min-py3-version, "3.4"]
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: "3.8.3"
|
||||
rev: "master"
|
||||
hooks:
|
||||
- id: flake8
|
||||
additional_dependencies: ["flake8-bugbear == 20.1.4"]
|
||||
|
|
|
|||
264
tox.ini
264
tox.ini
|
|
@ -1,111 +1,158 @@
|
|||
[tox]
|
||||
minversion = 3.14.0
|
||||
envlist =
|
||||
fix_lint
|
||||
py38
|
||||
py37
|
||||
py36
|
||||
py35
|
||||
py34
|
||||
py27
|
||||
pypy
|
||||
pypy3
|
||||
coverage
|
||||
readme
|
||||
docs
|
||||
py38
|
||||
py37
|
||||
py36
|
||||
py35
|
||||
py34
|
||||
py27
|
||||
fix_lint
|
||||
pypy3
|
||||
pypy
|
||||
coverage
|
||||
readme
|
||||
docs
|
||||
isolated_build = true
|
||||
skip_missing_interpreters = true
|
||||
minversion = 3.14.0
|
||||
|
||||
[testenv]
|
||||
description = run tests with {basepython}
|
||||
passenv =
|
||||
CI_RUN
|
||||
HOME
|
||||
PIP_*
|
||||
PYTEST_*
|
||||
TERM
|
||||
http_proxy
|
||||
https_proxy
|
||||
no_proxy
|
||||
setenv =
|
||||
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
|
||||
COVERAGE_PROCESS_START = {toxinidir}/.coveragerc
|
||||
_COVERAGE_SRC = {envsitepackagesdir}/virtualenv
|
||||
PYTHONIOENCODING=utf-8
|
||||
{py34,py27,pypy, upgrade}: PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command
|
||||
{pypy,py27}: PYTEST_XDIST = 0
|
||||
passenv = https_proxy http_proxy no_proxy HOME PYTEST_* PIP_* CI_RUN TERM
|
||||
extras = testing
|
||||
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
|
||||
COVERAGE_PROCESS_START = {toxinidir}/.coveragerc
|
||||
PYTHONIOENCODING = utf-8
|
||||
_COVERAGE_SRC = {envsitepackagesdir}/virtualenv
|
||||
{py34,py27,pypy, upgrade}: PYTHONWARNINGS = ignore:DEPRECATION::pip._internal.cli.base_command
|
||||
{pypy,py27}: PYTEST_XDIST = 0
|
||||
extras =
|
||||
testing
|
||||
commands =
|
||||
python -m coverage erase
|
||||
python -m coverage run -m pytest \
|
||||
--junitxml {toxworkdir}/junit.{envname}.xml \
|
||||
{posargs:tests --int --timeout 600 -n {env:PYTEST_XDIST:auto}}
|
||||
python -m coverage combine
|
||||
python -m coverage report --skip-covered --show-missing
|
||||
python -m coverage xml -o {toxworkdir}/coverage.{envname}.xml
|
||||
python -m coverage html -d {envtmpdir}/htmlcov
|
||||
install_command = python -m pip install {opts} {packages} --disable-pip-version-check
|
||||
commands =
|
||||
python -m coverage erase
|
||||
python -m coverage run -m pytest \
|
||||
--junitxml {toxworkdir}/junit.{envname}.xml \
|
||||
{posargs:tests --int --timeout 600 -n {env:PYTEST_XDIST:auto}}
|
||||
|
||||
python -m coverage combine
|
||||
python -m coverage report --skip-covered --show-missing
|
||||
python -m coverage xml -o {toxworkdir}/coverage.{envname}.xml
|
||||
python -m coverage html -d {envtmpdir}/htmlcov
|
||||
|
||||
[testenv:coverage]
|
||||
description = [run locally after tests]: combine coverage data and create report;
|
||||
generates a diff coverage against origin/main (can be changed by setting DIFF_AGAINST env var)
|
||||
deps =
|
||||
coverage >= 5.0.1
|
||||
diff_cover >= 3
|
||||
extras =
|
||||
skip_install = True
|
||||
passenv = DIFF_AGAINST
|
||||
setenv =
|
||||
COVERAGE_FILE={toxworkdir}/.coverage
|
||||
commands =
|
||||
python -m coverage combine
|
||||
python -m coverage report --skip-covered --show-missing
|
||||
python -m coverage xml -o {toxworkdir}/coverage.xml
|
||||
python -m coverage html -d {toxworkdir}/htmlcov
|
||||
python -m diff_cover.diff_cover_tool --compare-branch {env:DIFF_AGAINST:origin/main} {toxworkdir}/coverage.xml
|
||||
depends =
|
||||
py38
|
||||
py37
|
||||
py36
|
||||
py35
|
||||
py34
|
||||
py27
|
||||
pypy
|
||||
pypy3
|
||||
parallel_show_output = True
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python3.8
|
||||
description = build documentation
|
||||
extras = docs
|
||||
commands =
|
||||
python -c 'import glob; import subprocess; subprocess.call(["proselint"] + glob.glob("docs/*.rst") + glob.glob("docs/**/*.rst"))'
|
||||
sphinx-build -d "{envtmpdir}/doctree" docs "{toxworkdir}/docs_out" --color -b html {posargs}
|
||||
python -c 'import pathlib; print("documentation available under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "docs_out" / "index.html"))'
|
||||
|
||||
[testenv:readme]
|
||||
description = check that the long description is valid (need for PyPI)
|
||||
deps =
|
||||
twine >= 1.12.1
|
||||
pep517 >= 0.8.2
|
||||
skip_install = true
|
||||
extras =
|
||||
commands =
|
||||
python -m pep517.build -o {envtmpdir} -b -s .
|
||||
twine check {envtmpdir}/*
|
||||
|
||||
[testenv:upgrade]
|
||||
description = upgrade pip/wheels/setuptools to latest
|
||||
skip_install = true
|
||||
deps =
|
||||
black
|
||||
passenv = UPGRADE_ADVISORY
|
||||
changedir = {toxinidir}/tasks
|
||||
commands = python upgrade_wheels.py
|
||||
|
||||
[testenv:fix_lint]
|
||||
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
|
||||
passenv =
|
||||
*
|
||||
basepython = python3.8
|
||||
passenv = *
|
||||
skip_install = true
|
||||
deps =
|
||||
pre-commit >= 2
|
||||
skip_install = True
|
||||
pre-commit>=2
|
||||
commands =
|
||||
pre-commit run --all-files --show-diff-on-failure
|
||||
python -c 'import pathlib; print("hint: run \{\} install to add checks as pre-commit hook".format(pathlib.Path(r"{envdir}") / "bin" / "pre-commit"))'
|
||||
pre-commit run --all-files --show-diff-on-failure
|
||||
python -c 'import pathlib; print("hint: run \{\} install to add checks as pre-commit hook".format(pathlib.Path(r"{envdir}") / "bin" / "pre-commit"))'
|
||||
|
||||
[testenv:coverage]
|
||||
description = [run locally after tests]: combine coverage data and create report;
|
||||
generates a diff coverage against origin/main (can be changed by setting DIFF_AGAINST env var)
|
||||
passenv =
|
||||
DIFF_AGAINST
|
||||
setenv =
|
||||
COVERAGE_FILE = {toxworkdir}/.coverage
|
||||
skip_install = true
|
||||
deps =
|
||||
coverage>=5.0.1
|
||||
diff_cover>=3
|
||||
extras =
|
||||
commands =
|
||||
python -m coverage combine
|
||||
python -m coverage report --skip-covered --show-missing
|
||||
python -m coverage xml -o {toxworkdir}/coverage.xml
|
||||
python -m coverage html -d {toxworkdir}/htmlcov
|
||||
python -m diff_cover.diff_cover_tool --compare-branch {env:DIFF_AGAINST:origin/main} {toxworkdir}/coverage.xml
|
||||
depends =
|
||||
py38
|
||||
py37
|
||||
py36
|
||||
py35
|
||||
py34
|
||||
py27
|
||||
pypy
|
||||
pypy3
|
||||
parallel_show_output = True
|
||||
|
||||
[testenv:readme]
|
||||
description = check that the long description is valid (need for PyPI)
|
||||
skip_install = true
|
||||
deps =
|
||||
pep517>=0.8.2
|
||||
twine>=1.12.1
|
||||
extras =
|
||||
commands =
|
||||
python -m pep517.build -o {envtmpdir} -b -s .
|
||||
twine check {envtmpdir}/*
|
||||
|
||||
[testenv:docs]
|
||||
description = build documentation
|
||||
basepython = python3.8
|
||||
extras =
|
||||
docs
|
||||
commands =
|
||||
python -c 'import glob; import subprocess; subprocess.call(["proselint"] + glob.glob("docs/*.rst") + glob.glob("docs/**/*.rst"))'
|
||||
sphinx-build -d "{envtmpdir}/doctree" docs "{toxworkdir}/docs_out" --color -b html {posargs}
|
||||
python -c 'import pathlib; print("documentation available under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "docs_out" / "index.html"))'
|
||||
|
||||
[testenv:upgrade]
|
||||
description = upgrade pip/wheels/setuptools to latest
|
||||
passenv =
|
||||
UPGRADE_ADVISORY
|
||||
skip_install = true
|
||||
deps =
|
||||
black
|
||||
commands =
|
||||
python upgrade_wheels.py
|
||||
changedir = {toxinidir}/tasks
|
||||
|
||||
[testenv:release]
|
||||
description = do a release, required posarg of the version number
|
||||
passenv =
|
||||
*
|
||||
basepython = python3.8
|
||||
deps =
|
||||
gitpython>=3
|
||||
packaging>=17.1
|
||||
towncrier>=19.9.0rc1
|
||||
commands =
|
||||
python release.py --version {posargs}
|
||||
changedir = {toxinidir}/tasks
|
||||
|
||||
[testenv:dev]
|
||||
description = generate a DEV environment
|
||||
deps =
|
||||
setuptools_scm[toml]>=3.4
|
||||
{[testenv:release]deps}
|
||||
extras =
|
||||
docs
|
||||
testing
|
||||
commands =
|
||||
python -m pip list --format=columns
|
||||
python -c 'import sys; print(sys.executable)'
|
||||
usedevelop = True
|
||||
|
||||
[testenv:zipapp]
|
||||
description = generate a zipapp
|
||||
skip_install = true
|
||||
deps =
|
||||
packaging>=20
|
||||
commands =
|
||||
python tasks/make_zipapp.py
|
||||
|
||||
[isort]
|
||||
profile = black
|
||||
|
|
@ -119,34 +166,3 @@ ignore = E203, W503, C901, E402
|
|||
|
||||
[pep8]
|
||||
max-line-length = 120
|
||||
|
||||
[testenv:release]
|
||||
description = do a release, required posarg of the version number
|
||||
basepython = python3.8
|
||||
passenv = *
|
||||
deps =
|
||||
gitpython >= 3
|
||||
towncrier >= 19.9.0rc1
|
||||
packaging >= 17.1
|
||||
changedir = {toxinidir}/tasks
|
||||
commands =
|
||||
python release.py --version {posargs}
|
||||
|
||||
[testenv:dev]
|
||||
description = generate a DEV environment
|
||||
extras = testing, docs
|
||||
usedevelop = True
|
||||
deps =
|
||||
{[testenv:release]deps}
|
||||
setuptools_scm[toml]>=3.4
|
||||
commands =
|
||||
python -m pip list --format=columns
|
||||
python -c 'import sys; print(sys.executable)'
|
||||
|
||||
[testenv:zipapp]
|
||||
description = generate a zipapp
|
||||
skip_install = true
|
||||
deps =
|
||||
packaging >= 20
|
||||
commands =
|
||||
python tasks/make_zipapp.py
|
||||
|
|
|
|||
Loading…
Reference in a new issue