* Switch to build-and-inspect-python-package
Use the occasion to factor out PyPy jobs which simplifies everthing.
* Only install pytest-codspeed when benchmarking
* No need to build twice on PRs
* No coverage on PyPy
* Still require PyPy to pass
* Actually remove codspeed from tests
* Separate glacial CodSpeed into own workflow
Might switch to on-demand/cron if we don't find a way for it to run
under 5 minutes.
* Get rid of version override
* Add missing needs
* Test should pass without src
* oops
* Make PyPy wheel-only, too
* Clarify
* Explain how the matrix works since everybody steals my stuff
* Implement attrs.validators.or_ validator
* Add tests/test_validators.py::TestOr test cases
* Add test for _OrValidator.__repr__ method
* Add description of attrs.validators.or_ to docs/api.rst
* Add changelog entry
* Swap double quotes for single because doctests don't like it
* Rename changelog fragment pointing to incorrect number
* Silence ruff linter warnings
Although good warning in general, in this particular code, they
do not fit here.
* BLE001 Do not catch blind exception: `Exception`
`validators` usually raise `ValueError` upon their violation.
However, it's not the only `Exception` they can raise - cf.
`attrs.validators.not_` - therefore, it is desirable to catch
them all!
* PERF203 `try`-`except` within a loop incurs performance overhead
Fair point, but the loop is written in a way to short-circuit,
ie. it will finish when a first validator is satisfied.
* S112 `try`-`except`-`continue` detected, consider logging the exception
Not applicable here, we care only if **all** validators raise
an exception, which is already accomodated for after the `for`
loop.
* Apply suggestions from code review
Co-authored-by: Hynek Schlawack <hs@ox.cx>
* Rework example of or_ validator in api/docs.rst
* Update docs/api.rst
---------
Co-authored-by: Hynek Schlawack <hs@ox.cx>
Co-authored-by: Libor <libas.martinek@protonmail.com>
Only loop once on "cached_properties" when building slotted classes
Previously the cached_properties dict was read three times.
Co-authored-by: Hynek Schlawack <hs@ox.cx>
* Preserve AttributeError in slotted classes with cached_property
In slotted classes' generated __getattr__(), we try __getattribute__()
before __getattr__(), if available, and eventually let AttributeError
propagate. This matches better with the behaviour described in Python's
documentation "Customizing attribute access":
https://docs.python.org/3/reference/datamodel.html#customizing-attribute-access
Fix https://github.com/python-attrs/attrs/issues/1230
* Update changelog.d/1253.change.md
---------
Co-authored-by: Hynek Schlawack <hs@ox.cx>