attrs
attrs copied to clipboard
Python Classes Without Boilerplate
# Summary This will allow those extending attrs to type `NOTHING` as `Literal[NOTHING]`. This is the [recommended](https://github.com/python/typing/issues/689#issuecomment-561425237) way of doing this, at least until [PEP-661](https://peps.python.org/pep-0661/) lands. I also just realized...
# Summary Conditionally defines `has` using `TypeGuard` in Python 3.10+ in the stub file. xref: https://github.com/python-attrs/attrs/issues/987 # Pull Request Check List - [x] Added **tests** for changed code. Our CI...
The latest release introduced the `AttrsInstance` protocol with one attribute, `__attrs_attrs__`, which replaced `Any` in the signature of various core functions. The `__attrs_attrs__` attribute is "injected" by the attrs mypy...
Starting with version attrs 22.1.0, I started running into a type checking issue when running mypy. In particular, this occurs when calling asdict in parent class where that parent class...
Micro-optimization is the root of all success.
Let's try to move into the ✨future✨.
I'm not sure if this is intended behavior or not but it definitely confused me, so maybe someone can help me understand it better. Here's a simple example ```python from...
First of all, thank you for building such a wonderful package! It is now an essential part of both my work and my hobby projects. This issue is similar to...
I'd love to do something like: ``` @attr.s(auto_attribs=True, frozen=True) class Parent: @abstract param: str @attr.s(auto_attribs=True, frozen=True) class Child(Parent): @override param = "test" ``` where you wouldn't be able to create...
The specific situation is more complicated, but this is the minimal representation. I have a situation where I have a datastructure that is "frozen" and my contract with myself is...