single |
====================
``zope.interface``
====================
:alt: Latest Version
:alt: Supported Python versions
:alt: Documentation Status
This package is intended to be independently reusable in any Python
project. It is maintained by the [Zope Toolkit project
].
This package provides an implementation of "object interfaces" for Python.
Interfaces are a mechanism for labeling objects as conforming to a given
API or contract. So, this package can be considered as implementation of
the `Design By Contract`_ methodology support in Python.
.. _Design By Contract: http://en.wikipedia.org/wiki/Design_by_contract
For detailed documentation, please see
https://zopeinterface.readthedocs.io/en/latest/
=========
Changes
=========
5.4.0 (2021-04-15)
==================
- Make the C implementation of the __providedBy__ descriptor stop
ignoring all errors raised when accessing the instance's
__provides__. Now it behaves like the Python version and only
catches AttributeError. The previous behaviour could lead to
crashing the interpreter in cases of recursion and errors. See
[issue 239].
- Update the ``repr() and str()`` of various objects to be shorter
and more informative. In many cases, the ``repr()`` is now something
that can be evaluated to produce an equal object. For example, what
was previously printed as `` is now
shown as classImplements(list, IMutableSequence, IIterable)``. See
[issue 236].
- Make ``Declaration.__add__`` (as in ``implementedBy(Cls) +
ISomething``) try harder to preserve a consistent resolution order
when the two arguments share overlapping pieces of the interface
inheritance hierarchy. Previously, the right hand side was always
put at the end of the resolution order, which could easily produce
invalid orders. See [issue 193
].
5.3.0 (2020-03-21)
==================
- No changes from 5.3.0a1
5.3.0a1 (2021-03-18)
====================
- Improve the repr of ``zope.interface.Provides`` to remove ambiguity
about what is being provided. This is especially helpful diagnosing
IRO issues.
- Allow subclasses of BaseAdapterRegistry (including
AdapterRegistry and VerifyingAdapterRegistry) to have
control over the data structures. This allows persistent
implementations such as those based on ZODB to choose more scalable
options (e.g., BTrees instead of dicts). See [issue 224
].
- Fix a reference counting issue in BaseAdapterRegistry that could
lead to references to interfaces being kept around even when all
utilities/adapters/subscribers providing that interface have been
removed. This is mostly an issue for persistent implementations.
Note that this only corrects the issue moving forward, it does not
solve any already corrupted reference counts. See [issue 227
].
- Add the method ``BaseAdapterRegistry.rebuild()``. This can be used
to fix the reference counting issue mentioned above, as well as to
update the data structures when custom data types have changed.
- Add the interface method ``IAdapterRegistry.subscribed() and
implementation BaseAdapterRegistry.subscribed()`` for querying
directly registered subscribers. See [issue 230
].
- Add the maintenance method
``Components.rebuildUtilityRegistryFromLocalCache()``. Most users
will not need this, but it can be useful if the ``Components.utilities
registry is suspected to be out of sync with the Components``
object itself (this might happen to persistent Components
implementations in the face of bugs).
- Fix the Provides and ClassProvides descriptors to stop
allowing redundant interfaces (those already implemented by the
underlying class or meta class) to produce an inconsistent
resolution order. This is similar to the change in ``@implementer``
|