Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Hynek Schlawack 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: References: 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: 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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com comp.lang.python.announce:2682 Hi everyone, I=E2=80=99m very excited to announce the 17.3.0 release of attrs = , the package that will make you love writing = classes again! A lot has happened under the hood but the main feature we=E2=80=99d like = to point out is first-class support for types including PEP 526-style = class variable annotations: ```pycon >>> @attr.s ... class C: ... x =3D attr.ib(type=3Dint) ... y: int =3D attr.ib() >>> attr.fields(C).x.type >>> attr.fields(C).y.type ``` And if you=E2=80=99re 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=E2=80=99t an `attr.ib` is = used as a default value: ```pycon >>> import typing >>> @attr.s(auto_attribs=3DTrue) ... class AutoC: ... cls_var: typing.ClassVar[int] =3D 5 # this one is ignored ... l: typing.List[int] =3D attr.Factory(list) ... x: int =3D 1 ... bar: typing.Any =3D None >>> AutoC() AutoC(l=3D[], x=3D1, bar=3DNone) ``` 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: = Get it from PyPI: For the attrs team, Hynek Schlawack=