Install & Compatibility
Where this runs
tested against v8.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.026s · 19.7MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.8s · import 0.024s · 20MB
18MB installed
● package 18MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Interface
✓ from zope.interface import Interface
Attribute
✓ from zope.interface import Attribute
implementer
✓ from zope.interface import implementer
✗ from zope.interface import implements
The 'implements' function was deprecated and removed in zope.interface 6.0; use the '@implementer' decorator instead.
verify
✓ from zope.interface import verify
Define an interface by inheriting from `zope.interface.Interface`. Declare attributes using `zope.interface.Attribute` and methods with a standard Python function signature (without `self`). Implement the interface in a class using the `@implementer` decorator. Runtime verification can be done with `zope.interface.verify.verifyObject` to ensure adherence to the interface contract.
from zope.interface import Interface, Attribute, implementer, verify
class IGreeter(Interface):
"""An interface for objects that can greet."""
name = Attribute("The name of the greeter")
def greet(message: str) -> str:
"""Returns a greeting message."""
@implementer(IGreeter)
class HelloGreeter:
def __init__(self, name: str):
self.name = name
def greet(self, message: str) -> str:
return f"Hello, {message} from {self.name}!"
# Instantiate the implementing class
greeter_instance = HelloGreeter("World")
# Verify that the instance provides the interface
verify.verifyObject(IGreeter, greeter_instance)
# Use the object as per the interface
print(greeter_instance.greet("Python"))
Debug
Known issues
breakingThe `implements` class-level function (e.g., `implements(IInterface)`) was removed in `zope.interface` version 6.0. It must be replaced by the `@zope.interface.implementer(IInterface)` class decorator.fixReplace `implements(IInterface)` with `@implementer(IInterface)` placed above the class definition.
affects: >=6.0
breaking`zope.interface` frequently drops support for older Python versions. Version 8.0 dropped Python 3.8, and 8.1 dropped Python 3.9. Ensure your Python environment meets the `requires_python` specification (>=3.10 for 8.2).fixUpgrade your Python interpreter to version 3.10 or newer, or downgrade `zope.interface` to a compatible version.
affects: >=8.0
breakingStarting with `zope.interface` 8.0, `pkg_resources` namespace packages were replaced by PEP 420 native namespace packages. This may affect package discovery, especially in older build systems or environments relying on `pkg_resources`.fixEnsure your project's packaging and build tools are compatible with PEP 420 namespace packages. For `zc.buildout`, version 5 or newer is required with `zope.interface` 6.0b1 and later.
affects: >=8.0
gotchaWhen defining methods in an `Interface`, omit the `self` argument from the signature. Interfaces describe how a method is *called*, not how it's implemented in a class. This is a common point of confusion.fixDefine interface methods like `def my_method(arg1: Type, arg2: Type) -> ReturnType:` instead of `def my_method(self, arg1: Type, arg2: Type) -> ReturnType:`.
affects: All
breakingFor Python 3.14 and later, `zope.interface.common.builtins.IByteString` and `zope.interface.common.collections.IByteString` are no longer available from `zope.interface` version 7.2 onwards due to the removal of `collections.abc.ByteString` in Python 3.14.fixAvoid importing or relying on `IByteString` from `zope.interface.common.builtins` or `zope.interface.common.collections` when using Python 3.14 or newer.
affects: >=7.2 with Python >=3.14
gotchaIn `zope.interface` 5.0.0, internal singleton objects returned by APIs like `implementedBy` and `directlyProvidedBy` were made immutable. While this fixed potential 'pathological corner cases,' it might subtly affect highly unusual code that previously mutated these objects.fixAvoid mutating the objects returned by `implementedBy()`, `directlyProvidedBy()`, and similar introspection APIs, as they are now immutable.
affects: >=5.0.0
Upgrade
Version history
8.6latest on PyPI · released Aug 20, 2026
Audit
Dependencies
No dependency data recorded yet.