From 334e18e41267ef0e2d3434254ef1f2f8ee38015a Mon Sep 17 00:00:00 2001 From: bastimeyer Date: Sat, 21 May 2022 02:45:31 +0200 Subject: [PATCH] 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. --- .gitignore | 1 + dev-requirements.txt | 6 ++++++ pyproject.toml | 9 +++++++++ src/streamlink/py.typed | 0 src/streamlink_cli/py.typed | 0 5 files changed, 16 insertions(+) create mode 100644 src/streamlink/py.typed create mode 100644 src/streamlink_cli/py.typed diff --git a/.gitignore b/.gitignore index 8d5f48eb..6f34d489 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ local/ share/ pip-selfcheck.json .pytest_cache/ +.mypy_cache/ # ignore any key files *.key diff --git a/dev-requirements.txt b/dev-requirements.txt index d0359016..6b1c7d53 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -8,3 +8,9 @@ flake8 flake8-import-order shtab versioningit >=1.1.1, <2 + +mypy +lxml-stubs +types-freezegun +types-requests +types-urllib3 diff --git a/pyproject.toml b/pyproject.toml index 697065d6..9901699c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 diff --git a/src/streamlink/py.typed b/src/streamlink/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/src/streamlink_cli/py.typed b/src/streamlink_cli/py.typed new file mode 100644 index 00000000..e69de29b