Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy mypy and tox config #614

Merged
merged 15 commits into from
May 9, 2020
17 changes: 12 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,28 @@ matrix:
fast_finish: true

include:
- python: &latest_py3 3.8
- python: 3.7
- python: &oldest_py3 3.6

- python: 3.7
name: Linting code style
env:
TOXENV: code-style
- python: 3.7
name: Linting type annotations

- python: *latest_py3
name: Checking type annotations (latest Python)
env:
TOXENV: typing
- python: *oldest_py3
name: Checking type annotations (oldest Python)
env:
TOXENV: typing

- python: 3.7
name: Making sure that docs build is healthy
env:
TOXENV: docs
- python: &latest_py3 3.8
- python: 3.7
- python: 3.6

- stage: deploy
if: tag IS present
Expand Down
35 changes: 32 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
[mypy]
show_traceback = True
; TODO: Make this more granular; docs recommend it as a "last resort"
; https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-type-hints-for-third-party-library
ignore_missing_imports = True

; --strict settings
warn_redundant_casts = True
Expand All @@ -20,3 +17,35 @@ no_implicit_optional = True
warn_return_any = True
no_implicit_reexport = True
strict_equality = True

[mypy-importlib_metadata]
; https://gitlab.com/python-devs/importlib_metadata/-/issues/10
ignore_missing_imports = True

[mypy-keyring]
; https://github.com/jaraco/keyring/issues/437
ignore_missing_imports = True

[mypy-pkginfo]
; https://bugs.launchpad.net/pkginfo/+bug/1876591
ignore_missing_imports = True

[mypy-requests_toolbelt,requests_toolbelt.*]
; https://github.com/requests/toolbelt/issues/279
ignore_missing_imports = True

[mypy-readme_renderer,readme_renderer.*]
; https://github.com/pypa/readme_renderer/issues/166
ignore_missing_imports = True

[mypy-setuptools]
; https://github.com/python/typeshed/issues/2171
ignore_missing_imports = True

[mypy-tqdm]
; https://github.com/tqdm/tqdm/issues/260
ignore_missing_imports = True

[mypy-urllib3]
; https://github.com/urllib3/urllib3/issues/867
ignore_missing_imports = True
12 changes: 4 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ commands =
twine check dist/*

[testenv:format]
skip_install = True
deps =
isort
black
Expand All @@ -35,6 +36,7 @@ commands =
black twine/ tests/

[testenv:code-style]
skip_install = True
deps =
{[testenv:format]deps}
flake8
Expand All @@ -44,22 +46,16 @@ commands =
flake8 twine/ tests/

[testenv:typing]
skip_install = True
deps =
mypy
lxml
commands =
# TODO: Consider checking the tests after the source is fully typed
mypy {posargs:--html-report mypy --txt-report mypy twine}

[testenv:monkeytype]
deps =
{[testenv]deps}
{[testenv:typing]deps}
monkeytype
commands =
monkeytype {posargs:run -m pytest}

[testenv:lint]
skip_install = True
deps =
{[testenv:code-style]deps}
{[testenv:typing]deps}
Expand Down