Give AlbumentationsX a star on GitHub — it powers this leaderboard

Star on GitHub

zope-interface

Interfaces for Python

Downloads: 0 (30 days)

Description

====================
 ``zope.interface``
====================

.. image:: https://img.shields.io/pypi/v/zope.interface.svg
    :target: https://pypi.python.org/pypi/zope.interface/
    :alt: Latest Version

.. image:: https://img.shields.io/pypi/pyversions/zope.interface.svg
        :target: https://pypi.org/project/zope.interface/
        :alt: Supported Python versions

.. image:: https://github.com/zopefoundation/zope.interface/actions/workflows/tests.yml/badge.svg
        :target: https://github.com/zopefoundation/zope.interface/actions/workflows/tests.yml

.. image:: https://readthedocs.org/projects/zopeinterface/badge/?version=latest
        :target: https://zopeinterface.readthedocs.io/en/latest/
        :alt: Documentation Status

This package is intended to be independently reusable in any Python
project. It is maintained by the `Zope Toolkit project
<https://zopetoolkit.readthedocs.io/>`_.

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/

Change log
==========

8.2 (2026-01-09)
----------------

- Move all supported package metadata into ``pyproject.toml``.

- Ignore ``__annotate_func__`` added in Python 3.14b1.


8.1.1 (2025-11-15)
------------------

- Fix the GitHub workflow for publishing wheels, which failed for Linux/arm64.
  (`#348 <https://github.com/zopefoundation/zope.interface/issues/348>`_)


8.1 (2025-11-10)
----------------

- Drop support for Python 3.9.

- Add support for Python 3.14.


8.0.1 (2025-09-25)
------------------

- Make tests resilient against different ways of calling them.

- Remove run-time dependency on ``setuptools``.


8.0 (2025-09-12)
----------------

- Replace ``pkg_resources`` namespace with PEP 420 native namespace.

- Drop support for Python 3.8.

- Allow using newer ``setuptools`` version.
  (`#333 <https://github.com/zopefoundation/zope.interface/issues/333>`_)


7.2 (2024-11-28)
----------------

- Add preliminary support for Python 3.14a2, this means that
  ``.common.builtins.IByteString`` and ``.common.collections.IByteString`` are
  no longer available from this Python version onwards as Python 3.14 dropped
  ``collections.abc.ByteString``.


7.1.1 (2024-10-23)
------------------

- Fix segmentation faults in `weakrefobject.c` on Python 3.12 and 3.13.
  (`#323 <https://github.com/zopefoundation/zope.interface/issues/323>`_)


7.1.0 (2024-10-10)
------------------

- Declare support for Python 3.13.

- Fix segmentation faults on Python 3.13.
  (`#323 <https://github.com/zopefoundation/zope.interface/issues/323>`_)


7.0.3 (2024-08-27)
------------------

- Fix `Assertion 'memb->type -- T_PYSSIZET' failed.` for Python < 3.12.
  (`#319 <https://github.com/zopefoundation/zope.interface/issues/319>`_)


7.0.2 (2024-08-26)
------------------

- Fix reference-counting bug in C module initialization (broken in 7.0).
  (`#316 <https://github.com/zopefoundation/zope.interface/issues/316>`_)


7.0.1 (2024-08-06)
------------------

- Fix subclassability of ``ObjectSpecificationDescriptor`` (broken in 7.0).
  (`#312 <https://github.com/zopefoundation/zope.interface/issues/312>`_)


7.0 (2024-08-06)
----------------

- Enable heap-based types (PEP 384) for Python >= 3.11.

- Adopt multi-phase module initialization (PEP 489).

- Drop support for Python 3.7.


6.4.post2 (2024-05-24)
----------------------

- Publish missing Windows wheels, second attempt.
  (`#295 <https://github.com/zopefoundation/zope.interface/issues/295>`_)


6.4.post1 (2024-05-23)
----------------------

- Publish missing Windows wheels.
  (`#295 <https://github.com/zopefoundation/zope.interface/issues/295>`_)


6.4.post0 (2024-05-22)
----------------------

- The sdist of version 6.4 was uploaded to PyPI as
  ``zope_interface-6.4.tar.gz`` instead of ``zope.interface-6.4-py2.tar.gz``
  which cannot be installed by ``zc.buildout``.  This release is a re-release
  of version 6.4 with the correct sdist name.
  (`#298 <https://github.com/zopefoundation/zope.interface/issues/298>`_)


6.4 (2024-05-15)
----------------

- Adjust for incompatible changes in Python 3.13b1.
  (`#292 <https://github.com/zopefoundation/zope.interface/issues/292>`_)

- Build windows wheels on GHA.


6.3 (2024-04-12)
----------------

- Add preliminary support for Python 3.13 as of 3.13a6.


6.2 (2024-02-16)
----------------

- Add preliminary support for Python 3.13 as of 3.13a3.

- Add support to use the pipe (``|``) syntax for ``typing.Union``.
  (`#280 <https://github.com/zopefoundation/zope.interface/issues/280>`_)


6.1 (2023-10-05)
----------------

- Build Linux binary wheels for Python 3.12.

- Add support for Python 3.12.

- Fix building of the docs for non-final versions.


6.0 (2023-03-17)
----------------

- Build Linux binary wheels for Python 3.11.

- Drop support for Python 2.7, 3.5, 3.6.

- Fix test deprecation warning on Python 3.11.

- Add preliminary support for Python 3.12 as of 3.12a5.

- Drop:

    + `zope.interface.implements`
    + `zope.interface.implementsOnly`
    + `zope.interface.classProvides`


5.5.2 (2022-11-17)
------------------

- Add support for building arm64 wheels on macOS.


5.5.1 (2022-11-03)
------------------

- Add support for final Python 3.11 release.


5.5.0 (2022-10-10)
------------------

- Add support for Python 3.10 and 3.11 (as of 3.11.0rc2).

- Add missing Trove classifier showing support for Python 3.9.

- Add some more entries to ``zope.interface.interfaces.__all__``.

- Disable unsafe math optimizations in C code.  See `pull request 262
  <https://github.com/zopefoundation/zope.interface/pull/262>`_.


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 <https://github.com/zopefoundation/zope.interface/issues>`_.

- 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 ``<implementedBy builtins.list>`` is now
  shown as ``classImplements(list, IMutableSequence, IIterable)``. See
  `issue 236 <https://github.com/zopefoundation/zope.interface/issues/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
  <https://github.com/zopefoundation/zope.interface/issues/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
  <https://github.com/zopefoundation/zope.interface/issues/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
  <https://github.com/zopefoundation/zope.interface/issues/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
  <https://github.com/zopefoundation/zope.interface/issues/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``
  in 5.1.0, and resolves inconsistent resolution orders with
  ``zope.proxy`` and ``zope.location``. See `issue 207
  <https://github.com/zopefoundation/zope.interface/issues/207>`_.


5.2.0 (2020-11-05)
------------------

- Add documentation section ``Persistency and Equality``
  (`#218 <https://github.com/zopefoundation/zope.interface/issues/218>`_).

- Create arm64 wheels.

- Add support for Python 3.9.


5.1.2 (2020-10-01)
------------------

- Make sure to call each invariant only once when validating invariants.
  Previously, invariants could be called multiple times