abxbus
Purpose
abxbus is the multi-runtime event bus used for typed events, handler execution, event history, timeout handling, and language contracts.
Shared Rules
- Keep this repo on branch
main.
- Use
uv and uv run for Python commands.
- Do not use system
python, direct .venv/bin/python, or pip commands.
- Use real events, real buses, real handlers, real async execution, real subprocesses when relevant, and real files.
- Do not mock, monkeypatch, fake, simulate, skip, xfail, or weaken tests.
- Verify event ordering, event history, handler results, timeouts, cancellation, emitted records, and side effects.
- Read
README.md for the full event API, runtime matrix, bridge, and language-specific surface.
Development Setup
uv sync --dev --all-extras --no-extra tachyon
pnpm --dir abxbus-ts install --frozen-lockfile
uv run pytest --collect-only -q
User-Facing Setup
project_dir="$(mktemp -d)"
trap 'rm -rf "$project_dir"' EXIT
uv init --bare "$project_dir"
uv add --project "$project_dir" abxbus
Basic Usage
import asyncio
from abxbus import EventBus, BaseEvent
class UserEvent(BaseEvent[str]):
username: str
async def handle_user(event: UserEvent) -> str:
return event.username
async def main():
bus = EventBus()
bus.on(UserEvent, handle_user)
event = await bus.emit(UserEvent(username="alice")).now()
assert await event.event_result() == "alice"
await bus.destroy()
asyncio.run(main())
Verification
uv run pytest -n auto --dist loadfile tests -q
uv run pytest tests/test_eventbus.py -q
env -u GIT_CONFIG_COUNT -u GIT_CONFIG_KEY_0 -u GIT_CONFIG_VALUE_0 uv run prek run --all-files
Dedicated CI jobs run tests/test_cross_runtime_roundtrip.py with all required
native tools and bridge services, and tests/test_eventbus_performance.py with
isolated performance thresholds.
Keep event ordering and replay behavior deterministic.
1---2name: abxbus3description: Use this when working on typed events, event bus execution, event history, ordering, timeouts, cancellation, and multi-runtime event contracts.4---56# abxbus78## Purpose910`abxbus` is the multi-runtime event bus used for typed events, handler execution, event history, timeout handling, and language contracts.1112## Shared Rules1314- Keep this repo on branch `main`.15- Use `uv` and `uv run` for Python commands.16- Do not use system `python`, direct `.venv/bin/python`, or `pip` commands.17- Use real events, real buses, real handlers, real async execution, real subprocesses when relevant, and real files.18- Do not mock, monkeypatch, fake, simulate, skip, xfail, or weaken tests.19- Verify event ordering, event history, handler results, timeouts, cancellation, emitted records, and side effects.20- Read `README.md` for the full event API, runtime matrix, bridge, and language-specific surface.2122## Development Setup2324```bash25uv sync --dev --all-extras --no-extra tachyon26pnpm --dir abxbus-ts install --frozen-lockfile27uv run pytest --collect-only -q28```2930## User-Facing Setup3132```bash33project_dir="$(mktemp -d)"34trap 'rm -rf "$project_dir"' EXIT35uv init --bare "$project_dir"36uv add --project "$project_dir" abxbus37```3839## Basic Usage4041```python42import asyncio43from abxbus import EventBus, BaseEvent4445class UserEvent(BaseEvent[str]):46 username: str4748async def handle_user(event: UserEvent) -> str:49 return event.username5051async def main():52 bus = EventBus()53 bus.on(UserEvent, handle_user)54 event = await bus.emit(UserEvent(username="alice")).now()55 assert await event.event_result() == "alice"56 await bus.destroy()5758asyncio.run(main())59```6061## Verification6263```bash64uv run pytest -n auto --dist loadfile tests -q65uv run pytest tests/test_eventbus.py -q66env -u GIT_CONFIG_COUNT -u GIT_CONFIG_KEY_0 -u GIT_CONFIG_VALUE_0 uv run prek run --all-files67```6869Dedicated CI jobs run `tests/test_cross_runtime_roundtrip.py` with all required70native tools and bridge services, and `tests/test_eventbus_performance.py` with71isolated performance thresholds.7273Keep event ordering and replay behavior deterministic.