--- id: mypy-zope version: "1.0.16" license: unclear license_treatment: permissive maintenance: active --- # mypy-zope — Plugin for mypy to support zope interfaces License: permissive · Maintenance: active · Downloads: 132.5K/mo ## What it is and what it does mypy-zope is a mypy plugin that bridges the gap between zope.interface's runtime interface system and static type checking. It teaches mypy to understand zope interfaces as types, so you can write polymorphic code using zope's interface pattern and have mypy verify type safety across interface boundaries. The plugin infers types from zope.schema field declarations (Int, Text, etc.), handles interface implementation via @implementer decorators or classImplements calls, supports the adaptation pattern where interfaces are called to look up adapters, and enables type narrowing with providedBy() and implementedBy() checks. The package ships with type stubs for zope.interface and zope.schema, which are automatically enabled when the plugin is active. It supports overloaded methods in interfaces, field properties, and conditional type inference. The plugin is marked production-grade and used in large projects, though the maintainers note that subtle bugs may still exist. Some advanced zope.interface features—like module-level interface declarations, List and Dict field type inference, and full interface compatibility checking—are not yet supported. Use it for: - Type-check a zope-based application where interfaces define contracts and implementations are polymorphic. - Verify that schema field assignments match their declared types (e.g., Int fields reject strings). - Enable IDE autocomplete and type hints for code using zope.interface.implementer decorators. - Narrow types in conditional branches using zope's providedBy() and implementedBy() runtime checks. - Catch adapter lookup errors by treating interface calls as typed function invocations. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A mypy plugin that treats zope.interface declarations as types, enabling type checking for zope-based code with interface polymorphism, schema field inference, and adaptation patterns. Yes, if you use zope.interface in a mypy-checked project. The plugin is active, production-grade, and has no security vulnerabilities. Install friction is low. The main caveat: some advanced zope.interface features remain unsupported, and stub coverage is incomplete—verify that your specific patterns are listed in the documented supported features before committing. ## Install pip install mypy-zope uv add mypy-zope poetry add mypy-zope ## Installing mypy-zope Before you install: Low friction: pure Python wheel with only three runtime dependencies (mypy, zope.interface, zope.schema). Active maintenance—last commit 2026-07-15, release within 30 days—and marked production-grade despite acknowledging potential subtle bugs. License in practice: Permissive license (MIT) with no notable restrictions on use or redistribution. Quickstart: pip install mypy-zope # Add to mypy.ini: # [mypy] # plugins=mypy_zope:plugin # Then use in code: import zope.interface class IAnimal(zope.interface.Interface): def say() -> None: pass @zope.interface.implementer(IAnimal) class Cow: def say(self) -> None: print("Moo") animal: IAnimal = Cow() animal.say() Verify before relying: - Whether stub files for zope.interface and zope.schema are complete enough for real-world projects beyond the documented limitations. - Performance impact of the plugin on large codebases with many interfaces. - Whether the 'subtle bugs' acknowledged in production use affect common patterns. ## Package facts - License: not declared (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 132.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags mypy plugin zope interface, zope interface type checking, mypy zope support, interface type annotations, zope schema field types, mypy plugin framework, zope implementer decorator typing, mypy-plugin, zope-ecosystem, type-checking [View on SkillFed](https://skillfed.io/packages/mypy-zope) · [View on PyPI](https://pypi.org/project/mypy-zope/)