Commit Graph

887 Commits

Author SHA1 Message Date
Hynek Schlawack d17326e49f Replace coverage with downloads
The codecov badge is misleading because it dips whenever a build is running.
2021-05-18 16:09:16 +02:00
Hynek Schlawack 8c9a79680f
Minor polish to #815
Signed-off-by: Hynek Schlawack <hs@ox.cx>
2021-05-18 11:29:29 +02:00
Hynek Schlawack 6731eea0ed
Run Python 3.10 under coverage (#818)
Since the matching code is Python 3.10-specific, we run it under coverage.
2021-05-18 11:28:21 +02:00
Karthikeyan Singaravelan 8613af97bb
Add __match_args__ to support match case destructuring in Python 3.10 (#815)
* Add support to generate __match_args__ for Python 3.10.

* Add versionadded directive.

* Update stubs.

* Update changelog and add a test to typing examples.

* Fix error regarding new-style classes in Python 2.

* Fix lint error regarding line length.

* Fix lint error regarding trailing whitespace.

* Add docstrings for interrogate.

* Use _has_own_attribute instead of cls.__dict__ contains check.

* Update docs as per review comments.

* Revert mistaken changelog update.

* Add Python 3.10 pattern matching syntax test cases.

* Update define signature with match_args.

* Fix conftest formatting.

* Fix isort formatting.

* Bump to Python 3.10 to parse syntax.

* Bump basepython of lint to Python 3.10 for parsing.

* Move lint to py310

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-05-18 07:02:06 +02:00
Hynek Schlawack 20c2d4fc0c
Optimize the case of on_setattr=validate & no validators (#817)
* Optimize the case of on_setattr=validate & no validators

This is important because define/mutable have on_setattr=setters.validate on
default.

Fixes #816

Signed-off-by: Hynek Schlawack <hs@ox.cx>

* Grammar
2021-05-17 09:24:46 +02:00
Hynek Schlawack 8ae2d6f1c3 Fix typo 2021-05-09 07:07:12 +02:00
Hynek Schlawack 932902c29f Start new cycle 2021-05-07 11:35:44 +02:00
Hynek Schlawack 83d3cd70f9 Prepare 21.2.0 2021-05-07 11:22:31 +02:00
Hynek Schlawack f83dabb15e That comma is not necessary 2021-05-07 11:19:55 +02:00
Hynek Schlawack 744a790756 Clarify yanking of 21.1 2021-05-07 11:13:13 +02:00
Hynek Schlawack 8076287aeb
Create 807.breaking.rst 2021-05-06 18:39:48 +02:00
Jan Gosmann 966c220e55
Declare Python 3.4 as incompatible (#807)
Python 3.4 testing has been dropped in #608, but it was not declared as
incompatible in setup.py because the code base was expected to still
work with Python 3.4 for a while. This compatibility finally broke with
the 21.1.0 release. At least one of the problematic commits is
e09b1d6423 introducing an import of
the typing module not available in Python 3.4.
2021-05-06 18:37:57 +02:00
Hynek Schlawack f10d050864
Revert recursive evolve (#806)
* Revert "Recursively evolve nested attrs classes (#759)"

* Add regression test

* lol legacy python

* Add newsfragment

* Add a test to prevent inst -> dict replacement breaking
2021-05-06 15:26:27 +02:00
Hynek Schlawack 24a2c1e7a5 Start new cycle 2021-05-06 10:28:10 +02:00
Hynek Schlawack b22195ee65 Prepare 21.1.0 2021-05-06 10:20:53 +02:00
Hynek Schlawack c5ae43f7f2 Pin towncrier
Currently the title is either not rendered at all, or rendered twice

cf.

- https://github.com/twisted/towncrier/issues/346
- https://github.com/twisted/towncrier/issues/340
2021-05-06 10:16:57 +02:00
Hynek Schlawack 503164f570 Fix changelog template for towncrier 21.3.0
See https://github.com/twisted/towncrier/issues/340
2021-05-06 10:08:29 +02:00
Hynek Schlawack fbed0320a6 Revert last change, the string is consistent w/ total_ordering
This reverts commit 2f395f1a27.
2021-05-06 09:03:24 +02:00
Hynek Schlawack 2f395f1a27 Make docstring consistent with the rest 2021-05-05 20:21:50 +02:00
Hynek Schlawack f41db43541 Unpin pyright & minor docs polish
ref #796
2021-05-05 16:06:09 +02:00
Hynek Schlawack 16f7a0df07 Make #796 newsfragment more timeless 2021-05-05 15:52:11 +02:00
Hynek Schlawack eb2df7f622 Add announcement about `import attrs` 2021-05-05 12:11:37 +02:00
Hynek Schlawack c6f6bb3682 Revert "Pin 3.10 to last alpha (#802)"
This reverts commit b69cfc3111.

pytest has fixed it on their side.
2021-05-05 10:50:02 +02:00
Alex Ford 7e372c56a2
Implement pyright support via dataclass_transforms (#796)
* Add __dataclass_transform__ decorator.

* Add doc notes for pyright dataclass_transform support.

* Fix docs build error.

* Expand docs on dataclass_transform

* Add changelog

* Fix docs build

* Fix lint

* Add note on __dataclass_transform__ in .pyi

* Add baseline test of pyright support via tox

* Add pyright tests to tox run configuration

* Fix test errors, enable in tox.

* Fixup lint

* Move pyright to py39

* Add test docstring.

* Fixup docs.

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-05-05 10:24:53 +02:00
Hynek Schlawack fc0d60e370 Simplify import 2021-05-05 10:15:26 +02:00
Hynek Schlawack 01aa333005
Remove warning if eq is customized & order is not (#800)
Since this warning is raised from the attr.ib/attr.field call, we cannot verify
whether order is on at all for the whole class. Fixing this would require to
check _after_ the class is assembled which is both additional complexity as
well as performance overhead. Unless we get inundated by bug reports, this
doesn't seem worth it.
2021-05-05 10:02:31 +02:00
Hynek Schlawack 743f973889
Add narrative docs for #787 (#801) 2021-05-04 17:41:14 +02:00
Hynek Schlawack b69cfc3111
Pin 3.10 to last alpha (#802)
* Pin 3.10 to last alpha

Apparently, a last-minute change made it into 3.10.beta1 that broke pytest.

* Fix version syntax
2021-05-04 17:09:30 +02:00
Hynek Schlawack 936853283e Add newsfragment for #787 2021-05-01 14:32:22 +02:00
Hynek Schlawack da6fb00a7b Remove redundant newsfragment
It used the wrong PR# and because I couldn't find it, I wrote my own in 710.
2021-05-01 14:29:39 +02:00
Antonio Botelho 71b4638b32
New attr.cmp_using helper function (#787)
* New attr.cmp_using helper function

* Updated cmp_using to use new_class instead of direct patching

* Removed stray annotation that make tests fail in PY2

* Skip test if PY2 because it won't raise TypeError when a method returns NotImplemented

* Skip test if PY2 because it won't raise TypeError when a method returns NotImplemented

* Fixed PY2 tests related to total_ordering

* Added tests to complete converage

* Moved class_name argument to definition and made it non-optional

* Fixed typo in variable name

* Revert accidental black formatting of __init__.pyi in commit 2b7970bf

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-05-01 14:21:37 +02:00
Hynek Schlawack 253f2292e0
Try 3.10 again (#798) 2021-05-01 13:59:34 +02:00
Albert Zeyer 0102cb6516
fix typo (#797) 2021-04-28 08:32:18 +02:00
0xflotus f96494f462
fix: small error in docs (#794) 2021-04-23 18:04:35 +02:00
Hynek Schlawack 6eedf68d7d Add the only testimonial that matters 2021-04-21 12:08:04 +02:00
Hynek Schlawack a8bf109b63 Add Ko-fi 2021-04-21 11:57:45 +02:00
John Belmonte d0cff8face
docs: more explicit about Factory caveats (#791)
The intent is to avoid catching readers off guard from the contradiction between "assigning Factory will work as expected" and the subsequent warning.
2021-04-14 12:54:15 +02:00
Hynek Schlawack 685f865d50
Stress that attr.ib is always needed for decorators
Signed-off-by: Hynek Schlawack <hs@ox.cx>
2021-04-12 15:09:21 +02:00
Hynek Schlawack f47e568c9e
Make NG APIs official (#786) 2021-04-09 20:36:10 +02:00
Hynek Schlawack 6d1d5e9055 Disable 3.10 until it stops breaking 2021-04-06 07:28:23 +02:00
Hynek Schlawack 066d1ca7df Add narrative docs for #731
Signed-off-by: Hynek Schlawack <hs@ox.cx>
2021-04-06 07:27:11 +02:00
Eric Traut 7a75e4d1fa
Added missing type argument for `Attribute` class when used in type stubs. With this change, all exported symbols from the library have well-defined and fully-known types (a "type completeness score" of 100% according to pyright). (#785)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-04-04 10:19:57 +02:00
Diego Argueta 51e6dcfb8e
Narrower typing on Factory called with takes_self (#780)
* Narrower typing on Factory called with takes_self

* Make Literal annotation depend on Python version

* Fix linting error

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-03-24 09:04:19 +01:00
Hynek Schlawack 150c7c3723
Don't cancel all builds if one fails (#783)
* Don't cancel all builds if one fails

* Try disabling fast failing

continue-on-error will show failed builds as green

* fix yaml fail
2021-03-22 08:04:17 +01:00
Hynek Schlawack e01ddbe307
Detect ClassVars coming from typing_extensions (#782)
* Detect ClassVars coming from typing_extensions

* Add newsfragment
2021-03-20 18:02:59 +01:00
Thomas Grainger 0a6f8075eb
add sphinx-notfound-page (#777)
Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-03-10 07:57:26 +01:00
John Belmonte 3147e84603
docs: fix double negative (#776)
* docs: fix double negative

(this would also be valid: "... and will create neither `__eq__` nor `__ne__`")

E.g. (from https://grammar.yourdictionary.com/grammar-rules-and-tips/double-negative-trouble.html):
> > Neither fish nor chicken weren't at the party.
>
> This sentence contains a double negative because "neither" and "weren't" are both negatives. "Neither fish nor chicken were at the party" would be fine, as would "Fish and chicken weren't at the party.

* invert polarity
2021-03-09 11:12:33 +01:00
David Euresti ce8bb4ffa9
Add attribs to resolve_types and fix test_hooks (#774) 2021-03-05 16:01:04 -08:00
Hynek Schlawack ad59a62cae Add changelog to project URLs 2021-03-04 10:27:54 +01:00
Hynek Schlawack ded92256e2 Small addendums to #773 2021-02-28 13:39:34 +01:00