beaker-py1.32.3
Published
A Python Beaker client
pip install beaker-py
Package Downloads
Project URLs
Requires Python
>3.7
Dependencies
- requests
- packaging
- pydantic
<3.0,>=1.8.2
- rich
<14.0,>=12.3
- PyYAML
- docker
<8.0,>=5.0
- ruff
; extra == "dev"
- mypy
<1.6,>=1.0; extra == "dev"
- types-requests
; extra == "dev"
- types-cachetools
; extra == "dev"
- types-PyYAML
; extra == "dev"
- black
<24.0,>=23.0; extra == "dev"
- isort
<5.13,>=5.12; extra == "dev"
- pytest
<8.0; extra == "dev"
- pytest-sphinx
; extra == "dev"
- flaky
; extra == "dev"
- twine
>=1.11.0; extra == "dev"
- build
; extra == "dev"
- setuptools
; extra == "dev"
- wheel
; extra == "dev"
- Sphinx
<7.0.2,>=6.0; extra == "dev"
- furo
==2023.5.20; extra == "dev"
- myst-parser
<2.1,>=1.0; extra == "dev"
- sphinx-copybutton
==0.5.2; extra == "dev"
- sphinx-autobuild
==2021.3.14; extra == "dev"
- sphinx-autodoc-typehints
==1.23.3; extra == "dev"
- sphinx-inline-tabs
==2022.1.2b11; extra == "dev"
- packaging
; extra == "dev"
- petname
==2.6; extra == "dev"
Features
šŖ¶ Lightweight
- Minimal dependencies.
- Only pure-Python dependencies.
- Communicates directly with the Beaker server via HTTP requests (Beaker CLI not required).
šŖ Robust
- Automatically retries failed HTTP requests with exponential backoff.
- Runtime data validation.
- High test coverage.
š Exhaustively-typed and documented
- Thorough data model for all input / output types.
- Every expected HTTP error from the Beaker server is translated into a specific exception type.
Quick links
See also š
- Beaker (CLI)
- Beaker Gantry
- Beaker-relevant GitHub Actions
Installing
Installing with pip
beaker-py is available on PyPI. Just run
pip install beaker-py
Installing from source
To install beaker-py from source, first clone the repository:
git clone https://github.com/allenai/beaker-py.git
cd beaker-py
Then run
pip install -e .
Quick start
If you've already configured the Beaker command-line client, beaker-py will
find and use the existing configuration file (usually located at $HOME/.beaker/config.yml
).
Otherwise just set the environment variable BEAKER_TOKEN
to your Beaker user token.
Either way, you should then instantiate the Beaker client with .from_env()
:
from beaker import Beaker
beaker = Beaker.from_env(default_workspace="my_org/my_workspace")
The API of beaker-py is meant to mirror - as closely as possible - the API of the Beaker CLI. For example, when you do this with the CLI:
beaker dataset create --name foo .
The beaker-py equivalent would be:
beaker.dataset.create("foo", ".")
See the API Docs to learn about the Beaker client's methods.