Skip to content

Integrate mypy #31

Description

@evgfilim1

Start here

diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml
index 833fcde..77cf54c 100644
--- a/.github/workflows/lint.yaml
+++ b/.github/workflows/lint.yaml
@@ -45,6 +45,7 @@ jobs:
         run: |
           isort --check --diff userbot
           black --check --diff userbot
+          mypy userbot
 
       - name: Check message catalog template is up-to-date
         run: python potctl.py --diff
diff --git a/dev-requirements.txt b/dev-requirements.txt
index 390cec5..41f7d7e 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,3 +1,5 @@
 Babel~=2.10.3
 black~=22.10.0
 isort~=5.10.1
+mypy~=0.982
+types-aiofiles~=22.1.0
diff --git a/pyproject.toml b/pyproject.toml
index bcb9333..e1c88f9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -7,3 +7,52 @@ line_length = 100
 py_version = '310'  # (2022-10-28) isort 5.10.1 doesn't support 3.11
 profile = 'black'
 known_first_party = ['userbot']
+
+[tool.mypy]
+# Config file
+warn_unused_configs = true
+
+# Import discovery
+namespace_packages = true
+
+# Platform configuration
+python_version = "3.11"
+
+# Disallow dynamic typing
+#disallow_any_explicit = true
+disallow_any_generics = true
+disallow_subclassing_any = true
+
+# Untyped definitions and calls
+disallow_untyped_calls = true
+disallow_untyped_defs = true
+disallow_incomplete_defs = true
+check_untyped_defs = true
+disallow_untyped_decorators = true
+
+# None and Optional handling
+no_implicit_optional = true
+
+# Configuring warnings
+warn_redundant_casts = true
+warn_unused_ignores = true
+warn_return_any = true
+warn_unreachable = true
+
+# Miscellaneous strictness flags
+local_partial_types = true
+# Pyrogram doesn't explicitly export some attributes, so this has to be disabled
+no_implicit_reexport = false
+strict_equality = true
+strict = true
+
+# Configuring error messages
+show_error_context = true
+show_column_numbers = true
+show_error_codes = true
+pretty = true
+
+# Advanced options
+plugins = [
+]
+warn_incomplete_stub = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    Status
    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions