Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python.announce > #2682

attrs 17.3.0 released!

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Hynek Schlawack <hs@ox.cx>
Newsgroups comp.lang.python.announce
Subject attrs 17.3.0 released!
Date Wed, 8 Nov 2017 19:20:58 +0100
Lines 50
Approved python-announce-list@python.org
Message-ID <mailman.105.1510232490.2819.python-announce-list@python.org> (permalink)
References <B54E11F6-8B70-4C0A-96FD-30519AD902FE@ox.cx>
Mime-Version 1.0 (Mac OS X Mail 10.3 \(3273\))
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de lDgjTX0qY9VqyXGkQzpg9A96YtF9uYzYC7bW/nj5Hw9g==
Return-Path <hs@ox.cx>
X-Original-To python-announce-list@python.org
Delivered-To python-announce-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; 'ignored': 0.05; 'attributes': 0.07; 'received:internal': 0.07; 'subject:released': 0.07; 'python': 0.09; '*not*': 0.09; 'received:10.202': 0.09; 'received:10.202.2': 0.09; 'received:66.111': 0.09; 'received:66.111.4': 0.09; 'received:messagingengine.com': 0.09; 'everyone,': 0.11; 'typing': 0.15; 'attributes,': 0.16; 'attrs': 0.16; 'received:10.202.2.161': 0.16; 'received:66.111.4.28': 0.16; 'received:out4-smtp.messagingengine.com': 0.16; 'url:project': 0.16; 'value:': 0.16; 'x-mailer:apple mail (2.3273)': 0.16; 'pep': 0.18; '>>>': 0.18; 'later': 0.20; 'variable': 0.20; '<>,': 0.22; 'skip:` 10': 0.22; 'import': 0.26; 'i\xe2\x80\x99m': 0.27; 'feature': 0.28; 'team,': 0.28; '3.6': 0.29; 'changes:': 0.29; 'itself,': 0.29; 'url:en': 0.30; 'classes': 0.30; 'announce': 0.31; 'allows': 0.32; 'option.': 0.33; 'but': 0.34; 'point': 0.34; 'class': 0.35; 'url:org': 0.36; 'anything': 0.37; 'proto:https': 0.38; 'received:10': 0.38; 'drop': 0.39; 'received:io': 0.39; 'received:psf.io': 0.39; 'received:ams1.psf.io': 0.39; 'received:mail1.ams1.psf.io': 0.39; 'received:192': 0.39; 'release': 0.39; 'to:addr:python.org': 0.40; 'received:192.168': 0.40; 'excited': 0.62; 'information': 0.62; 'header:Message-Id:1': 0.63; 'advanced': 0.63; 'note:': 0.67; 'to:addr:python-announce- list': 0.71; 'again!': 0.84; 'bar:': 0.84; 'hood': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=Pk4a/+PrSmc4ZNnrda0FSeAh4rnDd 0IvrjEF0YZqdj8=; b=BVTST4/zzZkaatxjfhdNc4KxI7FCfmFCUEZRPpy6WFwBP ygD/yR5CX6qBrav3T2mnmnFUYj1y+ZuRbO+/rj8MaEk8QTXm5HCnL6dnc1Zgq5wr /ptnDNYTJiAtPYNSBuxmyv2YX9m/OAJKFVpabtZ34586g7j9fIBUHGc3T1ubKd5W LhMkVSF/FKQMSECpRr0Tr5KM0j47dFvwl+7YyU+EuISUcfCPVOHCJOXlsavnAl2J niHwMglCFqP4xFnatE79c8KTD/od0xXQGyERPE7XvltEaobVMArW+XEV+aw/qH9U vkr8fsFnrO+lvBg0sZZSgXbS2fvXNU1ObRQkCJEyA==
X-ME-Sender <xms:C0sDWkchcL_uBChEkKegM3r3GHYUYkpWwJXF1WYNQo5tvutJJI2gGQ>
X-Mailer Apple Mail (2.3273)
X-Mailman-Approved-At Thu, 09 Nov 2017 08:01:29 -0500
X-BeenThere python-announce-list@python.org
X-Mailman-Version 2.1.25
Precedence list
List-Id Announcement-only list for the Python programming language <python-announce-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-announce-list/>
List-Post <mailto:python-announce-list@python.org>
List-Help <mailto:python-announce-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <B54E11F6-8B70-4C0A-96FD-30519AD902FE@ox.cx>
Xref csiph.com comp.lang.python.announce:2682

Show key headers only | View raw


Hi everyone,

I’m very excited to announce the 17.3.0 release of attrs <http://www.attrs.org/>, the package that will make you love writing classes again!

A lot has happened under the hood but the main feature we’d like to point out is first-class support for types including PEP 526-style class variable annotations:

```pycon
>>> @attr.s
... class C:
...     x = attr.ib(type=int)
...     y: int = attr.ib()
>>> attr.fields(C).x.type
<class 'int'>
>>> attr.fields(C).y.type
<class 'int'>
```

And if you’re OK with annotating *all* attributes, you can drop the `attr.ib()` completely with the new `auto_attribs` option.  Anything that is assigned to the attributes and isn’t an `attr.ib` is used as a default value:

```pycon
>>> import typing
>>> @attr.s(auto_attribs=True)
... class AutoC:
...     cls_var: typing.ClassVar[int] = 5  # this one is ignored
...     l: typing.List[int] = attr.Factory(list)
...     x: int = 1
...     bar: typing.Any = None
>>> AutoC()
AutoC(l=[], x=1, bar=None)
```

Please note:

- This feature works with Python 3.6 and later only.
- The type information is currently *not* used by attrs itself, but it allows you to write advanced validators and serializers.

Check out the changelog for all changes: <http://www.attrs.org/en/stable/changelog.html>
Get it from PyPI: <https://pypi.org/project/attrs/>

For the attrs team,
Hynek Schlawack

Back to comp.lang.python.announce | Previous | Next | Find similar | Unroll thread


Thread

attrs 17.3.0 released! Hynek Schlawack <hs@ox.cx> - 2017-11-08 19:20 +0100

csiph-web