python: add mypy support and some type hints

`deltachat.const` module now defines `__getattr__` and `__dir__` as
suggested by https://www.python.org/dev/peps/pep-0562/
mypy detects that `__getattr__` is defined and does not show errors
for `DC_*` constants which cannot be detected statically.
mypy is added to `tox.ini`, so type check can be run with `tox -e mypy`.
This commit is contained in:
link2xt
2021-11-13 23:03:35 +00:00
parent 56cf2e6596
commit 0d62069b67
12 changed files with 183 additions and 121 deletions

View File

@@ -3,6 +3,7 @@ isolated_build = true
envlist =
py3
lint
mypy
auditwheels
[testenv]
@@ -43,6 +44,15 @@ commands =
flake8 tests/ examples/
rst-lint --encoding 'utf-8' README.rst
[testenv:mypy]
deps =
mypy
typing
types-setuptools
types-requests
commands =
mypy --no-incremental src/
[testenv:doc]
changedir=doc
deps =