Commit Graph

270 Commits

Author SHA1 Message Date
Nick Timkovich f870beb84a
Add a not_ validator (#1010) 2022-09-04 13:55:02 +02:00
layday f7fa5a810c
Fix type errors in Pyright (#999) 2022-08-30 15:06:10 +02:00
Kevin M Granger c860e9dd25
Use enum for typing NOTHING (#983)
* Use enum for typing NOTHING.

This will allow those extending attrs
to type NOTHING as Literal[NOTHING].

* Make test_dunders test `NOTHING` directly

* Reflect NOTHING enum typing in __init__.pyi

* Fix docs for NOTHING

* Add changelog entry

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: Hynek Schlawack <hs@ox.cx>
Co-authored-by: Tin Tvrtković <tinchester@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-08-27 17:41:56 +02:00
Hynek Schlawack fab5a9289d
Deprecate Python 3.6 (#1017)
* Rename CI workflow to a more meaningful name

* News fragment
2022-08-22 16:43:28 +02:00
Hynek Schlawack cd35505960
Fix typo 2022-08-22 16:39:08 +02:00
Hynek Schlawack 19f41dda6f
Add news fragement for #1009 2022-08-18 09:01:32 +02:00
Hynek Schlawack 70b7f885f4
Add newsfragment for #997 2022-08-16 07:26:50 +02:00
Hynek Schlawack c58ffd4e4c
Call abc.update_abstractmethods on 3.10+ (#1001) 2022-08-11 11:33:34 +00:00
Hynek Schlawack 351637400a
Polish newsfragments 2022-08-10 15:03:57 +02:00
Hynek Schlawack 4a281b04b4
Add warning re #993 2022-08-10 14:32:00 +02:00
Hynek Schlawack 6151683244
Eliminate most str.format() and %-formatting (#995)
* Eliminate most str.format() and %-formatting

* Add newsfragment
2022-08-10 12:41:46 +02:00
davfsa a8191556c0
Speedup `_setattr` usage and fix slight performance regressions (#991)
* Speedup `_setattr` usage and fix performance regressions

* Add changelog file

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2022-08-07 07:52:28 +00:00
Hynek Schlawack 983c2c4293
Re-import AttrsInstance in attrs ns (#994) 2022-08-07 02:13:02 +02:00
Hynek Schlawack 08f8319efe
Drop Python 3.5 (#988)
* 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
2022-08-05 09:48:00 +02:00
Hynek Schlawack b3dfebe2e1 Prepare 22.1.0 2022-07-28 15:03:02 +02:00
Hynek Schlawack bcef030781 Add newsfragment for #969 2022-07-27 16:37:26 +02:00
Hynek Schlawack 4e6ec65460 Polish changelog entries 2022-07-27 16:14:35 +02:00
Hynek Schlawack a7e82b5c41 Polish docs around #951 2022-06-13 08:33:23 +02:00
iron3oxide 2257a0c60c
Complete error signature of _InValidator (#951)
The docstring of _in() says the ValueError would contain these, however
it didn't. Adding said arguments enables uniform processing of
ValueErrors raised by validators. One might for example want to extract
the attr.name and the value that raised the error to show a custom, more
user-friendly error message.
2022-06-13 07:57:47 +02:00
Hynek Schlawack 738ee63903
Add missing cmp_using to stub files (#949)
* Add missing cmp_using to stub files

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

* Add newsfragment
2022-04-07 07:29:24 +02:00
Hynek Schlawack 0f08b84f3f Unpin towncrier & update template 2022-04-07 07:25:20 +02:00
Hynek Schlawack 155b58418c Add missing newsfragment for #931 2022-04-07 07:13:49 +02:00
Hynek Schlawack c422bf8041
Drop the deprecated Attribute.cmp (#939)
* Drop the deprecated Attribute.cmp

This has nothing to do with the cmp argument to attr.s/define which have been
undeprecated.

* Add newsfragment

* Add test for attr.ib(cmp=)
2022-03-21 10:29:58 +01:00
Hynek Schlawack 980c8b04f5
Drop Python 2.7 (#936)
* Drop Python 2.7

The tooling situation around Python 2 has deteriorate to such a degree that
upholding compatibility is not tenable anymore for a volunteer-run project.

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

* Add newsfragment

* Run Python 3.5 under coverage to make up for Python 2.7

* Wait for py35 in parallel

* Remove fullmatch kludge

* Remove Python 2-specific code

* Revert empty slot test

Also disable pyupgrade on that file.

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

* We DO run under 3.5

* Remove __qualname__ workarounds

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update changelog.d/936.breaking.rst

Co-authored-by: Tin Tvrtković <tinchester@gmail.com>

* Compare methods using is

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tin Tvrtković <tinchester@gmail.com>
2022-03-21 08:47:47 +01:00
Vedant Puri d0c73d8faa
Allow `deep_iterable` member validator to accept a list of validators (#925)
* Add Multiple Validators to deep iterable

* Add Tests + Fix some doc strings

* Update typing

* Limit this PR to only accepting a list of member validators

* Respond to PR comments

* Commit missing file

* Apply suggestions from code review

Co-authored-by: Hynek Schlawack <hs@ox.cx>

* Split other test too

* Fix CI + Remove Weird parens

* Use and_ instead of And_

* Add tuple to list of tests

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2022-03-20 09:48:55 +01:00
NI1993 7804a68ee3
Added attrs.validators.min_len() (#916)
* Added attrs.validators.min_len()

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Rename foo.change.rst to 916.change.rst

* Update src/attr/validators.py

Co-authored-by: nativ <nativi@spotnix.io>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Hynek Schlawack <hs@ox.cx>
2022-02-02 09:10:33 +00:00
Ray Zhang 947bfb5421
Fix hashing for custom `eq` objects (#909)
* Add hashing for eq'd objects

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add coverage to test

* oops

* Add changelog message

* Revert "Add changelog message"

This reverts commit 0bd3f5cba6.

* Address comments

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Hynek Schlawack <hs@ox.cx>
2022-01-31 05:57:33 +01:00
davfsa 3df7bbe089
Speedup uses of `object.__setattr__` (#898)
* Speedup uses of `object.__setattr__`

* Add changelog fragment
2022-01-03 13:39:41 +00:00
Hynek Schlawack 2de9014310 Prepare 21.4.0 2021-12-29 14:09:28 +01:00
Hynek Schlawack 1ff3f1ee91 Minor changelog polish 2021-12-29 14:04:39 +01:00
Hynek Schlawack 0575d51ffd
Make virtual repr file names unique (#896)
* Make virtual repr file names unique

* Add newsfragments
2021-12-29 14:02:59 +01:00
Michał Górny 03dd7136cf
Do not require cloudpickle for PyPy (#892)
* Do not require cloudpickle for PyPy

The cloudpickle package relies on CPython implementation details,
and does not even import on PyPy:

```
ImportError while importing test module '/tmp/attrs/tests/test_3rd_party.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/pypy3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_3rd_party.py:7: in <module>
    import cloudpickle
.tox/pypy3/lib/pypy3.8/site-packages/cloudpickle/__init__.py:4: in <module>
    from cloudpickle.cloudpickle import *  # noqa
.tox/pypy3/lib/pypy3.8/site-packages/cloudpickle/cloudpickle.py:57: in <module>
    from .compat import pickle
.tox/pypy3/lib/pypy3.8/site-packages/cloudpickle/compat.py:13: in <module>
    from _pickle import Pickler  # noqa: F401
E   ModuleNotFoundError: No module named '_pickle'
```

Disable the dependency for PyPy and make the test handle missing
cloudpickle gracefully.

* Enable testing on pypy-3.8

* add a news entry

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-12-29 09:43:19 +01:00
Hynek Schlawack dd26edd68e Prepare 21.3.0 2021-12-28 06:59:45 +01:00
Hynek Schlawack fcfb5a692c Last pass over changelogs 2021-12-28 06:39:24 +01:00
Hynek Schlawack e7345584ff
Add attrs namespace (#887) 2021-12-25 15:15:10 +01:00
Hynek Schlawack 7b02220bd3
Serialize keys as tuples in asdict (#888)
* Add tuple_keys to asdict

See #646

* Add typing example

* Add newsfragments

* Add missing test

* Switch it on by default

* Let's not make buggy behavior configurable
2021-12-16 09:01:51 +01:00
Hynek Schlawack 679e4b443d
NG: convert on setattr by default (#886)
* 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
2021-12-14 15:50:37 +01:00
wouter bolsterlee 1759260aa0
Add support for re.Pattern to validators.matches_re() (#877)
Fixes #875.

This adds support for pre-compiled regular expressions to
attr.validators.matches_re(). This cannot be combined with flags since
the pre-compiled pattern already has those.

Detailed changes:

- attr.validators.matches_re() now accepts re.Pattern in addition to
  strings; update type annotations accordingly.
- Convert percent-formatting into str.format() for an error message
- Simplify (private) _MatchesReValidator helper class a bit: use the
  actual compiled pattern, and drop the unused .flags attribute.
- Simplify control flow a bit; add pointer about fullmatch emulation.
- Add tests
- Tweak existing test to ensure that .fullmatch() actually works
  correctly by matching a pattern that also matches (but not
  ‘full-matches’) a shorter substring.

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-11-30 06:32:24 +01:00
Stefan Scherfke c6143d518b
Add "no_run_validators()" context manager (#859)
* Add "no_run_validators()" context manager

* Move functions to validators module

* Update changelog entry

* Add a few docstring improvements and fixes

* Update tests/test_validators.py

* Minor polish

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

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-11-17 07:05:01 +01:00
Hynek Schlawack d884af5e6d
Rename 847.change.rst to 857.change.rst 2021-11-04 06:57:07 +01:00
Hynek Schlawack 11c66eff32
Update 847.change.rst 2021-11-04 06:53:23 +01:00
paul fisher 554d6f293d
Pull thread-local into _compat module to fix cloudpickling. (#857)
Because cloudpickle tries to pickle a function's globals, when it
pickled an attrs instance, it would try to pickle the `__repr__` method
and its globals, which included a `threading.local`. This broke
cloudpickle for all attrs classes unless they explicitly specified
`repr=False`. Modules, however, are pickled by reference, not by value,
so moving the repr into a different module means we can put `_compat`
into the function's globals and not worry about direct references.
Includes a test to ensure that attrs and cloudpickle remain compatible.

Also adds an explanation of the reason we even *have* that global
thread-local variable.  It wasn't completely obvious to a reader why
the thread-local was needed to track reference cycles in `__repr__`
calls, and the test did not previously contain a cycle that touched
a non-attrs value. This change adds a comment explaining the need
and tests a cycle that contains non-attrs values.

Fixes:
- https://github.com/python-attrs/attrs/issues/458
- https://github.com/cloudpipe/cloudpickle/issues/320
2021-11-04 06:52:10 +01:00
paul fisher 9eccd70571
Fix #824's changelog entry filename. (#860) 2021-11-03 18:44:44 +01:00
Hynek Schlawack e1d156239f
Fix rst 2021-10-28 07:16:37 +02:00
Stefan Scherfke 52fcad29bb
Add additonal validators (#845)
* Add additonal validators

* Python 2 \o/

* Add changelog entry

* Add "versionadded" tags

* More python 2

* Add doctests and rename maxlen to max_len

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-09-24 12:47:19 +02:00
Stefan Scherfke f57b6a6759
Convert transformed attrs to AttrsClass (#824)
* Convert transformed attrs to AttrsClass

Fixes: #821

* Add cangelog entry

* Only call AttrsClass once

* Calm mypy by inline the AttrsClass call

* Defer AttrsClass creation as long as possible

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-09-22 21:58:32 +02:00
David Euresti f31bb2850a
Fix bug in resolve_types with subclasses (#843)
* Fix bug in resolve_types with subclasses

* lint

* changelog

* lint again, like we did last summer

* Moar coverage

* lint ... why

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-09-19 21:04:55 +02:00
Hynek Schlawack fcb7393f53 Add changelog for #830, fix filenames 2021-08-10 07:48:50 +02:00
Tin Tvrtković 38580632ce
Rework linecache handling (#828)
* Rework linecache handling

* lint

* Add changelog
2021-06-30 08:28:56 +02:00
Tin Tvrtković 9709dd82e1
Initial implementation of a faster repr (#819)
* Initial implementation of a faster repr

* Switch to positional args for _make_repr

* Fix tests and changelog

* Remove trailing comma for Py2

* Fix lint

* __qualname__ is always present if f-strings work

* Fix Py2 qualname

* Revert "Fix Py2 qualname"

This reverts commit eb091a31d2.

* Update src/attr/_make.py

Co-authored-by: Hynek Schlawack <hs@ox.cx>

* Update changelog.d/819.changes.rst

Co-authored-by: Hynek Schlawack <hs@ox.cx>

* Update src/attr/_make.py

Co-authored-by: Hynek Schlawack <hs@ox.cx>

* Update src/attr/_make.py

Co-authored-by: Hynek Schlawack <hs@ox.cx>

* Update src/attr/_make.py

Co-authored-by: Hynek Schlawack <hs@ox.cx>

* Update src/attr/_make.py

Co-authored-by: Hynek Schlawack <hs@ox.cx>

* Update src/attr/_make.py

Co-authored-by: Hynek Schlawack <hs@ox.cx>

* Fix syntax

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-05-26 21:57:52 +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
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 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
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 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 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
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 743f973889
Add narrative docs for #787 (#801) 2021-05-04 17:41:14 +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
Hynek Schlawack f47e568c9e
Make NG APIs official (#786) 2021-04-09 20:36:10 +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
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
David Euresti ce8bb4ffa9
Add attribs to resolve_types and fix test_hooks (#774) 2021-03-05 16:01:04 -08:00
Hynek Schlawack af3045b0ca Eat some cmp crow 2021-02-28 13:23:51 +01:00
Antonio Botelho f580185cc4
Undeprecate cmp (#773)
* Document comparison

* Grammar

* Stress independence of eq/order

* Add example for eq

* Be consistent with fields

* Undeprecated cmp

* Update doc to remove cmp deprecation

* Reintroduced deprecation warning on Attribute cmp property

* Added changelog file

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-02-28 13:20:40 +01:00
Hynek Schlawack 2903da4b5b Add missing newsfragment 2021-02-22 12:58:30 +01:00
Hynek Schlawack 44ac461146 Polish up #627 2021-02-22 08:59:09 +01:00
Antonio Botelho aefdb117fa
Allow user to customize how an attribute is compared (#435) (#627)
* Updated implementation of comparison behaviour customization.

* Fixed version of next release, updates newsfragment and documentation.

* Fixed documentation.

* Fixed documentation.

* Fixed comments and changelog.

* Fix doctest error

* Update src/attr/_make.py

Co-authored-by: Hynek Schlawack <hs@ox.cx>

* Pass eq_key and order_key explicitly in _CountingAttr

* Merged with master and resolved conflics after introduction of _make_method

Co-authored-by: Antonio Botelho <antonio@inhames.com>
Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-02-22 08:48:34 +01:00
Stefan Scherfke fe6eb31200
Recursively evolve nested attrs classes (#759)
* Recursively evolve nested attrs classes

Fixes: #634

* Apply suggestions from code review

Co-authored-by: Hynek Schlawack <hs@ox.cx>

* Update tests for recursive evolve()

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-02-19 07:01:09 +01:00
Hynek Schlawack c2712fd102 Add forgotten Attribute.evolve to stub
Fixes #752
2021-01-29 11:09:02 +01:00
Venky Iyer efcbae51cd
__attrs_pre_init__ (#750)
* add pre-init following post-init pattern

* add tests

* add changelog

* some typos
2021-01-25 07:31:37 +01:00
Venky Iyer 654aa92475
__attrs_init__() (#731) 2021-01-23 13:03:04 +01:00
Hynek Schlawack a025629e36 Minor word smithing 2021-01-11 07:46:30 +01:00
Vitaliy Yelnik 9de675f4b4
Fix: TypeError when using properties, super(), and slots=True (#652) (#747) 2021-01-11 07:44:16 +01:00
Hynek Schlawack aa3842f264 Add newsfragment for #710 2021-01-04 13:23:58 +01:00
Hynek Schlawack f132c07e55
Make NOTHING falsey (#732)
* Make NOTHING falsey

Fixes #720

* Add newsfragment

* Python 2
2020-12-21 06:39:58 +01:00
Hynek Schlawack 1c81e3ef7e Minor wordsmithing 2020-12-13 17:24:25 +01:00
Andrei Bodrov 1f627dd3d5
Fixed slots inheritance (#718)
* Fixed slots inheritance

* Added changelog

* Added a separate test

* Restored backwards-compatibility and added a test for it

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2020-12-13 17:22:34 +01:00
Nicholas Coltharp e09b1d6423
Infer type annotations from converters (#710)
* Infer annotations from converters

* Use semantic newlines

* Add 787.change.rst

* Don't let type annotations override converters

* Make pipe() infer type annotations

* Use PY2 instead of sys.versioninfo >= (3, 3)

* Avert crashing with a nullary converter

* Small doc change

* Add type inference for optional()

* Make pipe() annotations actually work

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2020-12-13 16:30:06 +01:00
Hynek Schlawack f3762ba07b Prepare 20.3.0 2020-11-05 11:00:48 +01:00
Hynek Schlawack d23924f765 Add provisional notice 2020-11-05 10:02:41 +01:00
Hynek Schlawack f2dabeae82
Fix exception chaining on PyPy (#712)
* Fix exception chaining on PyPy

Fixes #703

* Add newsfragment

* Blankly exclude PyPy from coverage reporting

* Manually add default no cover marker
2020-11-04 11:02:15 +01:00
Hynek Schlawack 56c73081c5 Add missing collect_by_mro to typing stubs
Fixes #711
2020-11-03 10:10:43 +01:00
Andrei Bodrov bc527b9f29
[RFC] kw_only python 2 backport (#700)
* Added kw_only support for py2

* Docs update

* Added changelog

* Better exception message, moved code to function

* Moved py2-only functions under if PY2:

* Tested fancy error message for unexpected kw-only argument

* Tested fancy error message for unexpected kw-only argument

* Fixed line length

* Added versionchanged

* Updated docs

* Moved functions back under if PY2 - seems codecov doesn't like them in module scope

* Blacked

* Fixed changelog.d

* Removed redundant brackets in test

* Added assertion to the _unpack_kw_only_lines_py2 - hope it will increase code coverage

* List comprehension -> for loop

* lines.extend? I do not like for-loops

* Fix code

* Fixed style/added comment

* Fixed docs (removed python2 mention)

* Fix lint

* Better docstring

* Rewritten docstring and added example code

* Added quotes

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2020-10-19 11:00:00 +02:00
Hynek Schlawack 0e6c74ac17
Treat frozensets like sets in asdict/astuple (#704)
* Treat frozensets like sets in asdict/astuple

Fixes #657

* Add newsfragment
2020-10-19 10:17:25 +02:00
Stefan Scherfke 0eae613ce1
Add hooks for field transformation and for asdict serialization (#653) 2020-10-15 09:33:59 +02:00
Hynek Schlawack 4f74fbaca3 Prepare 20.2.0 2020-09-05 12:19:07 +02:00
Hynek Schlawack 74605de4cd Elaborate more on #684 2020-09-05 11:36:09 +02:00
Hynek Schlawack ea04c15d7f Drop superfluous word 2020-09-05 11:24:37 +02:00
Hynek Schlawack 060d1efbdd Add newsfragment on state of NG APIs 2020-09-05 11:23:35 +02:00
Hynek Schlawack c45472286a Fix typo 2020-09-05 11:15:26 +02:00
Hynek Schlawack 504eefe91f
NG: make frozen classes comfortably subclassable (#687)
* NG: make frozen classes comfortably subclassable

* Add newsfragment

* This ain't markdown

* Address review
2020-09-05 11:14:54 +02:00