pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/devel/py-ZopeInterface



Module Name:    pkgsrc
Committed By:   adam
Date:           Mon Jun  8 13:18:06 UTC 2020

Modified Files:
        pkgsrc/devel/py-ZopeInterface: Makefile PLIST distinfo

Log Message:
py-ZopeInterface: updated to 5.1.0

5.1.0:

- Make ``@implementer(*iface)`` and ``classImplements(cls, *iface)``
  ignore redundant interfaces. If the class already implements an
  interface through inheritance, it is no longer redeclared
  specifically for *cls*. This solves many instances of inconsistent
  resolution orders, while still allowing the interface to be declared
  for readability and maintenance purposes.

- Remove all bare ``except:`` statements. Previously, when accessing
  special attributes such as ``__provides__``, ``__providedBy__``,
  ``__class__`` and ``__conform__``, this package wrapped such access
  in a bare ``except:`` statement, meaning that many errors could pass
  silently; typically this would result in a fallback path being taken
  and sometimes (like with ``providedBy()``) the result would be
  non-sensical. This is especially true when those attributes are
  implemented with descriptors. Now, only ``AttributeError`` is
  caught. This makes errors more obvious.

  Obviously, this means that some exceptions will be propagated
  differently than before. In particular, ``RuntimeError`` raised by
  Acquisition in the case of circular containment will now be
  propagated. Previously, when adapting such a broken object, a
  ``TypeError`` would be the common result, but now it will be a more
  informative ``RuntimeError``.

  In addition, ZODB errors like ``POSKeyError`` could now be
  propagated where previously they would ignored by this package.

- Require that the second argument (*bases*) to ``InterfaceClass`` is
  a tuple. This only matters when directly using ``InterfaceClass`` to
  create new interfaces dynamically. Previously, an individual
  interface was allowed, but did not work correctly. Now it is
  consistent with ``type`` and requires a tuple.

- Let interfaces define custom ``__adapt__`` methods. This implements
  the other side of the :pep:`246` adaptation protocol: objects being
  adapted could already implement ``__conform__`` if they know about
  the interface, and now interfaces can implement ``__adapt__`` if
  they know about particular objects. There is no performance penalty
  for interfaces that do not supply custom ``__adapt__`` methods.

  This includes the ability to add new methods, or override existing
  interface methods using the new ``@interfacemethod`` decorator.

- Make the internal singleton object returned by APIs like
  ``implementedBy`` and ``directlyProvidedBy`` for objects that
  implement or provide no interfaces more immutable. Previously an
  internal cache could be mutated.

5.0.2:

- Ensure that objects that implement no interfaces (such as direct
  subclasses of ``object``) still include ``Interface`` itself in
  their ``__iro___`` and ``__sro___``. This fixes adapter registry
  lookups for such objects when the adapter is registered for
  ``Interface``.

5.0.1:

- Ensure the resolution order for ``InterfaceClass`` is consistent.

- Ensure the resolution order for ``collections.OrderedDict`` is
  consistent on CPython 2. (It was already consistent on Python 3 and PyPy).

- Fix the handling of the ``ZOPE_INTERFACE_STRICT_IRO`` environment
  variable. Previously, ``ZOPE_INTERFACE_STRICT_RO`` was read, in
  contrast with the documentation.

5.0.0:

- Make an internal singleton object returned by APIs like
  ``implementedBy`` and ``directlyProvidedBy`` immutable. Previously,
  it was fully mutable and allowed changing its ``__bases___``. That
  could potentially lead to wrong results in pathological corner
  cases.

- Support the ``PURE_PYTHON`` environment variable at runtime instead
  of just at wheel build time. A value of 0 forces the C extensions to
  be used (even on PyPy) failing if they aren't present. Any other
  value forces the Python implementation to be used, ignoring the C
  extensions.

- Cache the result of ``__hash__`` method in ``InterfaceClass`` as a
  speed optimization. The method is called very often (i.e several
  hundred thousand times during Plone 5.2 startup). Because the hash value never
  changes it can be cached. This improves test performance from 0.614s
  down to 0.575s (1.07x faster). In a real world Plone case a reindex
  index came down from 402s to 320s (1.26x faster).

- Change the C classes ``SpecificationBase`` and its subclass
  ``ClassProvidesBase`` to store implementation attributes in their structures
  instead of their instance dictionaries. This eliminates the use of
  an undocumented private C API function, and helps make some
  instances require less memory.

- Reduce memory usage in other ways based on observations of usage
  patterns in Zope (3) and Plone code bases.

  - Specifications with no dependents are common (more than 50%) so
    avoid allocating a ``WeakKeyDictionary`` unless we need it.
  - Likewise, tagged values are relatively rare, so don't allocate a
    dictionary to hold them until they are used.
  - Use ``__slots___`` or the C equivalent ``tp_members`` in more
    common places. Note that this removes the ability to set arbitrary
    instance variables on certain objects.

  The changes in this release resulted in a 7% memory reduction after
  loading about 6,000 modules that define about 2,200 interfaces.

  .. caution::

     Details of many private attributes have changed, and external use
     of those private attributes may break. In particular, the
     lifetime and default value of ``_v_attrs`` has changed.

- Remove support for hashing uninitialized interfaces. This could only
  be done by subclassing ``InterfaceClass``. This has generated a
  warning since it was first added in 2011 (3.6.5). Please call the
  ``InterfaceClass`` constructor or otherwise set the appropriate
  fields in your subclass before attempting to hash or sort it.

- Remove unneeded override of the ``__hash__`` method from
  ``zope.interface.declarations.Implements``. Watching a reindex index
  process in ZCatalog with on a Py-Spy after 10k samples the time for
  ``.adapter._lookup`` was reduced from 27.5s to 18.8s (~1.5x faster).
  Overall reindex index time shrunk from 369s to 293s (1.26x faster).

- Make the Python implementation closer to the C implementation by
  ignoring all exceptions, not just ``AttributeError``, during (parts
  of) interface adaptation.

- Micro-optimization in ``.adapter._lookup`` , ``.adapter._lookupAll``
  and ``.adapter._subscriptions``: By loading ``components.get`` into
  a local variable before entering the loop a bytcode "LOAD_FAST 0
  (components)" in the loop can be eliminated. In Plone, while running
  all tests, average speedup of the "owntime" of ``_lookup`` is ~5x.

- Add ``__all__`` declarations to all modules. This helps tools that
  do auto-completion and documentation and results in less cluttered
  results. Wildcard ("*") are not recommended and may be affected.

- Fix ``verifyClass`` and ``verifyObject`` for builtin types like
  ``dict`` that have methods taking an optional, unnamed argument with
  no default value like ``dict.pop``. On PyPy3, the verification is
  strict, but on PyPy2 (as on all versions of CPython) those methods
  cannot be verified and are ignored.

- Update the common interfaces ``IEnumerableMapping``,
  ``IExtendedReadMapping``, ``IExtendedWriteMapping``,
  ``IReadSequence`` and ``IUniqueMemberWriteSequence`` to no longer
  require methods that were removed from Python 3 on Python 3, such as
  ``__setslice___``. Now, ``dict``, ``list`` and ``tuple`` properly
  verify as ``IFullMapping``, ``ISequence`` and ``IReadSequence,``
  respectively on all versions of Python.

- Add human-readable ``__str___`` and ``__repr___`` to ``Attribute``
  and ``Method``. These contain the name of the defining interface
  and the attribute. For methods, it also includes the signature.

- Change the error strings raised by ``verifyObject`` and
  ``verifyClass``. They now include more human-readable information
  and exclude extraneous lines and spaces.

  .. caution:: This will break consumers (such as doctests) that
               depended on the exact error messages.

- Make ``verifyObject`` and ``verifyClass`` report all errors, if the
  candidate object has multiple detectable violations. Previously they
  reported only the first error.

  Like the above, this will break consumers depending on the exact
  output of error messages if more than one error is present.

- Add ``zope.interface.common.collections``,
  ``zope.interface.common.numbers``, and ``zope.interface.common.io``.
  These modules define interfaces based on the ABCs defined in the
  standard library ``collections.abc``, ``numbers`` and ``io``
  modules, respectively. Importing these modules will make the
  standard library concrete classes that are registered with those
  ABCs declare the appropriate interface.

- Add ``zope.interface.common.builtins``. This module defines
  interfaces of common builtin types, such as ``ITextString`` and
  ``IByteString``, ``IDict``, etc. These interfaces extend the
  appropriate interfaces from ``collections`` and ``numbers``, and the
  standard library classes implement them after importing this module.
  This is intended as a replacement for third-party packages like
  `dolmen.builtins <https://pypi.org/project/dolmen.builtins/>`_.

- Make ``providedBy()`` and ``implementedBy()`` respect ``super``
  objects. For instance, if class ``Derived`` implements ``IDerived``
  and extends ``Base`` which in turn implements ``IBase``, then
  ``providedBy(super(Derived, derived))`` will return ``[IBase]``.
  Previously it would have returned ``[IDerived]`` (in general, it
  would previously have returned whatever would have been returned
  without ``super``).

  Along with this change, adapter registries will unpack ``super``
  objects into their ``__self___`` before passing it to the factory.
  Together, this means that ``component.getAdapter(super(Derived,
  self), ITarget)`` is now meaningful.

- Fix a potential interpreter crash in the low-level adapter
  registry lookup functions.

- Adopt Python's standard `C3 resolution order
  <https://www.python.org/download/releases/2.3/mro/>`_ to compute the
  ``__iro__`` and ``__sro__`` of interfaces, with tweaks to support
  additional cases that are common in interfaces but disallowed for
  Python classes. Previously, an ad-hoc ordering that made no
  particular guarantees was used.

  This has many beneficial properties, including the fact that base
  interface and base classes tend to appear near the end of the
  resolution order instead of the beginning. The resolution order in
  general should be more predictable and consistent.

  .. caution::
     In some cases, especially with complex interface inheritance
     trees or when manually providing or implementing interfaces, the
     resulting IRO may be quite different. This may affect adapter
     lookup.

  The C3 order enforces some constraints in order to be able to
  guarantee a sensible ordering. Older versions of zope.interface did
  not impose similar constraints, so it was possible to create
  interfaces and declarations that are inconsistent with the C3
  constraints. In that event, zope.interface will still produce a
  resolution order equal to the old order, but it won't be guaranteed
  to be fully C3 compliant. In the future, strict enforcement of C3
  order may be the default.

  A set of environment variables and module constants allows
  controlling several aspects of this new behaviour. It is possible to
  request warnings about inconsistent resolution orders encountered,
  and even to forbid them. Differences between the C3 resolution order
  and the previous order can be logged, and, in extreme cases, the
  previous order can still be used (this ability will be removed in
  the future). For details, see the documentation for
  ``zope.interface.ro``.

- Make inherited tagged values in interfaces respect the resolution
  order (``__iro__``), as method and attribute lookup does. Previously
  tagged values could give inconsistent results.

- Add ``getDirectTaggedValue`` (and related methods) to interfaces to
  allow accessing tagged values irrespective of inheritance.

- Ensure that ``Interface`` is always the last item in the ``__iro__``
  and ``__sro__``. This is usually the case, but if classes that do
  not implement any interfaces are part of a class inheritance
  hierarchy, ``Interface`` could be assigned too high a priority.

- Implement sorting, equality, and hashing in C for ``Interface``
  objects. In micro benchmarks, this makes those operations 40% to 80%
  faster. This translates to a 20% speed up in querying adapters.

  Note that this changes certain implementation details. In
  particular, ``InterfaceClass`` now has a non-default metaclass, and
  it is enforced that ``__module__`` in instances of
  ``InterfaceClass`` is read-only.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 pkgsrc/devel/py-ZopeInterface/Makefile
cvs rdiff -u -r1.13 -r1.14 pkgsrc/devel/py-ZopeInterface/PLIST
cvs rdiff -u -r1.21 -r1.22 pkgsrc/devel/py-ZopeInterface/distinfo

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/devel/py-ZopeInterface/Makefile
diff -u pkgsrc/devel/py-ZopeInterface/Makefile:1.31 pkgsrc/devel/py-ZopeInterface/Makefile:1.32
--- pkgsrc/devel/py-ZopeInterface/Makefile:1.31 Sat Dec 22 08:58:53 2018
+++ pkgsrc/devel/py-ZopeInterface/Makefile      Mon Jun  8 13:18:06 2020
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.31 2018/12/22 08:58:53 adam Exp $
+# $NetBSD: Makefile,v 1.32 2020/06/08 13:18:06 adam Exp $
 
-DISTNAME=      zope.interface-4.6.0
+DISTNAME=      zope.interface-5.1.0
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME:S/zope.i/ZopeI/}
 CATEGORIES=    devel python
 MASTER_SITES=  ${MASTER_SITE_PYPI:=z/zope.interface/}
@@ -10,7 +10,9 @@ HOMEPAGE=     https://github.com/zopefoundat
 COMMENT=       The zope.interface package used in Zope 3 and Twisted
 LICENSE=       zpl-2.1
 
-DEPENDS+=      ${PYPKGPREFIX}-ZopeEvent-[0-9]*:../../devel/py-ZopeEvent
+DEPENDS+=      ${PYPKGPREFIX}-setuptools-[0-9]*:../../devel/py-setuptools
+TEST_DEPENDS+= ${PYPKGPREFIX}-ZopeEvent-[0-9]*:../../devel/py-ZopeEvent
+TEST_DEPENDS+= ${PYPKGPREFIX}-zope.testing-[0-9]*:../../devel/py-zope.testing
 
 .include "../../lang/python/egg.mk"
 .include "../../mk/bsd.pkg.mk"

Index: pkgsrc/devel/py-ZopeInterface/PLIST
diff -u pkgsrc/devel/py-ZopeInterface/PLIST:1.13 pkgsrc/devel/py-ZopeInterface/PLIST:1.14
--- pkgsrc/devel/py-ZopeInterface/PLIST:1.13    Thu May 10 08:19:34 2018
+++ pkgsrc/devel/py-ZopeInterface/PLIST Mon Jun  8 13:18:06 2020
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.13 2018/05/10 08:19:34 adam Exp $
+@comment $NetBSD: PLIST,v 1.14 2020/06/08 13:18:06 adam Exp $
 ${PYSITELIB}/${EGG_INFODIR}/PKG-INFO
 ${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt
 ${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt
@@ -27,15 +27,27 @@ ${PYSITELIB}/zope/interface/advice.pyo
 ${PYSITELIB}/zope/interface/common/__init__.py
 ${PYSITELIB}/zope/interface/common/__init__.pyc
 ${PYSITELIB}/zope/interface/common/__init__.pyo
+${PYSITELIB}/zope/interface/common/builtins.py
+${PYSITELIB}/zope/interface/common/builtins.pyc
+${PYSITELIB}/zope/interface/common/builtins.pyo
+${PYSITELIB}/zope/interface/common/collections.py
+${PYSITELIB}/zope/interface/common/collections.pyc
+${PYSITELIB}/zope/interface/common/collections.pyo
 ${PYSITELIB}/zope/interface/common/idatetime.py
 ${PYSITELIB}/zope/interface/common/idatetime.pyc
 ${PYSITELIB}/zope/interface/common/idatetime.pyo
 ${PYSITELIB}/zope/interface/common/interfaces.py
 ${PYSITELIB}/zope/interface/common/interfaces.pyc
 ${PYSITELIB}/zope/interface/common/interfaces.pyo
+${PYSITELIB}/zope/interface/common/io.py
+${PYSITELIB}/zope/interface/common/io.pyc
+${PYSITELIB}/zope/interface/common/io.pyo
 ${PYSITELIB}/zope/interface/common/mapping.py
 ${PYSITELIB}/zope/interface/common/mapping.pyc
 ${PYSITELIB}/zope/interface/common/mapping.pyo
+${PYSITELIB}/zope/interface/common/numbers.py
+${PYSITELIB}/zope/interface/common/numbers.pyc
+${PYSITELIB}/zope/interface/common/numbers.pyo
 ${PYSITELIB}/zope/interface/common/sequence.py
 ${PYSITELIB}/zope/interface/common/sequence.pyc
 ${PYSITELIB}/zope/interface/common/sequence.pyo
@@ -45,12 +57,24 @@ ${PYSITELIB}/zope/interface/common/tests
 ${PYSITELIB}/zope/interface/common/tests/basemapping.py
 ${PYSITELIB}/zope/interface/common/tests/basemapping.pyc
 ${PYSITELIB}/zope/interface/common/tests/basemapping.pyo
+${PYSITELIB}/zope/interface/common/tests/test_builtins.py
+${PYSITELIB}/zope/interface/common/tests/test_builtins.pyc
+${PYSITELIB}/zope/interface/common/tests/test_builtins.pyo
+${PYSITELIB}/zope/interface/common/tests/test_collections.py
+${PYSITELIB}/zope/interface/common/tests/test_collections.pyc
+${PYSITELIB}/zope/interface/common/tests/test_collections.pyo
 ${PYSITELIB}/zope/interface/common/tests/test_idatetime.py
 ${PYSITELIB}/zope/interface/common/tests/test_idatetime.pyc
 ${PYSITELIB}/zope/interface/common/tests/test_idatetime.pyo
 ${PYSITELIB}/zope/interface/common/tests/test_import_interfaces.py
 ${PYSITELIB}/zope/interface/common/tests/test_import_interfaces.pyc
 ${PYSITELIB}/zope/interface/common/tests/test_import_interfaces.pyo
+${PYSITELIB}/zope/interface/common/tests/test_io.py
+${PYSITELIB}/zope/interface/common/tests/test_io.pyc
+${PYSITELIB}/zope/interface/common/tests/test_io.pyo
+${PYSITELIB}/zope/interface/common/tests/test_numbers.py
+${PYSITELIB}/zope/interface/common/tests/test_numbers.pyc
+${PYSITELIB}/zope/interface/common/tests/test_numbers.pyo
 ${PYSITELIB}/zope/interface/declarations.py
 ${PYSITELIB}/zope/interface/declarations.pyc
 ${PYSITELIB}/zope/interface/declarations.pyo
@@ -84,18 +108,9 @@ ${PYSITELIB}/zope/interface/tests/dummy.
 ${PYSITELIB}/zope/interface/tests/idummy.py
 ${PYSITELIB}/zope/interface/tests/idummy.pyc
 ${PYSITELIB}/zope/interface/tests/idummy.pyo
-${PYSITELIB}/zope/interface/tests/ifoo.py
-${PYSITELIB}/zope/interface/tests/ifoo.pyc
-${PYSITELIB}/zope/interface/tests/ifoo.pyo
-${PYSITELIB}/zope/interface/tests/ifoo_other.py
-${PYSITELIB}/zope/interface/tests/ifoo_other.pyc
-${PYSITELIB}/zope/interface/tests/ifoo_other.pyo
 ${PYSITELIB}/zope/interface/tests/m1.py
 ${PYSITELIB}/zope/interface/tests/m1.pyc
 ${PYSITELIB}/zope/interface/tests/m1.pyo
-${PYSITELIB}/zope/interface/tests/m2.py
-${PYSITELIB}/zope/interface/tests/m2.pyc
-${PYSITELIB}/zope/interface/tests/m2.pyo
 ${PYSITELIB}/zope/interface/tests/odd.py
 ${PYSITELIB}/zope/interface/tests/odd.pyc
 ${PYSITELIB}/zope/interface/tests/odd.pyo

Index: pkgsrc/devel/py-ZopeInterface/distinfo
diff -u pkgsrc/devel/py-ZopeInterface/distinfo:1.21 pkgsrc/devel/py-ZopeInterface/distinfo:1.22
--- pkgsrc/devel/py-ZopeInterface/distinfo:1.21 Sat Dec 22 08:58:53 2018
+++ pkgsrc/devel/py-ZopeInterface/distinfo      Mon Jun  8 13:18:06 2020
@@ -1,6 +1,6 @@
-$NetBSD: distinfo,v 1.21 2018/12/22 08:58:53 adam Exp $
+$NetBSD: distinfo,v 1.22 2020/06/08 13:18:06 adam Exp $
 
-SHA1 (zope.interface-4.6.0.tar.gz) = e4dd98256b168e7888abbf6798789c775f5eae35
-RMD160 (zope.interface-4.6.0.tar.gz) = 9953182209587f1804e2270bdc9e2bc1a5748707
-SHA512 (zope.interface-4.6.0.tar.gz) = cb82144f0b228dd4d2f7cbfba130ee190265bf809d4e928262935c3b5551a3a298df4eba2dfe7ecde96fed27f39f59ab95e9c11f3eadf0fdc13f61b5c046f78f
-Size (zope.interface-4.6.0.tar.gz) = 150884 bytes
+SHA1 (zope.interface-5.1.0.tar.gz) = 0b8c7f3a489cc02b303de60f6abf94cf509e7aae
+RMD160 (zope.interface-5.1.0.tar.gz) = 0c437521e303e78eed94c5d721c14b7c962cc142
+SHA512 (zope.interface-5.1.0.tar.gz) = be8319913222ada47a22559e22322ec12dff3adf17f45335d007c5aa3509d84a7d0a7e6c113967b91810b3613344b5c60e002eb740af2bbb454b2807de8dad98
+Size (zope.interface-5.1.0.tar.gz) = 225400 bytes



Home | Main Index | Thread Index | Old Index