Skip to content

Commit

Permalink
chore: add changelog
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron <[email protected]>
  • Loading branch information
aarnphm committed Nov 13, 2023
1 parent d9119e5 commit 8332539
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions changelog.d/1203.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Added `namespaces` to `attr.make_class` to provide additional attributes
for newly created class

```python
import attr

@attr.define
class A:
pass

def new_echo(cls, *something: int) -> tuple[int, ...]:
return something

B = attr.make_class("B", bases=(A,), namespaces={"echo": classmethod(new_echo)})

B.echo(1, 2, 3)
```
1 change: 1 addition & 0 deletions src/attr/_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -2894,6 +2894,7 @@ def make_class(
.. versionadded:: 17.1.0 *bases*
.. versionchanged:: 18.1.0 If *attrs* is ordered, the order is retained.
.. versionchanged:: 23.2.0 If *attrs* is ordered, the order is retained.
"""
if isinstance(attrs, dict):
cls_dict = attrs
Expand Down

0 comments on commit 8332539

Please sign in to comment.