DESCRIPTION.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. ``zope.interface``
  2. ==================
  3. .. image:: https://img.shields.io/pypi/v/zope.interface.svg
  4. :target: https://pypi.python.org/pypi/zope.interface/
  5. :alt: Latest Version
  6. .. image:: https://travis-ci.org/zopefoundation/zope.interface.png?branch=master
  7. :target: https://travis-ci.org/zopefoundation/zope.interface
  8. .. image:: https://readthedocs.org/projects/zopeinterface/badge/?version=latest
  9. :target: https://zopeinterface.readthedocs.io/en/latest/
  10. :alt: Documentation Status
  11. This package is intended to be independently reusable in any Python
  12. project. It is maintained by the `Zope Toolkit project
  13. <http://docs.zope.org/zopetoolkit/>`_.
  14. This package provides an implementation of "object interfaces" for Python.
  15. Interfaces are a mechanism for labeling objects as conforming to a given
  16. API or contract. So, this package can be considered as implementation of
  17. the `Design By Contract`_ methodology support in Python.
  18. .. _Design By Contract: http://en.wikipedia.org/wiki/Design_by_contract
  19. For detailed documentation, please see https://zopeinterface.readthedocs.io/en/latest/
  20. Changes
  21. =======
  22. 4.4.2 (2017-06-14)
  23. ------------------
  24. - Fix a regression storing
  25. ``zope.component.persistentregistry.PersistentRegistry`` instances.
  26. See `issue 85 <https://github.com/zopefoundation/zope.interface/issues/85>`_.
  27. - Fix a regression that could lead to the utility registration cache
  28. of ``Components`` getting out of sync. See `issue 93
  29. <https://github.com/zopefoundation/zope.interface/issues/93>`_.
  30. 4.4.1 (2017-05-13)
  31. ------------------
  32. - Simplify the caching of utility-registration data. In addition to
  33. simplification, avoids spurious test failures when checking for
  34. leaks in tests with persistent registries. See `pull 84
  35. <https://github.com/zopefoundation/zope.interface/pull/84>`_.
  36. - Raise ``ValueError`` when non-text names are passed to adapter registry
  37. methods: prevents corruption of lookup caches.
  38. 4.4.0 (2017-04-21)
  39. ------------------
  40. - Avoid a warning from the C compiler.
  41. (https://github.com/zopefoundation/zope.interface/issues/71)
  42. - Add support for Python 3.6.
  43. 4.3.3 (2016-12-13)
  44. ------------------
  45. - Correct typos and ReST formatting errors in documentation.
  46. - Add API documentation for the adapter registry.
  47. - Ensure that the ``LICENSE.txt`` file is included in built wheels.
  48. - Fix C optimizations broken on Py3k. See the Python bug at:
  49. http://bugs.python.org/issue15657
  50. (https://github.com/zopefoundation/zope.interface/issues/60)
  51. 4.3.2 (2016-09-05)
  52. ------------------
  53. - Fix equality testing of ``implementedBy`` objects and proxies.
  54. (https://github.com/zopefoundation/zope.interface/issues/55)
  55. 4.3.1 (2016-08-31)
  56. ------------------
  57. - Support Components subclasses that are not hashable.
  58. (https://github.com/zopefoundation/zope.interface/issues/53)
  59. 4.3.0 (2016-08-31)
  60. ------------------
  61. - Add the ability to sort the objects returned by ``implementedBy``.
  62. This is compatible with the way interface classes sort so they can
  63. be used together in ordered containers like BTrees.
  64. (https://github.com/zopefoundation/zope.interface/issues/42)
  65. - Make ``setuptools`` a hard dependency of ``setup.py``.
  66. (https://github.com/zopefoundation/zope.interface/issues/13)
  67. - Change a linear algorithm (O(n)) in ``Components.registerUtility`` and
  68. ``Components.unregisterUtility`` into a dictionary lookup (O(1)) for
  69. hashable components. This substantially improves the time taken to
  70. manipulate utilities in large registries at the cost of some
  71. additional memory usage. (https://github.com/zopefoundation/zope.interface/issues/46)
  72. 4.2.0 (2016-06-10)
  73. ------------------
  74. - Add support for Python 3.5
  75. - Drop support for Python 2.6 and 3.2.
  76. 4.1.3 (2015-10-05)
  77. ------------------
  78. - Fix installation without a C compiler on Python 3.5
  79. (https://github.com/zopefoundation/zope.interface/issues/24).
  80. 4.1.2 (2014-12-27)
  81. ------------------
  82. - Add support for PyPy3.
  83. - Remove unittest assertions deprecated in Python3.x.
  84. - Add ``zope.interface.document.asReStructuredText``, which formats the
  85. generated text for an interface using ReST double-backtick markers.
  86. 4.1.1 (2014-03-19)
  87. ------------------
  88. - Add support for Python 3.4.
  89. 4.1.0 (2014-02-05)
  90. ------------------
  91. - Update ``boostrap.py`` to version 2.2.
  92. - Add ``@named(name)`` declaration, that specifies the component name, so it
  93. does not have to be passed in during registration.
  94. 4.0.5 (2013-02-28)
  95. ------------------
  96. - Fix a bug where a decorated method caused false positive failures on
  97. ``verifyClass()``.
  98. 4.0.4 (2013-02-21)
  99. ------------------
  100. - Fix a bug that was revealed by porting zope.traversing. During a loop, the
  101. loop body modified a weakref dict causing a ``RuntimeError`` error.
  102. 4.0.3 (2012-12-31)
  103. ------------------
  104. - Fleshed out PyPI Trove classifiers.
  105. 4.0.2 (2012-11-21)
  106. ------------------
  107. - Add support for Python 3.3.
  108. - Restored ability to install the package in the absence of ``setuptools``.
  109. - LP #1055223: Fix test which depended on dictionary order and failed randomly
  110. in Python 3.3.
  111. 4.0.1 (2012-05-22)
  112. ------------------
  113. - Drop explicit ``DeprecationWarnings`` for "class advice" APIS (these
  114. APIs are still deprecated under Python 2.x, and still raise an exception
  115. under Python 3.x, but no longer cause a warning to be emitted under
  116. Python 2.x).
  117. 4.0.0 (2012-05-16)
  118. ------------------
  119. - Automated build of Sphinx HTML docs and running doctest snippets via tox.
  120. - Deprecate the "class advice" APIs from ``zope.interface.declarations``:
  121. ``implements``, ``implementsOnly``, and ``classProvides``. In their place,
  122. prefer the equivalent class decorators: ``@implementer``,
  123. ``@implementer_only``, and ``@provider``. Code which uses the deprecated
  124. APIs will not work as expected under Py3k.
  125. - Remove use of '2to3' and associated fixers when installing under Py3k.
  126. The code is now in a "compatible subset" which supports Python 2.6, 2.7,
  127. and 3.2, including PyPy 1.8 (the version compatible with the 2.7 language
  128. spec).
  129. - Drop explicit support for Python 2.4 / 2.5 / 3.1.
  130. - Add support for PyPy.
  131. - Add support for continuous integration using ``tox`` and ``jenkins``.
  132. - Add 'setup.py dev' alias (runs ``setup.py develop`` plus installs
  133. ``nose`` and ``coverage``).
  134. - Add 'setup.py docs' alias (installs ``Sphinx`` and dependencies).
  135. - Replace all unittest coverage previously accomplished via doctests with
  136. unittests. The doctests have been moved into a ``docs`` section, managed
  137. as a Sphinx collection.
  138. - LP #910987: Ensure that the semantics of the ``lookup`` method of
  139. ``zope.interface.adapter.LookupBase`` are the same in both the C and
  140. Python implementations.
  141. - LP #900906: Avoid exceptions due to tne new ``__qualname__`` attribute
  142. added in Python 3.3 (see PEP 3155 for rationale). Thanks to Antoine
  143. Pitrou for the patch.
  144. 3.8.0 (2011-09-22)
  145. ------------------
  146. - New module ``zope.interface.registry``. This is code moved from
  147. ``zope.component.registry`` which implements a basic nonperistent component
  148. registry as ``zope.interface.registry.Components``. This class was moved
  149. from ``zope.component`` to make porting systems (such as Pyramid) that rely
  150. only on a basic component registry to Python 3 possible without needing to
  151. port the entirety of the ``zope.component`` package. Backwards
  152. compatibility import shims have been left behind in ``zope.component``, so
  153. this change will not break any existing code.
  154. - New ``tests_require`` dependency: ``zope.event`` to test events sent by
  155. Components implementation. The ``zope.interface`` package does not have a
  156. hard dependency on ``zope.event``, but if ``zope.event`` is importable, it
  157. will send component registration events when methods of an instance of
  158. ``zope.interface.registry.Components`` are called.
  159. - New interfaces added to support ``zope.interface.registry.Components``
  160. addition: ``ComponentLookupError``, ``Invalid``, ``IObjectEvent``,
  161. ``ObjectEvent``, ``IComponentLookup``, ``IRegistration``,
  162. ``IUtilityRegistration``, ``IAdapterRegistration``,
  163. ``ISubscriptionAdapterRegistration``, ``IHandlerRegistration``,
  164. ``IRegistrationEvent``, ``RegistrationEvent``, ``IRegistered``,
  165. ``Registered``, ``IUnregistered``, ``Unregistered``,
  166. ``IComponentRegistry``, and ``IComponents``.
  167. - No longer Python 2.4 compatible (tested under 2.5, 2.6, 2.7, and 3.2).
  168. 3.7.0 (2011-08-13)
  169. ------------------
  170. - Move changes from 3.6.2 - 3.6.5 to a new 3.7.x release line.
  171. 3.6.7 (2011-08-20)
  172. ------------------
  173. - Fix sporadic failures on x86-64 platforms in tests of rich comparisons
  174. of interfaces.
  175. 3.6.6 (2011-08-13)
  176. ------------------
  177. - LP #570942: Now correctly compare interfaces from different modules but
  178. with the same names.
  179. N.B.: This is a less intrusive / destabilizing fix than the one applied in
  180. 3.6.3: we only fix the underlying cmp-alike function, rather than adding
  181. the other "rich comparison" functions.
  182. - Revert to software as released with 3.6.1 for "stable" 3.6 release branch.
  183. 3.6.5 (2011-08-11)
  184. ------------------
  185. - LP #811792: work around buggy behavior in some subclasses of
  186. ``zope.interface.interface.InterfaceClass``, which invoke ``__hash__``
  187. before initializing ``__module__`` and ``__name__``. The workaround
  188. returns a fixed constant hash in such cases, and issues a ``UserWarning``.
  189. - LP #804832: Under PyPy, ``zope.interface`` should not build its C
  190. extension. Also, prevent attempting to build it under Jython.
  191. - Add a tox.ini for easier xplatform testing.
  192. - Fix testing deprecation warnings issued when tested under Py3K.
  193. 3.6.4 (2011-07-04)
  194. ------------------
  195. - LP 804951: InterfaceClass instances were unhashable under Python 3.x.
  196. 3.6.3 (2011-05-26)
  197. ------------------
  198. - LP #570942: Now correctly compare interfaces from different modules but
  199. with the same names.
  200. 3.6.2 (2011-05-17)
  201. ------------------
  202. - Moved detailed documentation out-of-line from PyPI page, linking instead to
  203. http://docs.zope.org/zope.interface .
  204. - Fixes for small issues when running tests under Python 3.2 using
  205. ``zope.testrunner``.
  206. - LP # 675064: Specify return value type for C optimizations module init
  207. under Python 3: undeclared value caused warnings, and segfaults on some
  208. 64 bit architectures.
  209. - setup.py now raises RuntimeError if you don't have Distutils installed when
  210. running under Python 3.
  211. 3.6.1 (2010-05-03)
  212. ------------------
  213. - A non-ASCII character in the changelog made 3.6.0 uninstallable on
  214. Python 3 systems with another default encoding than UTF-8.
  215. - Fix compiler warnings under GCC 4.3.3.
  216. 3.6.0 (2010-04-29)
  217. ------------------
  218. - LP #185974: Clear the cache used by ``Specificaton.get`` inside
  219. ``Specification.changed``. Thanks to Jacob Holm for the patch.
  220. - Add support for Python 3.1. Contributors:
  221. Lennart Regebro
  222. Martin v Loewis
  223. Thomas Lotze
  224. Wolfgang Schnerring
  225. The 3.1 support is completely backwards compatible. However, the implements
  226. syntax used under Python 2.X does not work under 3.X, since it depends on
  227. how metaclasses are implemented and this has changed. Instead it now supports
  228. a decorator syntax (also under Python 2.X)::
  229. class Foo:
  230. implements(IFoo)
  231. ...
  232. can now also be written::
  233. @implementer(IFoo):
  234. class Foo:
  235. ...
  236. There are 2to3 fixers available to do this change automatically in the
  237. zope.fixers package.
  238. - Python 2.3 is no longer supported.
  239. 3.5.4 (2009-12-23)
  240. ------------------
  241. - Use the standard Python doctest module instead of zope.testing.doctest, which
  242. has been deprecated.
  243. 3.5.3 (2009-12-08)
  244. ------------------
  245. - Fix an edge case: make providedBy() work when a class has '__provides__' in
  246. its __slots__ (see http://thread.gmane.org/gmane.comp.web.zope.devel/22490)
  247. 3.5.2 (2009-07-01)
  248. ------------------
  249. - BaseAdapterRegistry.unregister, unsubscribe: Remove empty portions of
  250. the data structures when something is removed. This avoids leaving
  251. references to global objects (interfaces) that may be slated for
  252. removal from the calling application.
  253. 3.5.1 (2009-03-18)
  254. ------------------
  255. - verifyObject: use getattr instead of hasattr to test for object attributes
  256. in order to let exceptions other than AttributeError raised by properties
  257. propagate to the caller
  258. - Add Sphinx-based documentation building to the package buildout
  259. configuration. Use the ``bin/docs`` command after buildout.
  260. - Improve package description a bit. Unify changelog entries formatting.
  261. - Change package's mailing list address to zope-dev at zope.org as
  262. zope3-dev at zope.org is now retired.
  263. 3.5.0 (2008-10-26)
  264. ------------------
  265. - Fix declaration of _zope_interface_coptimizations, it's not a top level
  266. package.
  267. - Add a DocTestSuite for odd.py module, so their tests are run.
  268. - Allow to bootstrap on Jython.
  269. - Fix https://bugs.launchpad.net/zope3/3.3/+bug/98388: ISpecification
  270. was missing a declaration for __iro__.
  271. - Add optional code optimizations support, which allows the building
  272. of C code optimizations to fail (Jython).
  273. - Replace `_flatten` with a non-recursive implementation, effectively making
  274. it 3x faster.
  275. 3.4.1 (2007-10-02)
  276. ------------------
  277. - Fix a setup bug that prevented installation from source on systems
  278. without setuptools.
  279. 3.4.0 (2007-07-19)
  280. ------------------
  281. - Final release for 3.4.0.
  282. 3.4.0b3 (2007-05-22)
  283. --------------------
  284. - When checking whether an object is already registered, use identity
  285. comparison, to allow adding registering with picky custom comparison methods.
  286. 3.3.0.1 (2007-01-03)
  287. --------------------
  288. - Made a reference to OverflowWarning, which disappeared in Python
  289. 2.5, conditional.
  290. 3.3.0 (2007/01/03)
  291. ------------------
  292. New Features
  293. ++++++++++++
  294. - Refactor the adapter-lookup algorithim to make it much simpler and faster.
  295. Also, implement more of the adapter-lookup logic in C, making
  296. debugging of application code easier, since there is less
  297. infrastructre code to step through.
  298. - Treat objects without interface declarations as if they
  299. declared that they provide ``zope.interface.Interface``.
  300. - Add a number of richer new adapter-registration interfaces
  301. that provide greater control and introspection.
  302. - Add a new interface decorator to zope.interface that allows the
  303. setting of tagged values on an interface at definition time (see
  304. zope.interface.taggedValue).
  305. Bug Fixes
  306. +++++++++
  307. - A bug in multi-adapter lookup sometimes caused incorrect adapters to
  308. be returned.
  309. 3.2.0.2 (2006-04-15)
  310. --------------------
  311. - Fix packaging bug: 'package_dir' must be a *relative* path.
  312. 3.2.0.1 (2006-04-14)
  313. --------------------
  314. - Packaging change: suppress inclusion of 'setup.cfg' in 'sdist' builds.
  315. 3.2.0 (2006-01-05)
  316. ------------------
  317. - Corresponds to the verison of the zope.interface package shipped as part of
  318. the Zope 3.2.0 release.
  319. 3.1.0 (2005-10-03)
  320. ------------------
  321. - Corresponds to the verison of the zope.interface package shipped as part of
  322. the Zope 3.1.0 release.
  323. - Made attribute resolution order consistent with component lookup order,
  324. i.e. new-style class MRO semantics.
  325. - Deprecate 'isImplementedBy' and 'isImplementedByInstancesOf' APIs in
  326. favor of 'implementedBy' and 'providedBy'.
  327. 3.0.1 (2005-07-27)
  328. ------------------
  329. - Corresponds to the verison of the zope.interface package shipped as part of
  330. the Zope X3.0.1 release.
  331. - Fix a bug reported by James Knight, which caused adapter registries
  332. to fail occasionally to reflect declaration changes.
  333. 3.0.0 (2004-11-07)
  334. ------------------
  335. - Corresponds to the verison of the zope.interface package shipped as part of
  336. the Zope X3.0.0 release.