Skip to main content

AsyncGraphs

Test Coverage Package version Supported Python versions


AsyncGraphs is a tiny ETL framework that leverages asyncio to make the execution concurrent whilst blocked on I/O.

Source: https://github.com/SamVermeulen42/asyncgraphs

Documentation: https://samvermeulen42.github.io/asyncgraphs/


Features

  • Typed
  • Simple concurrency based on asyncio
  • Easy construction of ETL graphs

Installation

pip install asyncgraphs

Example

The following example prints random Pokémon and the games they appear in.

It does this every 10 seconds and uses PokéApi.

import aiohttp
from asyncgraphs import Graph, run
import asyncio
from functools import partial
from random import randint
from typing import Dict, Any


async def random_pokemon_id():
    while True:
        yield randint(1, 151)
        await asyncio.sleep(10)

async def get_pokemon_info(session: aiohttp.ClientSession, pokemon_id: int) -> Dict[str, Any]:
    pokemon_url = f"https://pokeapi.co/api/v2/pokemon/{pokemon_id}"
    async with session.get(pokemon_url) as response:
        yield await response.json()
                
def format_pokemon(pokemon_info: Dict[str, Any]) -> str:
    name = pokemon_info["name"]
    versions = (game['version']['name'] for game in pokemon_info['game_indices'])
    return f"{name}: {', '.join(versions)}"

async def main():
    async with aiohttp.ClientSession() as session:
        g = Graph()
        g | random_pokemon_id() | partial(get_pokemon_info, session) | format_pokemon | print
        await run(g)

asyncio.run(main())

Metadata

Release files for asyncgraphs 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asyncgraphs 0.0.4
File Size Uploaded Provenance Actions
asyncgraphs-0.0.4.tar.gz 8.4 kB Without provenance Details for asyncgraphs-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for asyncgraphs 0.0.4
File Interpreter ABI Platform Actions
asyncgraphs-0.0.4-py3-none-any.whl Python 3 none any Details for asyncgraphs-0.0.4-py3-none-any.whl

Total release size: 13.6 kB

Release files / asyncgraphs-0.0.4.tar.gz

Download URL asyncgraphs-0.0.4.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ee9053359502f1d0e74bfaaa7129207a41e35d3043c0907aaec09d668b4f6f5b
BLAKE2b-256 checksum
How to use checksums
4fcf2072189831715c692ccfcf4c71e70bd8ba5996809c21db7720283549dc0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / asyncgraphs-0.0.4-py3-none-any.whl

Download URL asyncgraphs-0.0.4-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0186585fd916a55eb06974b90973e2f5abfd0386a3361052b10c9014c71cdde
BLAKE2b-256 checksum
How to use checksums
c778646bbd7bc46014b7a382da572dcc2a0b74f3f717fa8f66b798284a16543d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Security for asyncgraphs 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page