This release is a pre-release and may not be stable for production use.
Beaker-py
A lightweight pure-Python client for Beaker.
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.git
Then run:
cd beaker/bindings/python
make dev-install
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) or BEAKER_TOKEN environment variable.
Then you instantiate the Beaker client with the .from_env() class method:
from beaker import Beaker
with Beaker.from_env() as beaker:
...
Then you can:
- Query Clusters with
beaker.cluster.*methods, e.g.beaker.cluster.get("ai2/jupiter-cirrascale-2"). - Manage Datasets with
beaker.dataset.*methods, e.g.beaker.dataset.create(dataset_name, source_dir). - Submit, track, and find Experiments with
beaker.experiment.*,beaker.workload.*, andbeaker.job.*methods, e.g.beaker.experiment.create(spec=spec, name=name). - Manage Workspaces with
beaker.workspace.*methods, e.g.beaker.workspace.create("ai2/new_workspace"). - Manage Secrets with
beaker.secret.*methods, e.g.beaker.secret.write(name, value).
Example workflow
Launch and follow an experiment like beaker-gantry does:
import time
from beaker import Beaker, BeakerExperimentSpec, BeakerJobPriority
with Beaker.from_env() as beaker:
# Build experiment spec...
spec = BeakerExperimentSpec.new(
description="beaker-py test run",
beaker_image="petew/hello-world",
priority=BeakerJobPriority.low,
preemptible=True,
)
# Create experiment workload...
workload = beaker.experiment.create(spec=spec)
# Wait for job to be created...
while (job := beaker.workload.get_latest_job(workload)) is None:
print("waiting for job to start...")
time.sleep(1.0)
# Follow logs...
print("Job logs:")
for job_log in beaker.job.logs(job, follow=True):
print(job_log.message.decode())
Development
After installing from source, you can run checks and tests locally with:
make checks
Releases
At the moment releases need to be published manually by following these steps:
- Ensure you've authenticated with PyPI through a
~/.pypircfile and have write permissions to the beaker-py project. - Ensure the target release version defined in
src/beaker/version.pyis correct, or change the version on the fly by adding theMakeargumentBEAKER_PY_VERSION=X.X.Xto the command in the next step. - Run
make publishfor a stable release ormake publish-nightlyfor a nightly pre-release.
Metadata
Release files for beaker-py 2.0.1.dev20250429
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| beaker_py-2.0.1.dev20250429.tar.gz | 70.0 kB | Without provenance | Details for beaker_py-2.0.1.dev20250429.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| beaker_py-2.0.1.dev20250429-py3-none-any.whl | Python 3 | none | any | Details for beaker_py-2.0.1.dev20250429-py3-none-any.whl |
Total release size: 148.0 kB
Release files / beaker_py-2.0.1.dev20250429.tar.gz
| Download URL | beaker_py-2.0.1.dev20250429.tar.gz |
|---|---|
| Size | 70.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4eeb8e48ae99900065662bdfc5deec77f0b5a273494902d0e95f81c171b8f3e7
|
|
BLAKE2b-256 checksum How to use checksums |
7b6298771948a4175e45d25ca135fcb0458badff9b4a7e623d8ce2ffa2427105
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Release files / beaker_py-2.0.1.dev20250429-py3-none-any.whl
| Download URL | beaker_py-2.0.1.dev20250429-py3-none-any.whl |
|---|---|
| Size | 78.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c138ae23cb87b066b5e745da1e54b53ce94938435833fd21a69ccd3cf5aa117c
|
|
BLAKE2b-256 checksum How to use checksums |
3e434d04dacbb4ed72b0946657d5c86d49e69ca4bc87826a63c9e0d8e46d6727
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Security for beaker-py 2.0.1.dev20250429
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.