attrs
attrs copied to clipboard
Python Classes Without Boilerplate
Mostly wondering if this is expected/desired: ``` python import attr @attr.s(kw_only=True) class A: a = attr.ib(kw_only=False) A(1) # Error ```
Hi, I'm part of a team that's in the early stages of migrating a large legacy app to Python. I'm pushing pretty hard for the team to adopt attrs as...
I am reading Architecture Patterns with Python and at some point the frozen dataclasses just don't work with sqlalchemy, so the author suggests setting `unsafe_hash=True`. To avoid making the class...
See relevant discussion in this discussion: https://github.com/python-attrs/attrs/pull/925#discussion_r827665676
When trying to evolve a frozen object at a deep level, there is a lot of boilerplate, e.g.,: ```python foo = attr.evolve( foo, bar=attr.evolve( foo.bar, baz=attr.evolve( foo.bar.baz, qux='whew!' ) )...
Hello. Due to... circumstances... (mostly https://github.com/python/mypy/issues/5144) looks like if we want proper `fields()` support in Mypy, we'll have to implement it ourselves in the attrs plugin. I volunteer to do...
Issue #240 Draft for: - [x] Added **tests** for changed code. - [ ] New features have been added to our [Hypothesis testing strategy](https://github.com/python-attrs/attrs/blob/master/tests/strategies.py). - [ ] Changes or additions...
I have been playing with [Annotated](https://www.python.org/dev/peps/pep-0593/) recently, and was wondering whether this is something that might be used within attrs. My first instinct was "maybe this could be used for...
Hi Everyone, First, thanks for the great tool -- I really love writing Python code with it! I find myself doing things like this a lot when I want `b`...
``` (txkube) exarkun@baryon:~/Work/LeastAuthority/txkube$ cat brokenattrs.py import attr @attr.s(frozen=True) class X(object): y = attr.ib() @property def z(self): return 3 @z.setter def z(self, value): print("z=", value) X(y=None).z = 10 (txkube) exarkun@baryon:~/Work/LeastAuthority/txkube$ python...