Python library for quantum random numbers, fetched from the ANU Quantum Random Numbers Server.
# Install with all extras and dev dependencies
uv sync --all-extras --all-groups
# Run tests
QRANDOM_API_KEY=key uv run pytest
# Type check
uv run ty check .
# Lint
uv run ruff check .src/qrandom/— library source_api.py— HTTP client for the ANU API_generator.py—random.Randomsubclass backed by quantum randomness_cli.py—qrandom-initCLI for storing the API key_util.py— XDG config path utilitiesnumpy.py— optional numpy/randomgen integration
tests/— pytest testsanalysis/— notebooks/scripts (not part of the package)
GitHub Actions runs tests across Python 3.10–3.14 on Linux, macOS, and Windows, plus a lint job pinned to 3.12. Python versions are managed via UV_PYTHON and UV_MANAGED_PYTHON=1 env vars set at the job level.
- API key is read from
QRANDOM_API_KEYenv var or a config file (qrandom.ini) inQRANDOM_CONFIG_DIR(defaults to XDG config home) - Use
click.utils.strip_ansi()onresult.outputin CLI test assertions to handle ANSI codes consistently across platforms