Skip to content

Instantly share code, notes, and snippets.

@32teeth
Created August 19, 2024 20:27
Show Gist options
  • Save 32teeth/7657b73ecc6e4dfd02ebee5684d4da3a to your computer and use it in GitHub Desktop.
Save 32teeth/7657b73ecc6e4dfd02ebee5684d4da3a to your computer and use it in GitHub Desktop.
mypy ini file (generic)
# mypy.ini
[mypy]
python_version = 3.10
strict = True
warn_unused_ignores = True
warn_redundant_casts = True
warn_unused_configs = True
warn_unreachable = True
show_error_codes = True
# Disallow untyped calls and definitions
disallow_untyped_calls = True
disallow_untyped_defs = True
disallow_incomplete_defs = True
check_untyped_defs = True
# Handle imports
ignore_missing_imports = True
# Type settings
# always_true and always_false should only be set if needed for specific variables.
# Remove these lines if you don't need them.
# Example (adjust as needed):
# always_true = DEBUG
# always_false = PRODUCTION
# Specific rules for code structure and best practices
disallow_any_generics = True
disallow_subclassing_any = True
no_implicit_reexport = True
disallow_untyped_decorators = True
# Ensure consistency across codebase
allow_untyped_globals = False
allow_redefinition = False
strict_equality = True
# Error codes to ignore (if any specific ones are problematic)
# Example: ignore_errors = E501
# Additional plugins and settings can be added as required
# Example:
# plugins = mypy_django_plugin.main
# Files to check
files = src/
# Exclude certain directories or files from being checked
exclude = (tests/|migrations/|__init__.py)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment