Check in black config

This commit is contained in:
Wilfredo Sánchez 2020-01-25 15:25:47 -08:00
parent eb8bc0812d
commit f33b772672
4 changed files with 111 additions and 47 deletions

7
.gitignore vendored
View File

@ -1,6 +1,7 @@
docs/_build
/docs/_build
tmp.py
htmlcov/
/htmlcov/
/htmldocs/
.coverage.*
*.py[cod]
.mypy_cache
@ -34,7 +35,7 @@ pip-log.txt
# Unit test / coverage reports
.coverage
.tox/
/.tox/
nosetests.xml
# Translations

View File

@ -1,4 +1,4 @@
include README.md LICENSE CHANGELOG.md tox.ini requirements-test.txt .coveragerc Makefile pytest.ini .tox-coveragerc
include README.md LICENSE CHANGELOG.md tox.ini pyproject.toml .coveragerc Makefile pytest.ini .tox-coveragerc
exclude TODO.md .appveyor.yml
graft docs

10
pyproject.toml Normal file
View File

@ -0,0 +1,10 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
[tool.black]
line-length = 80
target-version = ["py27"]

139
tox.ini
View File

@ -1,17 +1,27 @@
[tox]
envlist =
flake8, mypy
flake8, mypy # black
test-py{26,27,34,35,36,37,38,py,py3}
coverage_report
packaging
docs
packaging
skip_missing_interpreters = {tty:True:False}
[default]
basepython = python3.8
setenv =
PY_MODULE=hyperlink
PYTHONPYCACHEPREFIX={envtmpdir}/pycache
##
# Build (default environment)
# Default environment: unit tests
##
[testenv]
@ -31,40 +41,56 @@ basepython =
pypy3: pypy3
deps =
test: coverage==4.5.4
test: idna==2.8
test: typing==3.7.4.1
test: {py26,py27,py34}: pytest==4.6.7
test: {py35,py36,py37,py38}: pytest==5.2.4
test: pytest-cov==2.8.1
test: {[testenv:coverage_report]deps}
passenv =
# See https://github.com/codecov/codecov-python/blob/master/README.md#using-tox
# And CI-specific docs:
# https://help.github.com/en/articles/virtual-environments-for-github-actions#default-environment-variables
# https://docs.travis-ci.com/user/environment-variables#default-environment-variables
# https://www.appveyor.com/docs/environment-variables/
codecov: TOXENV CODECOV_* CI
codecov: GITHUB_*
codecov: TRAVIS TRAVIS_*
codecov: APPVEYOR APPVEYOR_*
# Used in our AppVeyor config
codecov: OS
test: CI
setenv =
PY_MODULE=hyperlink
test: PYTHONPYCACHEPREFIX={envtmpdir}/pycache
{[default]setenv}
test: COVERAGE_FILE={toxworkdir}/coverage.{envname}
{coverage_report,codecov}: COVERAGE_FILE={toxworkdir}/coverage
codecov: COVERAGE_XML={envlogdir}/coverage_report.xml
commands =
test: pytest --cov={env:PY_MODULE} --cov-report=term-missing:skip-covered --doctest-modules {posargs:src/{env:PY_MODULE}}
##
# Black code formatting
##
[testenv:black]
description = run Black (linter)
basepython = {[default]basepython}
skip_install = True
deps =
black==19.10b0
setenv =
BLACK_LINT_ARGS=--check
commands =
black {env:BLACK_LINT_ARGS:} src
[testenv:black-reformat]
description = {[testenv:black]description} and reformat
basepython = {[testenv:black]basepython}
skip_install = {[testenv:black]skip_install}
deps = {[testenv:black]deps}
commands = {[testenv:black]commands}
##
# Flake8 linting
##
@ -73,16 +99,16 @@ commands =
description = run Flake8 (linter)
basepython = python3.8
basepython = {[default]basepython}
skip_install = True
deps =
flake8-bugbear==19.8.0
#flake8-docstrings==1.5.0
flake8==3.7.9
mccabe==0.6.1
pep8-naming==0.9.1
pycodestyle==2.5.0
pydocstyle==5.0.1
# pin pyflakes pending a release with https://github.com/PyCQA/pyflakes/pull/455
git+git://github.com/PyCQA/pyflakes@ffe9386#egg=pyflakes
@ -99,6 +125,8 @@ select = A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
show-source = True
doctests = True
max-line-length = 80
# Codes: http://flake8.pycqa.org/en/latest/user/error-codes.html
ignore =
# syntax error in type comment
@ -119,8 +147,8 @@ ignore =
# variable in global scope should not be mixedCase
N816,
# line break after binary operator
W504,
# line break before binary operator
W503,
# End of list (allows last item to end with trailing ',')
EOL
@ -137,12 +165,10 @@ application-import-names = deploy
description = run Mypy (static type checker)
basepython = python3.8
skip_install = True
basepython = {[default]basepython}
deps =
mypy==0.750
mypy==0.760
commands =
mypy \
@ -188,12 +214,19 @@ ignore_missing_imports = True
description = generate coverage report
basepython = python
depends = test-py{36,37,38,39,py3}
basepython = {[default]basepython}
skip_install = True
deps =
coverage==4.5.4
coverage==5.0.3
setenv =
{[default]setenv}
COVERAGE_FILE={toxworkdir}/coverage
commands =
coverage combine
@ -209,17 +242,35 @@ commands =
description = upload coverage to Codecov
depends = {[coverage_report]depends}
basepython = python
skip_install = True
deps =
coverage==4.5.4
{[testenv:coverage_report]deps}
codecov==2.0.15
commands =
# Note documentation for CI variables in default environment's passenv
passenv =
# See https://github.com/codecov/codecov-python/blob/master/README.md#using-tox
# And CI-specific docs:
# https://help.github.com/en/articles/virtual-environments-for-github-actions#default-environment-variables
# https://docs.travis-ci.com/user/environment-variables#default-environment-variables
# https://www.appveyor.com/docs/environment-variables/
TOXENV CODECOV_* CI
GITHUB_*
TRAVIS TRAVIS_*
APPVEYOR APPVEYOR_*
setenv =
{[testenv:coverage_report]setenv}
COVERAGE_XML={envlogdir}/coverage_report.xml
commands =
# Note documentation for CI variables in passenv above
coverage combine
coverage xml -o "{env:COVERAGE_XML}"
codecov --file="{env:COVERAGE_XML}" --env \
@ -239,28 +290,28 @@ commands =
description = build documentation
basepython = python3.8
basepython = {[default]basepython}
deps =
Sphinx==2.2.2
Sphinx==2.3.0
sphinx-rtd-theme==0.4.3
commands =
sphinx-build \
-b html -d "{envtmpdir}/doctrees" \
"{toxinidir}/docs" \
"{toxworkdir}/docs/html"
"{toxinidir}/htmldocs"
[testenv:docs-auto]
description = build documentation and rebuild automatically
basepython = python3.8
basepython = {[default]basepython}
deps =
Sphinx==2.2.2
sphinx-rtd-theme==0.4.3
{[testenv:docs]deps}
sphinx-autobuild==0.7.1
commands =
@ -268,7 +319,7 @@ commands =
-b html -d "{envtmpdir}/doctrees" \
--host=localhost \
"{toxinidir}/docs" \
"{toxworkdir}/docs/html"
"{toxinidir}/htmldocs"
##
@ -279,12 +330,14 @@ commands =
description = check for potential packaging problems
basepython = python
basepython = {[default]basepython}
skip_install = True
deps =
check-manifest==0.40
readme_renderer==24.0
twine==2.0.0
twine==3.1.1
commands =
check-manifest