tools: add mypy config

- Add mypy and available typing stubs to dev-requirements
- Add mypy config
- Add py.typed to streamlink + streamlink_cli packages (PEP 561):
  This is required, so that mypy can import types from streamlink when
  installed in editable mode. Don't publish this file for now.
  Once various streamlink APIs are properly typed, typing stub files
  can be added instead.
This commit is contained in:
bastimeyer 2022-05-21 02:45:31 +02:00 committed by Forrest
parent 8fc178276e
commit 334e18e412
5 changed files with 16 additions and 0 deletions

1
.gitignore vendored
View File

@ -45,6 +45,7 @@ local/
share/
pip-selfcheck.json
.pytest_cache/
.mypy_cache/
# ignore any key files
*.key

View File

@ -8,3 +8,9 @@ flake8
flake8-import-order
shtab
versioningit >=1.1.1, <2
mypy
lxml-stubs
types-freezegun
types-requests
types-urllib3

View File

@ -46,3 +46,12 @@ exclude_lines = [
"raise NotImplementedError",
"if __name__ == \"__main__\":",
]
# https://mypy.readthedocs.io/en/stable/config_file.html
[tool.mypy]
python_version = 3.7
show_error_codes = true
show_error_context = true
show_column_numbers = true
warn_no_return = false

0
src/streamlink/py.typed Normal file
View File

View File