attrs
attrs copied to clipboard
Python Classes Without Boilerplate
Hi, I'm surprised that this `attrs` code doesn't work: ```python #!/usr/bin/env python3 from abc import ABC from attrs import define, field @define(slots=False, auto_attribs=True, auto_detect=True) class A(ABC): field_1: int = 42...
This is a copy of the fourth issue collected in https://github.com/python-attrs/attrs/issues/1206 to enable separate tracking of the bug. ### The issue For `deep_iterable`, only the `iterable_validator` is optional, which makes...
This is a copy of the third issue collected in https://github.com/python-attrs/attrs/issues/1206 to enable separate tracking of the bug. ### The issue When a validation error in one of the inner...
This is a copy of the second issue collected in https://github.com/python-attrs/attrs/issues/1206 to enable separate tracking of the bug. ### The issue Consider the following piece of code: ```python @define class...
This is a copy of the first issue collected in #1206 to enable separate tracking of the bug. ### The issue Some of the inner validators accept lists while others...
dataclass in python 3.10 and above got KW_ONLY sentinel value it allows you to mark where the constructor will start the KWARGS in the class [https://docs.python.org/3/library/dataclasses.html#dataclasses.KW_ONLY](https://docs.python.org/3/library/dataclasses.html#dataclasses.KW_ONLY) i did not found...
The following code raises SyntaxError ```python from attrs import define, field @define class A: a: int = field(kw_only=True, default=3) def __attrs_pre_init__(self, _): pass ``` ```python Traceback (most recent call last):...
When trying to define an enum of an `@attrs.define` class, Mypy gives typing errors, but it works in runtime. When trying to define an enum of an `@attrs.frozen` class, Mypy...
Add a `resolve_types: bool = ?` argument to `attrs.define()` and call `resolve_types()` on the new class if `True` is passed. *Why?* According to the Typed Settings issue tracker, people seem...
Fixes: #1271 # Summary `make_class()` populates the `__annotations__` dict of the generated class, so that `resolve_types()` can resolve the types of the generated class. # Pull Request Check List -...