A Python Beaker client
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file beaker_py-1.32.2.tar.gz
.
File metadata
- Download URL: beaker_py-1.32.2.tar.gz
- Upload date:
- Size: 74.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 873af5b249bb309bc99ed992c0336dd616fd96e0286db1ed66ed68da0dd9b170 |
|
MD5 | 2b220f27b622842264c8ad93711df8aa |
|
BLAKE2b-256 | b99f33ed2d9f7734b136a616c151d9660adb7263b28ce5b695709fb2e7396b72 |
File details
Details for the file beaker_py-1.32.2-py3-none-any.whl
.
File metadata
- Download URL: beaker_py-1.32.2-py3-none-any.whl
- Upload date:
- Size: 87.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbce3a53c0454cf15f3488bf90e750ac7f3c429894a7dc1b376b98e39ea166cd |
|
MD5 | b31fccbabb5d78b239933d441eeee5af |
|
BLAKE2b-256 | ea5f59c0006cfce8202bfc8bc0f0669d8c005ea6d31aa8652000ad4853d3f7e1 |