asyncio-chainable
Making asyncio coroutines chainable
Built on: Python3 and Docker (alpine) and Poetry (Package Manager)
Maintained by: Chris Lee [sihrc.c.lee@gmail.com]
Installation
pip3 install asyncio_chainable
Example Usage
import pytest
from asyncio_chainable import async_chainable, async_chainable_class
@pytest.mark.asyncio
async def test_simple_chain():
class Number:
def __init__(self, num: int = 0):
self.num = num
@async_chainable
async def add(self, num: int):
self.num += num
return self
@async_chainable
async def subtract(self, num: int):
self.num -= num
return self
assert (await Number().add(5).subtract(2)).num == 3
@pytest.mark.asyncio
async def test_class_chain():
@async_chainable_class
class Number:
def __init__(self, num: int = 0):
self.num = num
async def add(self, num: int):
self.num += num
return self
async def subtract(self, num: int):
self.num -= num
return self
assert (await Number().add(5).subtract(2)).num == 3
Contributing: Getting Started
Docker
- Additional Python3 dependencies can be added to requirements.txt
- Tests are located in ./tests
- To run the docker container with the basic requirements, dependencies, and the package installed:
$ touch .env $ docker-compose up
Poetry
$ poetry install
Metadata
Release files for asyncio-chainable 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asyncio-chainable-0.1.3.tar.gz | 3.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asyncio_chainable-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.2 kB
Release files / asyncio-chainable-0.1.3.tar.gz
| Download URL | asyncio-chainable-0.1.3.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5c463da376b8d1e9e3284e905514fdd46f99a62f85c720cf27855fbe06fa21c
|
|
BLAKE2b-256 checksum How to use checksums |
d28c01030a87413c902a07c7b90d5f0b25cb010113538a4c1bce28810db3ba7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.10.4 Linux/5.10.60.1-microsoft-standard-WSL2
|
Release files / asyncio_chainable-0.1.3-py3-none-any.whl
| Download URL | asyncio_chainable-0.1.3-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9cf085d7bdfd8648dbd84d9bdedf561de9377e6c2d7c1fde850c3e25008c466b
|
|
BLAKE2b-256 checksum How to use checksums |
89b6567059c5429e6910a1004ae2a656db57bae03af777a49004ea0973b0b822
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.10.4 Linux/5.10.60.1-microsoft-standard-WSL2
|