Tinche / aiofiles

File support for asyncio
Apache License 2.0
2.76k stars 150 forks source link

Add async stdio files #154

Closed rhelmot closed 1 year ago

rhelmot commented 1 year ago

Closes #153 Closes #131

This adds stdin, stdout, stderr, and their binary counterparts to aiofiles. It does this by introducing two concepts:

rhelmot commented 1 year ago

There are a handful of superfluous changes in the diff because I ran black on the whole project to format my code.

rhelmot commented 1 year ago

Okay. new commit. This one makes it so that wrap() no longer has the option to do indirect wrapping, which makes sense - you need to specify the type of the base class if the underlying file (and its type!) can change - you need to be accountable for the contract that the interface you're wrapping provides, which may be different than its stated type.

As a result, things are simplified drastically, and e.g. trying to use stdin from tests yields pytest's error with a meaningful message.

Tinche commented 1 year ago

Cool, thanks. Will merge it in soon.

pisto commented 1 year ago

Can you please release this on pypi?

Tinche commented 1 year ago

Released!