py-hyperlink/tox.ini

393 lines
7.4 KiB
INI
Raw Permalink Normal View History

2017-03-14 05:19:49 +02:00
[tox]
envlist =
2021-01-14 21:16:59 +02:00
flake8, black, mypy
2020-12-22 23:19:31 +02:00
test-py{26,27,34,35,36,37,38,39,py2,py3}
coverage_report
2019-11-08 02:22:08 +02:00
docs
2020-04-06 06:30:46 +03:00
packaging
2019-10-19 07:27:38 +03:00
skip_missing_interpreters = {tty:True:False}
2017-04-20 09:55:24 +03:00
2020-04-02 05:34:40 +03:00
[default]
basepython = python3.9
2020-04-02 05:34:40 +03:00
deps =
idna==2.9 # rq.filter: <3
2020-04-02 05:34:40 +03:00
setenv =
PY_MODULE=hyperlink
PYTHONPYCACHEPREFIX={envtmpdir}/pycache
2019-10-19 05:28:59 +03:00
##
2020-04-02 05:34:40 +03:00
# Default environment: unit tests
2019-10-19 05:28:59 +03:00
##
2017-03-14 05:19:49 +02:00
[testenv]
2019-10-19 21:31:40 +03:00
description = run tests
basepython =
2021-01-14 21:16:59 +02:00
py: python
py26: python2.6
py27: python2.7
py34: python3.4
py35: python3.5
py36: python3.6
py37: python3.7
py38: python3.8
py39: python3.9
2021-01-14 21:16:59 +02:00
py310: python3.10
2020-04-02 05:34:40 +03:00
pypy2: pypy
pypy3: pypy3
2019-10-19 05:28:59 +03:00
2020-04-17 10:42:30 +03:00
deps =
{[default]deps}
2020-06-25 10:24:22 +03:00
# In Python 2, we need to pull in typing, mock
2021-05-01 21:17:02 +03:00
py{26,27,py2}: typing==3.10.0.0
2020-06-25 10:24:22 +03:00
py{26,27,py2}: mock==3.0.5 # rq.filter: <4
2020-04-17 10:42:30 +03:00
# For pytest
2020-06-25 10:24:22 +03:00
py{26,27,34,py2}: pytest==4.6.11 # rq.filter: <5
py{35,36,37,38,39,py3}: pytest==5.2.4
2020-04-17 10:42:30 +03:00
# For code coverage
{[testenv:coverage_report]deps}
2020-06-25 10:24:22 +03:00
py{26,27,34,py2}: pytest-cov==2.8.1 # rq.filter: <2.9
2020-08-14 20:34:18 +03:00
py{35,36,37,38,39,py3}: pytest-cov==2.10.1
2019-10-19 21:31:40 +03:00
2020-06-08 00:32:51 +03:00
# For hypothesis. Note Python 3.4 isn't supported by hypothesis.
2020-06-25 10:24:22 +03:00
py{26,27,py2}: hypothesis==4.43.9 # rq.filter: <4.44
py{35,36,37,38,39,py3}: hypothesis==5.8.6
2020-06-08 00:32:51 +03:00
2019-10-19 05:28:59 +03:00
setenv =
2020-04-02 05:34:40 +03:00
{[default]setenv}
2020-01-21 04:11:09 +02:00
2020-04-17 10:42:30 +03:00
COVERAGE_FILE={toxworkdir}/coverage.{envname}
2020-06-08 00:32:51 +03:00
HYPOTHESIS_STORAGE_DIRECTORY={toxworkdir}/hypothesis
passenv = CI
2019-10-19 05:28:59 +03:00
commands =
2020-04-17 10:42:30 +03:00
pytest --cov={env:PY_MODULE} --cov-report=term-missing:skip-covered --doctest-modules {posargs:src/{env:PY_MODULE}}
coverage_xml: coverage xml
2020-04-15 02:46:09 +03:00
##
# Black code formatting
##
[testenv:black]
description = run Black (linter)
basepython = {[default]basepython}
skip_install = True
deps =
2021-07-16 17:58:40 +03:00
black==21.7b0
2020-04-15 02:46:09 +03:00
setenv =
BLACK_LINT_ARGS=--check
commands =
2020-06-25 10:24:22 +03:00
black {env:BLACK_LINT_ARGS:} {posargs:setup.py src}
2020-04-15 02:46:09 +03:00
[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}
2019-10-21 03:13:52 +03:00
##
# Flake8 linting
##
[testenv:flake8]
description = run Flake8 (linter)
2020-04-02 05:34:40 +03:00
basepython = {[default]basepython}
2019-10-21 03:13:52 +03:00
skip_install = True
deps =
2021-04-02 05:38:22 +03:00
flake8-bugbear==21.4.3
2021-05-08 23:37:06 +03:00
flake8==3.9.2
2019-10-21 03:13:52 +03:00
mccabe==0.6.1
2021-08-08 05:57:12 +03:00
pep8-naming==0.12.1
2021-03-14 21:00:07 +02:00
pycodestyle==2.7.0
2021-05-18 01:46:27 +03:00
pydocstyle==6.1.1
2021-03-24 18:59:54 +02:00
pyflakes==2.3.1
2019-10-21 03:13:52 +03:00
commands =
2020-06-25 10:24:22 +03:00
flake8 {posargs:setup.py src/{env:PY_MODULE}}
2019-10-21 03:13:52 +03:00
[flake8]
# !!! BRING THE PAIN !!!
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
2020-04-15 02:46:09 +03:00
max-line-length = 80
2019-10-21 03:13:52 +03:00
# Codes: http://flake8.pycqa.org/en/latest/user/error-codes.html
ignore =
# syntax error in type comment
F723,
2019-10-21 03:13:52 +03:00
# function name should be lowercase
N802,
# argument name should be lowercase
N803,
# variable in function should be lowercase
N806,
# variable in class scope should not be mixedCase
N815,
# variable in global scope should not be mixedCase
N816,
2020-04-15 02:46:09 +03:00
# line break before binary operator
W503,
2019-10-21 03:13:52 +03:00
# End of list (allows last item to end with trailing ',')
EOL
# flake8-import-order: local module name space
application-import-names = deploy
2019-10-27 05:37:00 +02:00
##
# Mypy static type checking
##
[testenv:mypy]
description = run Mypy (static type checker)
2020-04-02 05:34:40 +03:00
basepython = {[default]basepython}
2019-10-27 05:37:00 +02:00
deps =
2021-06-22 21:51:33 +03:00
mypy==0.910
2021-08-08 21:30:11 +03:00
types-mock==0.1.5
2019-10-27 05:37:00 +02:00
2020-04-02 05:34:40 +03:00
{[default]deps}
2019-10-27 05:37:00 +02:00
commands =
mypy \
--config-file="{toxinidir}/tox.ini" \
--cache-dir="{toxworkdir}/mypy_cache" \
{tty:--pretty:} \
{posargs:src}
[mypy]
# Global settings
2020-01-21 02:43:02 +02:00
check_untyped_defs = True
disallow_any_generics = True
2019-10-27 07:13:29 +02:00
disallow_incomplete_defs = True
2019-10-27 06:18:34 +02:00
disallow_untyped_defs = True
2019-10-27 05:37:00 +02:00
no_implicit_optional = True
show_column_numbers = True
show_error_codes = True
strict_optional = True
warn_no_return = True
warn_redundant_casts = True
warn_return_any = True
warn_unreachable = True
2019-10-27 06:18:34 +02:00
warn_unused_ignores = True
2019-10-27 05:37:00 +02:00
2020-06-08 00:32:51 +03:00
# DrawCallable is generic
[mypy-hyperlink.hypothesis]
disallow_any_generics = False
[mypy-hyperlink.test.test_hypothesis]
disallow_any_generics = False
2020-01-21 02:43:02 +02:00
# Don't complain about dependencies known to lack type hints
2019-10-27 05:37:00 +02:00
2020-06-08 00:32:51 +03:00
[mypy-hypothesis]
ignore_missing_imports = True
[mypy-hypothesis.*]
ignore_missing_imports = True
2019-10-27 05:37:00 +02:00
[mypy-idna]
ignore_missing_imports = True
##
# Coverage report
##
[testenv:coverage_report]
description = generate coverage report
2019-10-19 07:27:38 +03:00
2020-06-25 10:24:22 +03:00
depends = test-py{26,27,34,35,36,37,38,39,py2,py3}
2020-04-02 05:34:40 +03:00
2020-04-06 06:30:46 +03:00
basepython = {[default]basepython}
skip_install = True
2019-10-19 05:28:59 +03:00
deps =
# coverage 5.0 drops Python 3.4 support
coverage==4.5.4 # rq.filter: <5
2020-04-02 05:34:40 +03:00
setenv =
{[default]setenv}
COVERAGE_FILE={toxworkdir}/coverage
commands =
coverage combine
2020-01-21 04:11:09 +02:00
- coverage report
- coverage html
2019-10-19 05:28:59 +03:00
2019-10-19 05:28:59 +03:00
##
# Codecov
2019-10-19 05:28:59 +03:00
##
2017-04-20 09:55:24 +03:00
2019-10-19 05:28:59 +03:00
[testenv:codecov]
2019-10-19 05:28:59 +03:00
description = upload coverage to Codecov
2020-04-02 05:34:40 +03:00
depends = {[coverage_report]depends}
2019-10-19 05:28:59 +03:00
basepython = python
skip_install = True
deps =
2020-04-02 05:34:40 +03:00
{[testenv:coverage_report]deps}
2021-08-02 21:16:50 +03:00
codecov==2.1.12
2019-10-19 05:28:59 +03:00
2020-04-02 05:34:40 +03:00
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_*
2020-01-21 04:11:09 +02:00
2020-04-02 05:34:40 +03:00
setenv =
{[testenv:coverage_report]setenv}
2021-01-14 21:16:59 +02:00
COVERAGE_XML={envlogdir}/coverage.xml
2020-04-02 05:34:40 +03:00
commands =
# Note documentation for CI variables in passenv above
coverage combine
coverage xml -o "{env:COVERAGE_XML}"
2019-11-08 02:22:08 +02:00
codecov --file="{env:COVERAGE_XML}" --env \
GITHUB_REF GITHUB_COMMIT GITHUB_USER GITHUB_WORKFLOW \
TRAVIS_BRANCH TRAVIS_BUILD_WEB_URL \
TRAVIS_COMMIT TRAVIS_COMMIT_MESSAGE \
APPVEYOR_REPO_BRANCH APPVEYOR_REPO_COMMIT \
APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL \
APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED
##
# Documentation
##
[testenv:docs]
description = build documentation
2020-04-02 05:34:40 +03:00
basepython = {[default]basepython}
2019-11-08 02:22:08 +02:00
deps =
2021-07-26 20:42:02 +03:00
Sphinx==4.1.2
2021-04-05 19:50:51 +03:00
sphinx-rtd-theme==0.5.2
2019-11-08 02:22:08 +02:00
commands =
sphinx-build \
-b html -d "{envtmpdir}/doctrees" \
"{toxinidir}/docs" \
2020-04-15 02:46:09 +03:00
"{toxinidir}/htmldocs"
2019-11-19 21:35:51 +02:00
[testenv:docs-auto]
2019-11-19 21:38:31 +02:00
description = build documentation and rebuild automatically
2019-11-19 21:35:51 +02:00
2020-04-02 05:34:40 +03:00
basepython = {[default]basepython}
2019-11-19 21:35:51 +02:00
deps =
2020-04-02 05:34:40 +03:00
{[testenv:docs]deps}
2021-03-14 15:54:31 +02:00
sphinx-autobuild==2021.3.14
2019-11-19 21:35:51 +02:00
commands =
sphinx-autobuild \
-b html -d "{envtmpdir}/doctrees" \
--host=localhost \
"{toxinidir}/docs" \
2020-04-15 02:46:09 +03:00
"{toxinidir}/htmldocs"
2019-11-19 21:35:51 +02:00
2019-10-19 05:28:59 +03:00
##
# Packaging
##
[testenv:packaging]
description = check for potential packaging problems
2020-04-02 05:34:40 +03:00
basepython = {[default]basepython}
skip_install = True
deps =
2021-01-04 16:46:22 +02:00
check-manifest==0.46
2021-02-23 08:01:39 +02:00
readme-renderer==29.0
2021-07-20 19:28:00 +03:00
twine==3.4.2
commands =
check-manifest
2020-01-21 04:11:09 +02:00
pip wheel --wheel-dir "{envtmpdir}/dist" --no-deps {toxinidir}
twine check "{envtmpdir}/dist/"*
2021-01-14 21:16:59 +02:00
##
# Print dependencies
##
[testenv:dependencies]
description = print dependencies
basepython = {[default]basepython}
recreate = true
deps =
commands =
pip freeze --exclude={env:PY_MODULE}