Commit Graph

706 Commits

Author SHA1 Message Date
Jason Madden 324ba685da
Preparing release 5.4.0 2021-04-15 04:53:40 -05:00
Jason Madden 24b6a016bf
Merge pull request #240 from zopefoundation/issue239
Make C's __providedBy__ stop ignoring all errors and catch only AttributeError
2021-04-15 04:50:36 -05:00
Jason Madden 6a293da775
Finish sentence in docstring. [skip ci] 2021-04-15 04:50:13 -05:00
Jason Madden 253456fe17
Merge pull request #238 from zopefoundation/issue193
Make Declaration.__add__ try harder to produce consistent resolution orders
2021-04-15 04:42:53 -05:00
Jason Madden 8a0a8f1dea
Make C's __providedBy__ stop ignoring all errors and catch only AttributeError.
Fixes #239

There was a similar bug in the Python side where it would ignore a __provides__ of None, unlike the C implementation.
I documented this in the code but not the CHANGES.rst because I can't imagine anyone relying on that.
2021-04-13 16:47:53 -05:00
Jason Madden eb542a8a75
Make Declaration.__add__ try harder to produce consistent resolution orders.
By moving things from the RHS to the front of the list if they already extend something from the LHS.

Fixes #193
2021-04-01 07:11:26 -05:00
Jason Madden 4a686fc8d8
Merge pull request #237 from zopefoundation/issue236
Update repr() and str() of some common objects.
2021-03-29 06:04:58 -05:00
Jason Madden ce8f66f8bf
Update repr() and str() of some common objects.
Only InterfaceClass got a str, so it now has a distinction. Other objects only got updated reprs.

Note: This may potentially break some doctests.

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)``.

Fixes #236

Here's a before with ZOPE_INTERFACE_LOG_CHANGED_IRO=1 in BTrees:
```
Object <implementedBy builtins.list> has different legacy and C3 MROs:
  Legacy RO (len=11)                                                        C3 RO (len=11; inconsistent=no)
  ==================================================================================================================================================
    <implementedBy builtins.list>                                             <implementedBy builtins.list>
    <ABCInterfaceClass zope.interface.common.collections.IMutableSequence>    <ABCInterfaceClass zope.interface.common.collections.IMutableSequence>
    <ABCInterfaceClass zope.interface.common.collections.ISequence>           <ABCInterfaceClass zope.interface.common.collections.ISequence>
    <ABCInterfaceClass zope.interface.common.collections.IReversible>         <ABCInterfaceClass zope.interface.common.collections.IReversible>
    <ABCInterfaceClass zope.interface.common.collections.ICollection>         <ABCInterfaceClass zope.interface.common.collections.ICollection>
    <ABCInterfaceClass zope.interface.common.collections.ISized>              <ABCInterfaceClass zope.interface.common.collections.ISized>
                                                                            + <ABCInterfaceClass zope.interface.common.collections.IIterable>
    <ABCInterfaceClass zope.interface.common.collections.IContainer>          <ABCInterfaceClass zope.interface.common.collections.IContainer>
  - <ABCInterfaceClass zope.interface.common.collections.IIterable>
    <ABCInterfaceClass zope.interface.common.ABCInterface>                    <ABCInterfaceClass zope.interface.common.ABCInterface>
                                                                            + <implementedBy builtins.object>
    <InterfaceClass zope.interface.Interface>                                 <InterfaceClass zope.interface.Interface>
  - <implementedBy builtins.object>
Object <ABCInterfaceClass zope.interface.common.mapping.IFullMapping> has different legacy and C3 MROs:
  Legacy RO (len=18)                                                       C3 RO (len=18; inconsistent=no)
  ================================================================================================================================================
    <ABCInterfaceClass zope.interface.common.mapping.IFullMapping>           <ABCInterfaceClass zope.interface.common.mapping.IFullMapping>
    <ABCInterfaceClass zope.interface.common.collections.IMutableMapping>    <ABCInterfaceClass zope.interface.common.collections.IMutableMapping>
    <ABCInterfaceClass zope.interface.common.collections.IMapping>           <ABCInterfaceClass zope.interface.common.collections.IMapping>
    <ABCInterfaceClass zope.interface.common.collections.ICollection>        <ABCInterfaceClass zope.interface.common.collections.ICollection>
  - <ABCInterfaceClass zope.interface.common.collections.IIterable>
    <InterfaceClass zope.interface.common.mapping.IExtendedReadMapping>      <InterfaceClass zope.interface.common.mapping.IExtendedReadMapping>
    <InterfaceClass zope.interface.common.mapping.IIterableMapping>          <InterfaceClass zope.interface.common.mapping.IIterableMapping>
    <InterfaceClass zope.interface.common.mapping.IExtendedWriteMapping>     <InterfaceClass zope.interface.common.mapping.IExtendedWriteMapping>
    <InterfaceClass zope.interface.common.mapping.IClonableMapping>          <InterfaceClass zope.interface.common.mapping.IClonableMapping>
    <InterfaceClass zope.interface.common.mapping.IMapping>                  <InterfaceClass zope.interface.common.mapping.IMapping>
    <InterfaceClass zope.interface.common.mapping.IWriteMapping>             <InterfaceClass zope.interface.common.mapping.IWriteMapping>
    <InterfaceClass zope.interface.common.mapping.IEnumerableMapping>        <InterfaceClass zope.interface.common.mapping.IEnumerableMapping>
    <ABCInterfaceClass zope.interface.common.collections.ISized>             <ABCInterfaceClass zope.interface.common.collections.ISized>
                                                                           + <ABCInterfaceClass zope.interface.common.collections.IIterable>
    <InterfaceClass zope.interface.common.mapping.IReadMapping>              <InterfaceClass zope.interface.common.mapping.IReadMapping>
    <ABCInterfaceClass zope.interface.common.collections.IContainer>         <ABCInterfaceClass zope.interface.common.collections.IContainer>
    <ABCInterfaceClass zope.interface.common.ABCInterface>                   <ABCInterfaceClass zope.interface.common.ABCInterface>
    <InterfaceClass zope.interface.common.mapping.IItemMapping>              <InterfaceClass zope.interface.common.mapping.IItemMapping>
    <InterfaceClass zope.interface.Interface>                                <InterfaceClass zope.interface.Interface>
Object <InterfaceClass BTrees.Interfaces.ISet> has different legacy and C3 MROs:
  Legacy RO (len=7)                                  C3 RO (len=7; inconsistent=no)
  ====================================================================================================
    <InterfaceClass BTrees.Interfaces.ISet>            <InterfaceClass BTrees.Interfaces.ISet>
    <InterfaceClass BTrees.Interfaces.IKeySequence>    <InterfaceClass BTrees.Interfaces.IKeySequence>
  - <InterfaceClass BTrees.Interfaces.ISized>
    <InterfaceClass BTrees.Interfaces.ISetMutable>     <InterfaceClass BTrees.Interfaces.ISetMutable>
    <InterfaceClass BTrees.Interfaces.IKeyed>          <InterfaceClass BTrees.Interfaces.IKeyed>
    <InterfaceClass BTrees.Interfaces.ICollection>     <InterfaceClass BTrees.Interfaces.ICollection>
                                                     + <InterfaceClass BTrees.Interfaces.ISized>
    <InterfaceClass zope.interface.Interface>          <InterfaceClass zope.interface.Interface>
```

And here's after:

```
Object classImplements(list, IMutableSequence, IIterable) has different legacy and C3 MROs:
  Legacy RO (len=11)                                    C3 RO (len=11; inconsistent=no)
  ==========================================================================================================
    classImplements(list, IMutableSequence, IIterable)    classImplements(list, IMutableSequence, IIterable)
    zope.interface.common.collections.IMutableSequence    zope.interface.common.collections.IMutableSequence
    zope.interface.common.collections.ISequence           zope.interface.common.collections.ISequence
    zope.interface.common.collections.IReversible         zope.interface.common.collections.IReversible
    zope.interface.common.collections.ICollection         zope.interface.common.collections.ICollection
    zope.interface.common.collections.ISized              zope.interface.common.collections.ISized
                                                        + zope.interface.common.collections.IIterable
    zope.interface.common.collections.IContainer          zope.interface.common.collections.IContainer
  - zope.interface.common.collections.IIterable
    zope.interface.common.ABCInterface                    zope.interface.common.ABCInterface
                                                        + classImplements(object)
    zope.interface.Interface                              zope.interface.Interface
  - classImplements(object)
Object <ABCInterfaceClass zope.interface.common.mapping.IFullMapping> has different legacy and C3 MROs:
  Legacy RO (len=18)                                     C3 RO (len=18; inconsistent=no)
  ============================================================================================================
    zope.interface.common.mapping.IFullMapping             zope.interface.common.mapping.IFullMapping
    zope.interface.common.collections.IMutableMapping      zope.interface.common.collections.IMutableMapping
    zope.interface.common.collections.IMapping             zope.interface.common.collections.IMapping
    zope.interface.common.collections.ICollection          zope.interface.common.collections.ICollection
  - zope.interface.common.collections.IIterable
    zope.interface.common.mapping.IExtendedReadMapping     zope.interface.common.mapping.IExtendedReadMapping
    zope.interface.common.mapping.IIterableMapping         zope.interface.common.mapping.IIterableMapping
    zope.interface.common.mapping.IExtendedWriteMapping    zope.interface.common.mapping.IExtendedWriteMapping
    zope.interface.common.mapping.IClonableMapping         zope.interface.common.mapping.IClonableMapping
    zope.interface.common.mapping.IMapping                 zope.interface.common.mapping.IMapping
    zope.interface.common.mapping.IWriteMapping            zope.interface.common.mapping.IWriteMapping
    zope.interface.common.mapping.IEnumerableMapping       zope.interface.common.mapping.IEnumerableMapping
    zope.interface.common.collections.ISized               zope.interface.common.collections.ISized
                                                         + zope.interface.common.collections.IIterable
    zope.interface.common.mapping.IReadMapping             zope.interface.common.mapping.IReadMapping
    zope.interface.common.collections.IContainer           zope.interface.common.collections.IContainer
    zope.interface.common.ABCInterface                     zope.interface.common.ABCInterface
    zope.interface.common.mapping.IItemMapping             zope.interface.common.mapping.IItemMapping
    zope.interface.Interface                               zope.interface.Interface
Object <InterfaceClass BTrees.Interfaces.ISet> has different legacy and C3 MROs:
  Legacy RO (len=7)                 C3 RO (len=7; inconsistent=no)
  ==================================================================
    BTrees.Interfaces.ISet            BTrees.Interfaces.ISet
    BTrees.Interfaces.IKeySequence    BTrees.Interfaces.IKeySequence
  - BTrees.Interfaces.ISized
    BTrees.Interfaces.ISetMutable     BTrees.Interfaces.ISetMutable
    BTrees.Interfaces.IKeyed          BTrees.Interfaces.IKeyed
    BTrees.Interfaces.ICollection     BTrees.Interfaces.ICollection
                                    + BTrees.Interfaces.ISized
    zope.interface.Interface          zope.interface.Interface
```
2021-03-25 10:30:47 -05:00
Jens Vagelpohl e6d3805c6e
- prepare release 5.3.0 2021-03-21 10:35:24 +01:00
Jens Vagelpohl ef0b7dad44
- ignore virtualenv artifacts 2021-03-21 10:31:40 +01:00
Jason Madden dd0f7b9447
Back to development: 5.3.0a2 2021-03-18 09:11:38 -05:00
Jason Madden cec672fb3f
Preparing release 5.3.0a1 2021-03-18 09:11:13 -05:00
Jason Madden 5db4d7c689
Merge pull request #234 from zopefoundation/issue229-take2
Update documentation and Provides repr for better debugging.
2021-03-18 07:04:33 -05:00
Jason Madden f46bc4f788
Improve the tests for ProvidesClass.__repr__. 2021-03-18 06:00:14 -05:00
Jason Madden 45c97ab85d
Update documentation and Provides repr for better debugging.
Fixes #229.

Replaces #232
2021-03-18 05:17:52 -05:00
Jason Madden cfe4075488
Merge pull request #235 from zopefoundation/issue207
Make Provides and ClassProvides ignore redundant interfaces like @implementer
2021-03-18 05:14:10 -05:00
Jason Madden 7a9fcddc22
Merge pull request #233 from zopefoundation/docs-update
Update the Adaptation docs to be more concrete.
2021-03-17 11:43:08 -05:00
Jason Madden 686760eb26
Update docs/README.rst: Two expressions need two lines
Co-authored-by: Michael Howitz <mh@gocept.com>
2021-03-17 11:42:18 -05:00
Jason Madden 45b9294e9d
Make Provides and ClassProvides ignore redundant interfaces like @implementer
cf #207
2021-03-17 11:11:19 -05:00
Jason Madden 762c253064
Merge pull request #231 from zopefoundation/issue230
Add IAdapterRegistry.subscribed and Components.rebuildUtilityRegistryFromLocalCache
2021-03-17 10:09:13 -05:00
Jason Madden 488a317abd
Update the Adaptation docs to be more concrete.
This should help provide better motivating use cases. Examples inspired by https://glyph.twistedmatrix.com/2021/03/interfaces-and-protocols.html

Also some minor typo fixes and updates to comments.
2021-03-17 07:39:49 -05:00
Jason Madden 8728a3efad
Tweak wrapping in subscribed() docstring. 2021-03-16 08:40:02 -05:00
Jason Madden 8534bdc961
Add missing quote in docstring in src/zope/interface/registry.py
Co-authored-by: Marius Gedminas <marius@gedmin.as>
2021-03-16 08:33:48 -05:00
Jason Madden 820b9b0299
Share code between registered and subscribed. 2021-03-15 10:04:09 -05:00
Jason Madden 50c73de0a8
Add IAdapterRegistry.subscribed and Components.rebuildUtilityRegistryFromLocalCache
Fixes #230
2021-03-15 09:43:24 -05:00
Jason Madden dd69666aae
Merge pull request #228 from zopefoundation/issue224
Let subclasses of BaseAdapterRegistry customize the data structures.
2021-03-15 08:42:43 -05:00
Jason Madden 67f0be5218
Expand on some comments. [skip ci] 2021-03-15 08:42:24 -05:00
Jason Madden a8d56b9d3c
Move itertools import to module scope.
Also tweak docs.
2021-03-15 06:32:02 -05:00
Jason Madden 8a8285133b
Let subclasses of BaseAdapterRegistry customize the data structures.
Add extensive tests for this. Fixes #224.

Also adds test for, and fixes #227

Add BAR.rebuild() to fix the refcount issue, and to change datatypes.

It works by using the new methods allRegistrations() and allSubscriptions() to re-create the data in new data structures.

This makes fresh calls to subscribe() and register(). I went this way instead of trying to manually walk the data structures and create them because the logic in those methods is fully tested.
2021-03-03 05:07:41 -06:00
Jason Madden c28c205c91
Merge pull request #226 from zopefoundation/issue225
First pass at github actions.
2021-03-03 05:06:58 -06:00
Jason Madden 9438f25e2e
Typo fixes 2021-03-01 05:30:58 -06:00
Jason Madden d304384618
manylinux2010 stopped shipping Python 2.7, so use a tagged version that still has it.
See https://github.com/pypa/manylinux/issues/428
2021-02-26 10:34:02 -06:00
Jason Madden a99dc79884
First pass at github actions.
Fixes #225. Someone will need to add a `TWINE_PASSWORD` GitHub repository secret that is
a token for `zope.eggbuilder` to upload to zope.interface.

Builds and uploads manylinux32/64/aarch64 wheels.

Builds and uploads Mac wheels.

Builds the docs.

Runs tests with the C extension and without the C extension.

Reports coverage to coveralls.

Has the start of an environment to do linting.

Removes .travis.yml
2021-02-26 08:43:43 -06:00
Michael Howitz bf0de08af2 Back to development: 5.2.1 2020-11-05 13:31:51 +01:00
Michael Howitz c64c69b041 Preparing release 5.2.0 2020-11-05 13:31:41 +01:00
Michael Howitz 3efc9579ba
Add support for Python 3.9. (#222) 2020-11-05 13:30:11 +01:00
odidev db372a6a07 Add support for arm64 wheel 2020-11-05 11:38:07 +05:30
Marius Gedminas ce317d1b07
Merge pull request #221 from zopefoundation/all-repos_autofix_all-repos-sed
Update badge URL for Travis
2020-10-28 17:35:27 +02:00
Jürgen Gmach dfe46a9f01 Update badge URL for Travis
Committed via https://github.com/asottile/all-repos
2020-10-28 14:44:35 +01:00
Dieter Maurer e0ff695d2f
Merge pull request #220 from zopefoundation/doc_persistency_equality#218
Document persistency and equality
2020-10-26 15:21:59 +01:00
Jason Madden 34085388b3
Add more persistence examples. 2020-10-23 15:32:46 -05:00
Jason Madden 2ae267b910
Explore more details of persistence and expand on the motivation for how this relates to equality/hashing/sorting. 2020-10-23 15:18:55 -05:00
Jason Madden 27347de877
Add example from #220 to the specification docs and expand it. 2020-10-23 15:18:16 -05:00
dieter 4f76a54239 cosmetics 2020-10-19 08:28:18 +02:00
dieter c49e8b27b6 add example 2020-10-19 08:16:55 +02:00
dieter 3b99e6d097 Document persistency and equality 2020-10-16 09:28:09 +02:00
Jason Madden 4d0e0cf8d1
Back to development: 5.1.3 2020-10-01 07:36:27 -05:00
Jason Madden 375f39b75f
Preparing release 5.1.2 2020-10-01 07:36:06 -05:00
Jan-Jaap Driessen 5cb7ffdb52
Merge pull request #215 from minddistrict/master
Make sure to call each invariant only once when validating invariants.
2020-10-01 13:52:27 +02:00
Jan-Jaap Driessen ca5b7e0c8d Merge branch 'master' of github.com:zopefoundation/zope.interface into master 2020-10-01 13:05:12 +02:00