attrs
attrs copied to clipboard
Python Classes Without Boilerplate
Hello, I'm not sure how to explain this properly but I'll do my best. Imagine a project with the following layout: ``` test ├── __init__.py ├── py.typed ├── test.py └──...
In #python today someone wanted to find out if their class was frozen. `Cls.__dataclass_params__` keeps the `@dataclasses.dataclass()` arguments. ```py _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=True) ``` Is there a way to get that data in...
It's possible to type a method that wraps an attr.ib attribute? Example: ```python import attr from typing import Any def typed() -> Any: return attr.ib(type=str) @attr.s class TestingParams: foo =...
It has come up a couple times recently that I wanted to automatically build an instance of an attrs class. The latest is to just fill it with `True` and...
Not sure if this is a mypy issue or attrs or both. I have an attrs class that defines a field with a converter that coerces the input value to...
Currently, validators are required to raise an exception, if the value isn't appropriate. If I currently have a function for checking the property, but returns a boolean, instead of raising,...
Hey there! This is more of a question than an issue :-) Some of the classes that I'm trying to migrate to attrs have attributes that are expensive to compute....
I have been trying to use `attr.make_class` to create a class based on type annotations. This is exemplified by the following code: ```python import attr import inspect class Test: a:...
Hi, first of all, love the project and use it nearly every day for my job. I have come across some behaviour that is unexpected. Please consider this minimal worked...
I need to do some more rigorous analysis of this, so my level of confidence here is "strong hunch", but: using attrs extensively, across a large codebase, can contribute non-trivially...