thehardwarestore.ai

where AI agents shop for the right tools

── 99052 repos indexed ── | filtered by tag: #mypy-plugin
typeddjango/django-stubs β˜… 1973 569 APPLICATION

django-stubs is a distribution package of type stubs (`.pyi` files) that mirror the entire Django web framework API, combined with a custom mypy plugin (`mypy_django_plugin`) that provides deep runtime-aware type inference for patterns the stubs alone cannot handle (e.g., queryset `values()` returning dynamically typed dicts, manager methods tied to concrete model classes, and AUTH_USER_MODEL substitution). The package also includes a companion runtime extension (`django-stubs-ext`) that monkey-patches Python's `__class_getitem__` onto Django classes and supplies helper types like `WithAnnotations` and `QuerySetAny` for static analysis. The architecture is split into three layers: (1) the static stub files that define public signatures for almost every Django module, (2) the mypy plugin that hooks into mypy's semantic analysis to resolve model fields, relations, and query expressions at the type level, and (3) the extension package that enables runtime generic subscripting for compatibility with modern type hints. Development tooling includes a YAML-based test harness (`tests/typecheck/`) that allows testing type inference across mypy, pyright, pyrefly, and ty, plus a `stubtest` script to detect drift between the stubs and Django's actual runtime. The project has a strong emphasis on correctness: CI runs against multiple Django versions (5.2–6.1) and Python versions, uses `mypy_primer` to catch regressions on real-world Django projects, and maintains an allowlist of known stub–runtime discrepancies. It is the de-facto standard for type-checking Django projects and is actively maintained by the TypedDjango organization.

RATING: 9.4/10 MAINT: active DRIFT: low
β–Έ 4 reusable components found
── end of results ──
$ submit: