https://github.com/aliev/aiostd
A simple library for asynchronous communication with standard I/O
https://github.com/aliev/aiostd
asyncio python stdin stdout
Last synced: 8 months ago
JSON representation
A simple library for asynchronous communication with standard I/O
- Host: GitHub
- URL: https://github.com/aliev/aiostd
- Owner: aliev
- License: mit
- Created: 2024-06-18T08:12:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-08T04:58:39.000Z (about 1 year ago)
- Last Synced: 2025-02-01T15:44:19.084Z (8 months ago)
- Topics: asyncio, python, stdin, stdout
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# aiostd
A simple library for asynchronous communication with standard I/O
The library employs asyncio's I/O multiplexing, which enables efficient I/O operations by monitoring multiple file descriptors simultaneously without the overhead of creating separate threads.
## Installation
```
pip install -U aiostd
```## Usage
```python
from aiostd import open_io_stream
import sysasync def main():
reader, writer = await open_io_stream(sys.stdin, sys.stdout)async for line in reader:
writer.write(line)
await writer.drain()asyncio.run(main())
```