Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Nathaniel Smith Newsgroups: comp.lang.python.announce Subject: [ANN] async_generator v1.2 released Date: Mon, 14 Nov 2016 22:52:23 -0800 Lines: 44 Approved: python-announce-list@python.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de edU8fqYb0beCoLXjDsEI8wSnU1Ckeshmh0FomHhowLJQ== Return-Path: X-Original-To: python-announce-list@python.org Delivered-To: python-announce-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'url:pypi': 0.03; 'subject:ANN': 0.07; 'subject:released': 0.07; 'python': 0.09; 'generators': 0.09; 'subject:skip:a 10': 0.09; 'unavailable': 0.09; 'def': 0.13; '3.5.': 0.16; '[1,': 0.16; 'async': 0.16; 'from:addr:pobox.com': 0.16; 'received:sasl.smtp.pobox.com': 0.16; 'received:smtp.pobox.com': 0.16; 'sfxlen:2': 0.16; 'subject:] ': 0.17; 'all,': 0.21; 'to:2**1': 0.21; 'pep': 0.22; 'received:pobox.com': 0.22; 'compatible': 0.24; 'feature': 0.25; 'message-id:@mail.gmail.com': 0.25; 'import': 0.26; 'yield': 0.27; "we're": 0.28; 'looks': 0.29; 'yields': 0.29; 'to:no real name:2**1': 0.29; 'received:google.com': 0.32; 'fixed': 0.33; 'subject:[': 0.34; 'but': 0.34; 'url:org': 0.36; 'received:209.85': 0.36; 'cases': 0.36; 'received:209': 0.38; 'some': 0.39; 'received:209.85.214': 0.39; 'to:addr:python.org': 0.39; 'proto:https': 0.40; 'received:io': 0.40; 'received:psf.io': 0.40; 'easy': 0.62; 'skip:y 20': 0.63; 'smith': 0.63; 'native': 0.63; 'our': 0.63; 'to:addr:python-announce-list': 0.71; 'await': 0.76; '"yield': 0.84; 'from"': 0.84; 'package:': 0.93 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=mime-version :from:date:message-id:subject:to:content-type; s=sasl; bh=unVx5D YFpystak7BDvULvdsCPwA=; b=quJunpGW6aMYlJoGUMtHuIxOmjMeKYn+mnd5K6 dLML3Ynu+Px3XVaZ+x6bkfmeMjSarTZuwiuLr/5SkCxXaSK1cbfxGNffvvgS8FUt P2XyqddX517+zl7Owv+TjuxxIf9JFgzLCw2L7s9owtiFloOzLPS2H8i4V9TJnDxQ 1pAuE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=mime-version :from:date:message-id:subject:to:content-type; q=dns; s=sasl; b= ivjCCc6VO/05kWo4W8wGeBrVyb0mv416L3vfLTcysWIyTFqjDRegSazeMlGA4cl2 fVxqDwdjGjXnbxY5SNgasripjANgjOBKHzb4tdtRfuZW5FVoGfqwYnraaEgjQj6/ lHC0F3HbnUVpE7rMOfvqNvidb3+shYbDgulL8xcuD/4= X-Gm-Message-State: ABUngvfWX8o142mE0O7yKfXPmmYlATRo57SUNOau9MCBqGGJAA5Df9bOHp6cqBHXSgn2r5sLcwvIYswD03ICzg== X-Received: by 10.36.48.196 with SMTP id q187mr1638835itq.64.1479192744234; Mon, 14 Nov 2016 22:52:24 -0800 (PST) X-Gmail-Original-Message-ID: X-Pobox-Relay-ID: 1144D3D4-AB00-11E6-901F-3AB77A1B28F4-09433513!pb-smtp2.pobox.com X-Mailman-Approved-At: Tue, 15 Nov 2016 03:23:25 -0500 X-BeenThere: python-announce-list@python.org X-Mailman-Version: 2.1.23 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:2313 Hi all, I just released v1.2 of my async_generator package: https://pypi.org/pypi/async_generator/ This package makes it easy to write PEP 525-style "async generators", even on Python 3.5. It looks like: from async_generator import async_generator, yield_, yield_from_ @async_generator async def parse_json_separated_newlines_from_network(streamreader): async for line in streamreader: await yield_(json.loads(line)) Starting in v1.1 (released last week but not announced widely), the generators are now highly compatible with 3.6's native async generators, including full support for athrow / asend / aclose. They also fully support "yield from", which is otherwise unavailable even on Python 3.6. v1.2 fixed some edge cases in "yield from" -- but the headline feature is that we're now *so* compatible with 3.6's native async generators that you can now use our yield from support directly inside a native generator: from async_generator import yield_from_ async def f(): yield 2 yield 3 # yields [1, 2, 3, 4] async def g(): yield 1 await yield_from_(f()) yield 4 Have fun, -n -- Nathaniel J. Smith -- https://vorpus.org