* Clarify documentation for hashing
Makes clear that hashable objects need to be deeply immutable, in
practice even if not in theory.
Closes#503 .
* Use simple past tense in docs
* Don't cache hash codes across deserialization.
Because the hash code cache field gets serialized and deserialized by
Pickle, previously when you deserialize a cache_hash=True attrs object, the
hashcode will be the hashcode the object had at serialization-time.
However, if your object had fields with hash codes which were not
deterministic between interpreter runs, then on a new interpreter run
your deserialized object would have a hash code which differs from a
newly created identical object.
This commit fixes that by clearing the cache on deserialization. It
needs to override the __setstate__ method to do so, so this commit
also forbids using a custom __setstate__ on a cache_hash=True object.
Closes#482 .
* Improve exception type
* Minor tweaks to comments formatting
* Fix test for Python 2.7
* Fix error in comment
* Make nomenclature consistent for slotted/dict classes
* Remove hasattr()
* Improve comments and error message for custom __setstate__ + cache_hash=True
* Drop use of for test classes for cache hash serialization
* Make changelog note this is a breaking change
* Make exception message point to tracking issue
* Fix test classes for Python 2.7
I've always parsed this sentence as "attrs comes with serious, business aliases". I just realized you probably meant srs bzns aliases and figured I'd clarify.
* Allow init=False attributes to follow kw_only attributes
Closes#450
* Fix changelog typo
* Update reference text for exception message
* Remove type annotations from tests
* Fix long docstring lines
* Add test with literal default
* initial implementation of deep validators for iterables and dictionaries
* initial implementation of is_callable validator
* add versionadded for deep validators
* add versionadded for is_callable validator
* add tests for is_callable validator
* tweak _DeepIterable repr
* add tests for deep_iterable
* add to _DeepDictionary an initial validation that the top-level value is in fact a dictionary
* add tests for deep_dictionary validator
* apply precommit hooks
* refactor deep_dictionary to deep_mapping with optional mapping validator
* move is_callable validator up in module to allow deep validators to use it
* complete conversion from "deep dictionary" to "deep mapping"
* add changelog.d entry for #425
* fix rst formatting and normalize to semantic newlines
* add "instance_of", "deep_iterable", and "deep_mapping" validators to docs/api.rst
* add "serve-docs" tox environment to preview rendered sphinx docs
* bump versionadded for is_callable and deep validators to 18.3.0
* linting cleanup
* Revert "add "serve-docs" tox environment to preview rendered sphinx docs"
This reverts commit a2df89b788fdc31b54e604095c166b6a37c56f19.
* fix error message broken in linting fix
This PR adds `python_requires` into `setup.py` to prevent `pip` from installing `attrs` in unsupported python versions.
I know that currently `attrs` supports a wide range of python versions but I think that it's always good to have some sanity check =)