attrs icon indicating copy to clipboard operation
attrs copied to clipboard

Python Classes Without Boilerplate

Results 166 attrs issues
Sort by recently updated
recently updated
newest added

attrs 20.1.0, Python 3.8.3. The asdict and astuple functions raise exceptions on instances with unset `init=False` attributes. I ran into this while looking into Tinche/cattrs#67, and was surprised to find...

Feature

Converters are one-arg functions, some one-arg functions yield type error ``` Unsupported converter, only named functions and types are currently supported ``` One of the things I love about attrs...

Feature

I was playing around with type annotations and Attrs, and I think I may have found an issue. Given the following Python 2/3 script: ```python from __future__ import absolute_import from...

Bug
Typing

### TLDR It would be very useful to extract the `__annotations__` handling logic currently in [`_transform_attrs`](https://github.com/python-attrs/attrs/blob/master/src/attr/_make.py#L296) into a standalone function that can be used to convert annotations into `_CountingAttr`s and...

Feature

Currently if I need to add a validator to check a condition that affects two attributes, I have to make it a validator of one of them. For example: ```python...

Feature

The `dataclasses` ecosystem is growing rapidly. Currently, it's not easy for attrs classes to benefit from the developments in the`dataclasses` ecosystem. It would be nice to fix this somehow. There...

Feature

With attrs 19.1.0/py 3.7.2, I have the following `attrbug.py`: ```python from typing import Optional from attr import validators import attr @attr.s class DoesntWorkWithMyPy: required_bool: bool = attr.ib( validator=validators.optional(validators.instance_of(bool)), default=False, )...

Bug
Typing

the `repr()` generated by `attrs` looks something like this by default: ``` MyClass(a=1, b=2) ``` this is fine in simple cases. however, when using `init=False`, and implementing my own `__init__()`,...

Feature

On some browser-python runtimes, `eval()` is either catastrophically slow (brython, skulpt) or completely unavailable (pyj(ama)s, batavia). Since attrs is The Library You Should Absolutely Use No Matter What™, it would...

Feature

Every now and then I stumble into wanting to have class variables that are part of everything (e.g. repr) except `__init__`. We can do: ```python @attr.s class C: x =...

Feature