* Drop Python 3.5
Less than 0.5% of our downloads are 3.5 and it allows us to simplify A LOT of code.
Fixes#965
Signed-off-by: Hynek Schlawack <hs@ox.cx>
* Run 3.6 under coverage
* Add newsfragment
* Probably don't need 3.7 for coverage
* Everything is ordered!
* pre-commit autoupdate, add yesqa
* NG: convert on setattr by default
Not doing that from the get-go was an oversight.
Fixes#835
* Add optimization for default on_setattr w/ no work to do
Otherwise we'd end up with an explicit setattr every time.
* Fix optimization for NG default & j/ convert
* NG is actually 3.6+
* Add test for convert optimization for good measure
* Clarify next-gen auto_attribs inference rules
The next-gen auto_attribs api documentation does not clearly describe
cases where (a) only a subset of attributes are annotated and (b)
`field` definitions are provided for a subset of fields. Update
docstring to reflect current, desirable, behavior.
Add tests to clarify `.define` behavior focused on fully-annotated
classes with partially-defined fields, which is commonly used to add
non-default behavior to a subset of a classes fields. For example:
```python
@attr.define
class NewSchool:
x: int
y: list = attr.field()
@y.validator
def _validate_y(self, attribute, value):
if value < 0:
raise ValueError("y must be positive")
```
The previous docstring *could* be read to imply that:
* The new-school API will not infer auto_attribs if there are any
unannotated attributes.
* The new-school API will not infer auto_attribs if *any* attr.ib are
defined, even if those attr.ibs are type annotated.
* Update test to match PR example
* Fix lint error
Co-authored-by: Hynek Schlawack <hs@ox.cx>
* Add attr.auto/mutable/frozen
Prepare for import attrs y'all!
Signed-off-by: Hynek Schlawack <hs@ox.cx>
* Try combining coverage using 3.8, always
* Add tests for overriding of auto_attribs
* Clarifications
* Add newsfragment
* s/auto/define
This is going be the next-gen name anyways, so no need to introduce new names.
Signed-off-by: Hynek Schlawack <hs@ox.cx>
* Missed two
* Add type stubs
* Beg for patience
* Explain second setup-python action
* fix comment