* Implement first class exception support
Fixes#368
* Ensure single-attrib classes work too
cf https://github.com/python-attrs/attrs/pull/500#pullrequestreview-201913569
* Call into BaseException to initialiaze self.args
* Leave __str__ alone since we upcall
Based on Python pizza hallway feedback by @ambv.
* remove stray stage
* nope
* 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
* Add weakref parameter to attr.s()
#325
* Add weakref to simple_classes() strategy
* Rename changelog file with actual PR (420.change.rst)
* Add test_weakref_does_not_add_a_field()
* Add docstrings to new weakref tests
* Add missing blank line
* Correct weakref handling of __weakref__ attributes or an inherrited slot
* Correct typos and terms
* Rename to weakref_slot
* Parametrize more tests against weakref_slot True/False to expose trouble
* Check if __weakref__ has been inherited via a __dict__
* Correct copy/pasted comment
* Change weakref_slot default to True
* Tidy and correct weakref -> weakref_slot
* First stab at implementing hashcode caching (#423)
Currently all existing tests pass but no cache_hash tests have yet
been added.
* Existing hash tests now pass on cache_hash classes
* Add towncrier change log
* Add documentation for cache_hash
* Fixes bug with check that init=True if cache_hash=True
* Fix long lines
* Fix documentation issues
* Add test for cache_hash requiring init
* Improve test coverage
* Remove now unnecessary 'pass'
* Add periods to the end of exception strings
* Add test docstrings for cache_hash tests
* Clarify documentation of cache_hash
* Recommend that hashable classes be frozen
* Fix test references for exception messages
* Added support for keyword-only attributes. Closes#106, and closes#38
(Rebases #281)
Co-authored-by: Alex Ford <fordas@uw.edu>
* Add `attr.s`-level `kw_only` flag.
Add `kw_only` flag to `attr.s` decorator, indicating that all class
attributes should be keyword-only in __init__.
Minor updates to internal interface of `Attribute` to support
evolution of attributes to `kw_only` in class factory.
Expand examples with `attr.s` level kw_only.
* Add `kw_only` to type stubs.
* Update changelog for rebased PR.
Hear ye, hear ye. A duplicate PR is born.
* Tidy docs from review.
* Tidy code from review.
* Add explicit tests of PY2 kw_only SyntaxError behavior.
* Add `PythonToOldError`, raise for kw_only on PY2.
* `Attribute._evolve` to `Attribute._assoc`.
* Add narrative chapter on initialization
* Be more explicit about defining validators both ways
* Stress that the name of default/validator != attr name
* Mention nested schemas
* Explain handling of private attributes
* Add another consequence of _ stripping
* Stress that nothing should overwrite attributes on class body
* Better wording
* typo
* Dedup examples
* Address review feedback
* Add newsfragments
* Stop setting attributes on class bodies
This behavior has been deprecated since 16.1 and can now be removed in
accordance with our backward-compatibility policy.
* We don't need iterkeys anymore
* Add support for passing a type to attr.ib() and gathering the type from PEP526-style annotations.
* Address review notes.
* More review notes.
* A few more review changes.
* Quick final fix to the changelog.
The changelog deprecation error explains it best. It's to avoid
confusing errors if some attribute hasn't been initialized for whatever
reason (usually `init=False` + typo).