Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up __eq__ by generating code #306

Merged
merged 3 commits into from Dec 4, 2017
Merged

Speed up __eq__ by generating code #306

merged 3 commits into from Dec 4, 2017

Conversation

hynek
Copy link
Member

@hynek hynek commented Dec 3, 2017

So this is a 1:1 implementation of the old behaviour, ignoring #305 for now.

Improvements:

import attr


@attr.s(hash=True)
class C:
    x = attr.ib()
    y = attr.ib()
    z = attr.ib()


c1 = C(1, "2", 3.0)
c2 = C(1, "2", 3.0)

attrs 17.3.0:

➤ pyperf timeit --rigorous -s "from t import c1, c2" "c1 == c2"
.........................................
Mean +- std dev: 3.24 us +- 0.13 us

New:

➤ pyperf timeit --rigorous -s "from t import c1, c2" "c1 == c2"
.........................................
Mean +- std dev: 538 ns +- 29 ns

For sets:

attrs 17.3.0:

➤ pyperf timeit --rigorous -s "from t import c1, c2" "s = {c1, c2}; c1 in s"
.........................................
Mean +- std dev: 8.56 us +- 0.32 us

New:

➤ pyperf timeit --rigorous -s "from t import c1, c2" "s = {c1, c2}; c1 in s"
.........................................
Mean +- std dev: 1.82 us +- 0.09 us

This looks nice. :)

@hynek hynek added this to the 17.4 milestone Dec 3, 2017
@codecov
Copy link

codecov bot commented Dec 3, 2017

Codecov Report

Merging #306 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #306   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           9      9           
  Lines         717    733   +16     
  Branches      151    152    +1     
=====================================
+ Hits          717    733   +16
Impacted Files Coverage Δ
src/attr/_make.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3485799...2a2cb1b. Read the comment docs.

@python-attrs python-attrs deleted a comment from codecov bot Dec 3, 2017
@Tinche
Copy link
Member

Tinche commented Dec 3, 2017

The speed up looks excellent. So, an evil thought: if the class in question is a dict class, does self.__dict __ == other.__dict__ fulfills all our requirements? 😈

@hynek
Copy link
Member Author

hynek commented Dec 3, 2017

Where are you getting your ideas? ಠ_ಠ

(For posterity: no it doesn’t :) — unless class is frozen
And all attributes are part of eq and probably a few more invariants.)

@Tinche
Copy link
Member

Tinche commented Dec 3, 2017

I admit the idea is probably not usable in practice but I'd like to get to why exactly? All attributes are in instance.__dict__. And what does the frozenness of the class have to do with it?

Also consider this:

@attr.s
class C:
    a = attr.ib()

>>> a =  C(1)
>>> b = C(1)
>>> a == b
True
>>> a.b = 2
>>> a == b
True

@Tinche
Copy link
Member

Tinche commented Dec 3, 2017

Just to clarify, I'm considering the eligibility of the following __eq__ implementation (but just for dict classes, obviously):

def __eq__(self, other):
    return self.__dict__ == other.__dict__

@hynek
Copy link
Member Author

hynek commented Dec 3, 2017

The main reason is that it changes the whole contract between attrs and its users. Currently we promise we only care about attributes that are explicitly defined. This approach would compare everything. Frozenness technically prevents people from tacking more attributes on instances that we shouldn’t know about.

@hynek
Copy link
Member Author

hynek commented Dec 4, 2017

Now that I’m not on a phone anymore: what I mean is something like this:

>>> import attr

>>> @attr.s(cmp=False)
... class C:
...     x = attr.ib()
...     def __eq__(self, other):
...         return self.__dict__ == other.__dict__

>>> C(1)
C(x=1)

>>> c1 = C(1)

>>> c2 = C(1)

>>> c1 == c2
True

>>> c2._cache = {}

>>> c1 == c2
False

Leaving aside better ways to achieve that, I’m sure people have done that and breaking backward compat for no real gain doesn’t seem a great way forward to me…

@Tinche
Copy link
Member

Tinche commented Dec 4, 2017

Yeah, yeah, point taken, I recant my suggestion. Damn users, making it hard for us :(

At this point I'd really like to know if there's any speed difference between a chain of ands and comparing tuples; think this is easy to hack together on this branch?

@Tinche
Copy link
Member

Tinche commented Dec 4, 2017

Ah I see you did the ands benchmark in another thread, and it's slower? Hm. I guess tuples are the way to go then.

@hynek
Copy link
Member Author

hynek commented Dec 4, 2017

Yeah it’s def slower if the classes are equal. The difference is in any case marginal, so we can choose what we do. For now I’d prefer to not break backward compatibility. :)

Copy link

@wsanchez wsanchez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm allergic to %-formatting, so that bugs me, but this is ok. :-)

@hynek hynek merged commit cd8890c into master Dec 4, 2017
@hynek hynek deleted the fast-eq branch December 4, 2017 17:48
@hynek
Copy link
Member Author

hynek commented Dec 4, 2017

I’ve stopped using "".format() because it’s slow and ugly. f-strings for lyfe! :)

bors-fusion bot added a commit to fusionapp/documint that referenced this pull request Jan 1, 2018
124: Scheduled weekly dependency update for week 00 r=mithrandi a=pyup-bot




## Updates
Here's a list of all the updates bundled in this pull request. I've added some links to make it easier for you to find all the information you need.
<table align="center">

<tr>
<td><b>asn1crypto</b></td>
<td align="center">0.23.0</td>
<td align="center">&raquo;</td>
<td align="center">0.24.0</td>
<td>
     <a href="https://pypi.python.org/pypi/asn1crypto">PyPI</a> | <a href="https://pyup.io/changelogs/asn1crypto/">Changelog</a> | <a href="https://github.com/wbond/asn1crypto/issues">Repo</a> 

</td>

<tr>
<td><b>attrs</b></td>
<td align="center">17.3.0</td>
<td align="center">&raquo;</td>
<td align="center">17.4.0</td>
<td>
     <a href="https://pypi.python.org/pypi/attrs">PyPI</a> | <a href="https://pyup.io/changelogs/attrs/">Changelog</a> | <a href="http://www.attrs.org/">Homepage</a> 

</td>

<tr>
<td><b>ipaddress</b></td>
<td align="center">1.0.18</td>
<td align="center">&raquo;</td>
<td align="center">1.0.19</td>
<td>
     <a href="https://pypi.python.org/pypi/ipaddress">PyPI</a> | <a href="https://github.com/phihag/ipaddress">Repo</a> 

</td>

</tr>
</table>



## Changelogs


### asn1crypto 0.23.0 -> 0.24.0

>### 0.24.0


> - `x509.Certificate().self_signed` will no longer return `&quot;yes&quot;` under any
>   circumstances. This helps prevent confusion since the library does not
>   verify the signature. Instead a library like oscrypto should be used
>   to confirm if a certificate is self-signed.
> - Added various OIDs to `x509.KeyPurposeId()`
> - Added `x509.Certificate().private_key_usage_period_value`
> - Added structures for parsing common subject directory attributes for
>   X.509 certificates, including `x509.SubjectDirectoryAttribute()`
> - Added `algos.AnyAlgorithmIdentifier()` for situations where an
>   algorithm identifier may contain a digest, signed digest or encryption
>   algorithm OID
> - Fixed a bug with `x509.Certificate().subject_directory_attributes_value`
>   not returning the correct value
> - Fixed a bug where explicitly-tagged fields in a `core.Sequence()` would
>   not function properly when the field had a default value
> - Fixed a bug with type checking in `pem.armor()`







### attrs 17.3.0 -> 17.4.0

>### 17.4.0

>-------------------

>Backward-incompatible Changes
>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>- The traversal of MROs when using multiple inheritance was backward:
>  If you defined a class ``C`` that subclasses ``A`` and ``B`` like ``C(A, B)``, ``attrs`` would have collected the attributes from ``B`` *before* those of ``A``.

>  This is now fixed and means that in classes that employ multiple inheritance, the output of ``__repr__`` and the order of positional arguments in ``__init__`` changes.
>  Due to the nature of this bug, a proper deprecation cycle was unfortunately impossible.

>  Generally speaking, it&#39;s advisable to prefer ``kwargs``-based initialization anyways – *especially* if you employ multiple inheritance and diamond-shaped hierarchies.

>  `298 &lt;https://github.com/python-attrs/attrs/issues/298&gt;`_,
>  `299 &lt;https://github.com/python-attrs/attrs/issues/299&gt;`_,
>  `304 &lt;https://github.com/python-attrs/attrs/issues/304&gt;`_
>- The ``__repr__`` set by ``attrs``
>  no longer produces an ``AttributeError``
>  when the instance is missing some of the specified attributes
>  (either through deleting
>  or after using ``init=False`` on some attributes).

>  This can break code
>  that relied on ``repr(attr_cls_instance)`` raising ``AttributeError``
>  to check if any attr-specified members were unset.

>  If you were using this,
>  you can implement a custom method for checking this::

>      def has_unset_members(self):
>          for field in attr.fields(type(self)):
>              try:
>                  getattr(self, field.name)
>              except AttributeError:
>                  return True
>          return False

>  `308 &lt;https://github.com/python-attrs/attrs/issues/308&gt;`_


>Deprecations
>^^^^^^^^^^^^

>- The ``attr.ib(convert=callable)`` option is now deprecated in favor of ``attr.ib(converter=callable)``.

>  This is done to achieve consistency with other noun-based arguments like *validator*.

>  *convert* will keep working until at least January 2019 while raising a ``DeprecationWarning``.

>  `307 &lt;https://github.com/python-attrs/attrs/issues/307&gt;`_


>Changes
>^^^^^^^

>- Generated ``__hash__`` methods now hash the class type along with the attribute values.
>  Until now the hashes of two classes with the same values were identical which was a bug.

>  The generated method is also *much* faster now.

>  `261 &lt;https://github.com/python-attrs/attrs/issues/261&gt;`_,
>  `295 &lt;https://github.com/python-attrs/attrs/issues/295&gt;`_,
>  `296 &lt;https://github.com/python-attrs/attrs/issues/296&gt;`_
>- ``attr.ib``\ ’s ``metadata`` argument now defaults to a unique empty ``dict`` instance instead of sharing a common empty ``dict`` for all.
>  The singleton empty ``dict`` is still enforced.

>  `280 &lt;https://github.com/python-attrs/attrs/issues/280&gt;`_
>- ``ctypes`` is optional now however if it&#39;s missing, a bare ``super()`` will not work in slots classes.
>  This should only happen in special environments like Google App Engine.

>  `284 &lt;https://github.com/python-attrs/attrs/issues/284&gt;`_,
>  `286 &lt;https://github.com/python-attrs/attrs/issues/286&gt;`_
>- The attribute redefinition feature introduced in 17.3.0 now takes into account if an attribute is redefined via multiple inheritance.
>  In that case, the definition that is closer to the base of the class hierarchy wins.

>  `285 &lt;https://github.com/python-attrs/attrs/issues/285&gt;`_,
>  `287 &lt;https://github.com/python-attrs/attrs/issues/287&gt;`_
>- Subclasses of ``auto_attribs=True`` can be empty now.

>  `291 &lt;https://github.com/python-attrs/attrs/issues/291&gt;`_,
>  `292 &lt;https://github.com/python-attrs/attrs/issues/292&gt;`_
>- Equality tests are *much* faster now.

>  `306 &lt;https://github.com/python-attrs/attrs/issues/306&gt;`_
>- All generated methods now have correct ``__module__``, ``__name__``, and (on Python 3) ``__qualname__`` attributes.

>  `309 &lt;https://github.com/python-attrs/attrs/issues/309&gt;`_


>----











That's it for now!

Happy merging! 🤖
bors-fusion bot added a commit to fusionapp/entropy that referenced this pull request Jan 1, 2018
167: Scheduled weekly dependency update for week 00 r=mithrandi a=pyup-bot




## Updates
Here's a list of all the updates bundled in this pull request. I've added some links to make it easier for you to find all the information you need.
<table align="center">

<tr>
<td><b>asn1crypto</b></td>
<td align="center">0.23.0</td>
<td align="center">&raquo;</td>
<td align="center">0.24.0</td>
<td>
     <a href="https://pypi.python.org/pypi/asn1crypto">PyPI</a> | <a href="https://pyup.io/changelogs/asn1crypto/">Changelog</a> | <a href="https://github.com/wbond/asn1crypto/issues">Repo</a> 

</td>

<tr>
<td><b>attrs</b></td>
<td align="center">17.3.0</td>
<td align="center">&raquo;</td>
<td align="center">17.4.0</td>
<td>
     <a href="https://pypi.python.org/pypi/attrs">PyPI</a> | <a href="https://pyup.io/changelogs/attrs/">Changelog</a> | <a href="http://www.attrs.org/">Homepage</a> 

</td>

<tr>
<td><b>ipaddress</b></td>
<td align="center">1.0.18</td>
<td align="center">&raquo;</td>
<td align="center">1.0.19</td>
<td>
     <a href="https://pypi.python.org/pypi/ipaddress">PyPI</a> | <a href="https://github.com/phihag/ipaddress">Repo</a> 

</td>

<tr>
<td><b>txaws</b></td>
<td align="center">0.4.0</td>
<td align="center">&raquo;</td>
<td align="center">0.5.0</td>
<td>
     <a href="https://pypi.python.org/pypi/txaws">PyPI</a> | <a href="https://pyup.io/changelogs/txaws/">Changelog</a> | <a href="https://github.com/twisted/txaws">Repo</a> 

</td>

</tr>
</table>



## Changelogs


### asn1crypto 0.23.0 -> 0.24.0

>### 0.24.0


> - `x509.Certificate().self_signed` will no longer return `&quot;yes&quot;` under any
>   circumstances. This helps prevent confusion since the library does not
>   verify the signature. Instead a library like oscrypto should be used
>   to confirm if a certificate is self-signed.
> - Added various OIDs to `x509.KeyPurposeId()`
> - Added `x509.Certificate().private_key_usage_period_value`
> - Added structures for parsing common subject directory attributes for
>   X.509 certificates, including `x509.SubjectDirectoryAttribute()`
> - Added `algos.AnyAlgorithmIdentifier()` for situations where an
>   algorithm identifier may contain a digest, signed digest or encryption
>   algorithm OID
> - Fixed a bug with `x509.Certificate().subject_directory_attributes_value`
>   not returning the correct value
> - Fixed a bug where explicitly-tagged fields in a `core.Sequence()` would
>   not function properly when the field had a default value
> - Fixed a bug with type checking in `pem.armor()`







### attrs 17.3.0 -> 17.4.0

>### 17.4.0

>-------------------

>Backward-incompatible Changes
>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>- The traversal of MROs when using multiple inheritance was backward:
>  If you defined a class ``C`` that subclasses ``A`` and ``B`` like ``C(A, B)``, ``attrs`` would have collected the attributes from ``B`` *before* those of ``A``.

>  This is now fixed and means that in classes that employ multiple inheritance, the output of ``__repr__`` and the order of positional arguments in ``__init__`` changes.
>  Due to the nature of this bug, a proper deprecation cycle was unfortunately impossible.

>  Generally speaking, it&#39;s advisable to prefer ``kwargs``-based initialization anyways – *especially* if you employ multiple inheritance and diamond-shaped hierarchies.

>  `298 &lt;https://github.com/python-attrs/attrs/issues/298&gt;`_,
>  `299 &lt;https://github.com/python-attrs/attrs/issues/299&gt;`_,
>  `304 &lt;https://github.com/python-attrs/attrs/issues/304&gt;`_
>- The ``__repr__`` set by ``attrs``
>  no longer produces an ``AttributeError``
>  when the instance is missing some of the specified attributes
>  (either through deleting
>  or after using ``init=False`` on some attributes).

>  This can break code
>  that relied on ``repr(attr_cls_instance)`` raising ``AttributeError``
>  to check if any attr-specified members were unset.

>  If you were using this,
>  you can implement a custom method for checking this::

>      def has_unset_members(self):
>          for field in attr.fields(type(self)):
>              try:
>                  getattr(self, field.name)
>              except AttributeError:
>                  return True
>          return False

>  `308 &lt;https://github.com/python-attrs/attrs/issues/308&gt;`_


>Deprecations
>^^^^^^^^^^^^

>- The ``attr.ib(convert=callable)`` option is now deprecated in favor of ``attr.ib(converter=callable)``.

>  This is done to achieve consistency with other noun-based arguments like *validator*.

>  *convert* will keep working until at least January 2019 while raising a ``DeprecationWarning``.

>  `307 &lt;https://github.com/python-attrs/attrs/issues/307&gt;`_


>Changes
>^^^^^^^

>- Generated ``__hash__`` methods now hash the class type along with the attribute values.
>  Until now the hashes of two classes with the same values were identical which was a bug.

>  The generated method is also *much* faster now.

>  `261 &lt;https://github.com/python-attrs/attrs/issues/261&gt;`_,
>  `295 &lt;https://github.com/python-attrs/attrs/issues/295&gt;`_,
>  `296 &lt;https://github.com/python-attrs/attrs/issues/296&gt;`_
>- ``attr.ib``\ ’s ``metadata`` argument now defaults to a unique empty ``dict`` instance instead of sharing a common empty ``dict`` for all.
>  The singleton empty ``dict`` is still enforced.

>  `280 &lt;https://github.com/python-attrs/attrs/issues/280&gt;`_
>- ``ctypes`` is optional now however if it&#39;s missing, a bare ``super()`` will not work in slots classes.
>  This should only happen in special environments like Google App Engine.

>  `284 &lt;https://github.com/python-attrs/attrs/issues/284&gt;`_,
>  `286 &lt;https://github.com/python-attrs/attrs/issues/286&gt;`_
>- The attribute redefinition feature introduced in 17.3.0 now takes into account if an attribute is redefined via multiple inheritance.
>  In that case, the definition that is closer to the base of the class hierarchy wins.

>  `285 &lt;https://github.com/python-attrs/attrs/issues/285&gt;`_,
>  `287 &lt;https://github.com/python-attrs/attrs/issues/287&gt;`_
>- Subclasses of ``auto_attribs=True`` can be empty now.

>  `291 &lt;https://github.com/python-attrs/attrs/issues/291&gt;`_,
>  `292 &lt;https://github.com/python-attrs/attrs/issues/292&gt;`_
>- Equality tests are *much* faster now.

>  `306 &lt;https://github.com/python-attrs/attrs/issues/306&gt;`_
>- All generated methods now have correct ``__module__``, ``__name__``, and (on Python 3) ``__qualname__`` attributes.

>  `309 &lt;https://github.com/python-attrs/attrs/issues/309&gt;`_


>----











That's it for now!

Happy merging! 🤖
bors-fusion bot added a commit to fusionapp/fusion-index that referenced this pull request Jan 1, 2018
174: Scheduled weekly dependency update for week 00 r=mithrandi a=pyup-bot




## Updates
Here's a list of all the updates bundled in this pull request. I've added some links to make it easier for you to find all the information you need.
<table align="center">

<tr>
<td><b>asn1crypto</b></td>
<td align="center">0.23.0</td>
<td align="center">&raquo;</td>
<td align="center">0.24.0</td>
<td>
     <a href="https://pypi.python.org/pypi/asn1crypto">PyPI</a> | <a href="https://pyup.io/changelogs/asn1crypto/">Changelog</a> | <a href="https://github.com/wbond/asn1crypto/issues">Repo</a> 

</td>

<tr>
<td><b>attrs</b></td>
<td align="center">17.3.0</td>
<td align="center">&raquo;</td>
<td align="center">17.4.0</td>
<td>
     <a href="https://pypi.python.org/pypi/attrs">PyPI</a> | <a href="https://pyup.io/changelogs/attrs/">Changelog</a> | <a href="http://www.attrs.org/">Homepage</a> 

</td>

<tr>
<td><b>hypothesis</b></td>
<td align="center">3.40.1</td>
<td align="center">&raquo;</td>
<td align="center">3.44.4</td>
<td>
     <a href="https://pypi.python.org/pypi/hypothesis">PyPI</a> | <a href="https://pyup.io/changelogs/hypothesis/">Changelog</a> | <a href="https://github.com/HypothesisWorks/hypothesis/issues">Repo</a> 

</td>

<tr>
<td><b>ipaddress</b></td>
<td align="center">1.0.18</td>
<td align="center">&raquo;</td>
<td align="center">1.0.19</td>
<td>
     <a href="https://pypi.python.org/pypi/ipaddress">PyPI</a> | <a href="https://github.com/phihag/ipaddress">Repo</a> 

</td>

<tr>
<td><b>pyrsistent</b></td>
<td align="center">0.14.1</td>
<td align="center">&raquo;</td>
<td align="center">0.14.2</td>
<td>
     <a href="https://pypi.python.org/pypi/pyrsistent">PyPI</a> | <a href="https://pyup.io/changelogs/pyrsistent/">Changelog</a> | <a href="http://github.com/tobgu/pyrsistent/">Repo</a> 

</td>

<tr>
<td><b>toolz</b></td>
<td align="center">0.8.2</td>
<td align="center">&raquo;</td>
<td align="center">0.9.0</td>
<td>
     <a href="https://pypi.python.org/pypi/toolz">PyPI</a> | <a href="https://github.com/pytoolz/toolz">Repo</a> 

</td>

</tr>
</table>



## Changelogs


### asn1crypto 0.23.0 -> 0.24.0

>### 0.24.0


> - `x509.Certificate().self_signed` will no longer return `&quot;yes&quot;` under any
>   circumstances. This helps prevent confusion since the library does not
>   verify the signature. Instead a library like oscrypto should be used
>   to confirm if a certificate is self-signed.
> - Added various OIDs to `x509.KeyPurposeId()`
> - Added `x509.Certificate().private_key_usage_period_value`
> - Added structures for parsing common subject directory attributes for
>   X.509 certificates, including `x509.SubjectDirectoryAttribute()`
> - Added `algos.AnyAlgorithmIdentifier()` for situations where an
>   algorithm identifier may contain a digest, signed digest or encryption
>   algorithm OID
> - Fixed a bug with `x509.Certificate().subject_directory_attributes_value`
>   not returning the correct value
> - Fixed a bug where explicitly-tagged fields in a `core.Sequence()` would
>   not function properly when the field had a default value
> - Fixed a bug with type checking in `pem.armor()`







### attrs 17.3.0 -> 17.4.0

>### 17.4.0

>-------------------

>Backward-incompatible Changes
>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>- The traversal of MROs when using multiple inheritance was backward:
>  If you defined a class ``C`` that subclasses ``A`` and ``B`` like ``C(A, B)``, ``attrs`` would have collected the attributes from ``B`` *before* those of ``A``.

>  This is now fixed and means that in classes that employ multiple inheritance, the output of ``__repr__`` and the order of positional arguments in ``__init__`` changes.
>  Due to the nature of this bug, a proper deprecation cycle was unfortunately impossible.

>  Generally speaking, it&#39;s advisable to prefer ``kwargs``-based initialization anyways – *especially* if you employ multiple inheritance and diamond-shaped hierarchies.

>  `298 &lt;https://github.com/python-attrs/attrs/issues/298&gt;`_,
>  `299 &lt;https://github.com/python-attrs/attrs/issues/299&gt;`_,
>  `304 &lt;https://github.com/python-attrs/attrs/issues/304&gt;`_
>- The ``__repr__`` set by ``attrs``
>  no longer produces an ``AttributeError``
>  when the instance is missing some of the specified attributes
>  (either through deleting
>  or after using ``init=False`` on some attributes).

>  This can break code
>  that relied on ``repr(attr_cls_instance)`` raising ``AttributeError``
>  to check if any attr-specified members were unset.

>  If you were using this,
>  you can implement a custom method for checking this::

>      def has_unset_members(self):
>          for field in attr.fields(type(self)):
>              try:
>                  getattr(self, field.name)
>              except AttributeError:
>                  return True
>          return False

>  `308 &lt;https://github.com/python-attrs/attrs/issues/308&gt;`_


>Deprecations
>^^^^^^^^^^^^

>- The ``attr.ib(convert=callable)`` option is now deprecated in favor of ``attr.ib(converter=callable)``.

>  This is done to achieve consistency with other noun-based arguments like *validator*.

>  *convert* will keep working until at least January 2019 while raising a ``DeprecationWarning``.

>  `307 &lt;https://github.com/python-attrs/attrs/issues/307&gt;`_


>Changes
>^^^^^^^

>- Generated ``__hash__`` methods now hash the class type along with the attribute values.
>  Until now the hashes of two classes with the same values were identical which was a bug.

>  The generated method is also *much* faster now.

>  `261 &lt;https://github.com/python-attrs/attrs/issues/261&gt;`_,
>  `295 &lt;https://github.com/python-attrs/attrs/issues/295&gt;`_,
>  `296 &lt;https://github.com/python-attrs/attrs/issues/296&gt;`_
>- ``attr.ib``\ ’s ``metadata`` argument now defaults to a unique empty ``dict`` instance instead of sharing a common empty ``dict`` for all.
>  The singleton empty ``dict`` is still enforced.

>  `280 &lt;https://github.com/python-attrs/attrs/issues/280&gt;`_
>- ``ctypes`` is optional now however if it&#39;s missing, a bare ``super()`` will not work in slots classes.
>  This should only happen in special environments like Google App Engine.

>  `284 &lt;https://github.com/python-attrs/attrs/issues/284&gt;`_,
>  `286 &lt;https://github.com/python-attrs/attrs/issues/286&gt;`_
>- The attribute redefinition feature introduced in 17.3.0 now takes into account if an attribute is redefined via multiple inheritance.
>  In that case, the definition that is closer to the base of the class hierarchy wins.

>  `285 &lt;https://github.com/python-attrs/attrs/issues/285&gt;`_,
>  `287 &lt;https://github.com/python-attrs/attrs/issues/287&gt;`_
>- Subclasses of ``auto_attribs=True`` can be empty now.

>  `291 &lt;https://github.com/python-attrs/attrs/issues/291&gt;`_,
>  `292 &lt;https://github.com/python-attrs/attrs/issues/292&gt;`_
>- Equality tests are *much* faster now.

>  `306 &lt;https://github.com/python-attrs/attrs/issues/306&gt;`_
>- All generated methods now have correct ``__module__``, ``__name__``, and (on Python 3) ``__qualname__`` attributes.

>  `309 &lt;https://github.com/python-attrs/attrs/issues/309&gt;`_


>----








### hypothesis 3.40.1 -> 3.44.4

>### 3.44.4

>-------------------

>This release fixes :issue:`1044`, which slowed tests by up to 6%
>due to broken caching.

>-------------------


>### 3.44.3

>-------------------

>This release improves the shrinker in cases where examples drawn earlier can
>affect how much data is drawn later (e.g. when you draw a length parameter in
>a composite and then draw that many elements). Examples found in cases like
>this should now be much closer to minimal.

>-------------------


>### 3.44.2

>-------------------

>This is a pure refactoring release which changes how Hypothesis manages its
>set of examples internally. It should have no externally visible effects.

>-------------------


>### 3.44.1

>-------------------

>This release fixes :issue:`997`, in which under some circumstances the body of
>tests run under Hypothesis would not show up when run under coverage even
>though the tests were run and the code they called outside of the test file
>would show up normally.

>-------------------


>### 3.44.0

>-------------------

>This release adds a new feature: The :ref:`reproduce_failure &lt;reproduce_failure&gt;`,
>designed to make it easy to use Hypothesis&#39;s binary format for examples to
>reproduce a problem locally without having to share your example database
>between machines.

>This also changes when seeds are printed:

>* They will no longer be printed for
>  normal falsifying examples, as there are now adequate ways of reproducing those
>  for all cases, so it just contributes noise.
>* They will once again be printed when reusing examples from the database, as
>  health check failures should now be more reliable in this scenario so it will
>  almost always work in this case.

>This work was funded by `Smarkets &lt;https://smarkets.com/&gt;`_.

>-------------------


>### 3.43.1

>-------------------

>This release fixes a bug with Hypothesis&#39;s database management - examples that
>were found in the course of shrinking were saved in a way that indicated that
>they had distinct causes, and so they would all be retried on the start of the
>next test. The intended behaviour, which is now what is implemented, is that
>only a bounded subset of these examples would be retried.

>-------------------


>### 3.43.0

>-------------------

>:exc:`~hypothesis.errors.HypothesisDeprecationWarning` now inherits from
>:exc:`python:FutureWarning` instead of :exc:`python:DeprecationWarning`,
>as recommended by :pep:`565` for user-facing warnings (:issue:`618`).
>If you have not changed the default warnings settings, you will now see
>each distinct :exc:`~hypothesis.errors.HypothesisDeprecationWarning`
>instead of only the first.

>-------------------


>### 3.42.2

>-------------------

>This patch fixes :issue:`1017`, where instances of a list or tuple subtype
>used as an argument to a strategy would be coerced to tuple.

>-------------------


>### 3.42.1

>-------------------

>This release has some internal cleanup, which makes reading the code
>more pleasant and may shrink large examples slightly faster.

>-------------------


>### 3.42.0

>-------------------

>This release deprecates :ref:`faker-extra`, which was designed as a transition
>strategy but does not support example shrinking or coverage-guided discovery.

>-------------------


>### 3.41.0

>-------------------

>:func:`~hypothesis.strategies.sampled_from` can now sample from
>one-dimensional numpy ndarrays. Sampling from multi-dimensional
>ndarrays still results in a deprecation warning. Thanks to Charlie
>Tanksley for this patch.

>-------------------






### pyrsistent 0.14.1 -> 0.14.2

>### 0.14.2

> * Fix 121, regression in PClass.set() introduced in 0.14.1.










That's it for now!

Happy merging! 🤖
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants