Skip to content

vayu

Async-first Python utility library for caching, time operations, parallel execution, and more.

pip install vayulib             # base: cache, time, retry, aio, log, parallel
pip install 'vayulib[data]'     # adds pandas / numpy / plotly helpers

Core names are importable from the top level:

from vayu import mem_cached, retry, TimeWindow, L, Interval, FileCache

What's inside

Module Highlights
cache @cached decorator with TTL, FileCache, MemoryCache, pluggable serializers
aio grab_all_urls() with rate limiting, sleep_until_signal(), shutdown helpers
time_utils TimeWindow, timeit, to_human_readable_time, timezone-aware datetime helpers
common @retry with exponential backoff, add_jitter, group, camel_or_space_to_snake
interval Interval dataclass with union / intersection / containment algebra
parallel ParallelRunner over thread/process pools with progress tracking
pandas_utils (data) slice_frame, select_frame, split_frame, concat_frame_from_dir
plotly_utils (data) Plotly chart helpers
statistics (data) quantile aggregation helper
log Named logger L with shorthand methods; opt-in configure_logging()

Modules marked (data) require the vayulib[data] extra.

At a glance

from vayu import mem_cached, retry, TimeWindow
from datetime import timedelta

@mem_cached(ttl=timedelta(minutes=5))
async def fetch(url: str) -> bytes:
    ...

@retry(ConnectionError, tries=3, delay=1, backoff=2)
async def call_api():
    ...

window = TimeWindow.behind(hours=6)   # last 6 hours
print(window.duration, window.start_ms, window.end_ms)

Head to Getting started or jump straight to a guide from the table above. Every public symbol is also documented under API reference.