Skip to content

aiskillstore/marketplace / skills/0xdarkmatter/python-typing-patterns

python-typing-patterns

Verified

Python type hints and type safety patterns. Triggers on: type hints, typing, TypeVar, Generic, Protocol, mypy, pyright, type annotation, overload, TypedDict.

assets/pyproject-typing.toml

View on GitHub
# pyproject.toml - Type checker configuration
# Copy these sections to your pyproject.toml

# ============================================================
# mypy Configuration
# ============================================================

[tool.mypy]
# Python version to target
python_version = "3.11"

# Enable strict mode (recommended for new projects)
strict = true

# Additional strictness
warn_return_any = true
warn_unused_ignores = true
warn_unreachable = true

# Error reporting
show_error_codes = true
show_error_context = true
show_column_numbers = true
pretty = true

# Paths
files = ["src", "tests"]
exclude = [
    "migrations/",
    "venv/",
    ".venv/",
    "__pycache__/",
    "build/",
    "dist/",
]

# Plugin support (uncomment as needed)
# plugins = [
#     "pydantic.mypy",
#     "sqlalchemy.ext.mypy.plugin",
# ]

# ============================================================
# Per-module overrides
# ============================================================

# Relax strictness for tests
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
disallow_untyped_calls = false

# Ignore missing stubs for common libraries
[[tool.mypy.overrides]]
module = [
    "requests.*",
    "boto3.*",
    "botocore.*",
    "celery.*",
    "redis.*",
]
ignore_missing_imports = true

# Legacy code - gradually add types
# [[tool.mypy.overrides]]
# module = "legacy.*"
# ignore_errors = true


# ============================================================
# pyright Configuration
# ============================================================

[tool.pyright]
# Python version
pythonVersion = "3.11"

# Paths
include = ["src"]
exclude = [
    "**/node_modules",
    "**/__pycache__",
    "venv",
    ".venv",
    "build",
    "dist",
]

# Type checking mode: off, basic, standard, strict
typeCheckingMode = "strict"

# Report settings (strict mode enables all by default)
reportMissingTypeStubs = false
reportUnusedImport = "warning"
reportUnusedVariable = "warning"
reportUnusedFunction = "warning"

# Useful additional checks
reportUninitializedInstanceVariable = true
reportIncompatibleMethodOverride = true
reportIncompatibleVariableOverride = true


# ============================================================
# Recommended dev dependencies
# ============================================================

# [project.optional-dependencies]
# dev = [
#     "mypy>=1.8.0",
#     "pyright>=1.1.350",
#     # Common type stubs
#     "types-requests",
#     "types-redis",
#     "types-PyYAML",
#     "types-python-dateutil",
# ]
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall