Registry / devops / beaker-gantry

beaker-gantry

JSON →
library3.7.0pypypi✓ verified 83d ago

Beaker Gantry (beaker-gantry) is a command-line interface (CLI) tool and Python library that streamlines running Python experiments in Beaker. It manages containers and boilerplate, eliminating the need for manual Dockerfile creation or complex Beaker YAML experiment specifications. Gantry automatically handles environment setup, repository cloning, and workload management at runtime, making it ideal for Python-based batch jobs from rapidly changing Git repositories. It is actively maintained with frequent updates.

pip install beaker-gantry
INSTALL
IMPORT
SIG · BEAKER-GANTRY
B
beaker-gantry
devopspythonv3.7.0
Install
6.5s avg
Import
Disk
65MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.7.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 63.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 6.5s · import 0.000s · 62MB
65MB installed
● package 65MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GantryError
from gantry.exceptions import GantryError
from gantry import GantryError

While primarily a CLI tool, `beaker-gantry` interacts with Beaker. This quickstart demonstrates how to verify your Beaker token (a prerequisite) and shows the most basic CLI command to run an experiment. It also hints at the Python API for logging metrics from within a running experiment. Ensure you have committed and pushed your changes to a Git repository before running `gantry run`.

import os # Ensure BEAKER_TOKEN is set in your environment BEAKER_TOKEN = os.environ.get('BEAKER_TOKEN', 'YOUR_BEAKER_TOKEN') if not BEAKER_TOKEN or BEAKER_TOKEN == 'YOUR_BEAKER_TOKEN': print("Warning: Please set the BEAKER_TOKEN environment variable.") print("You can obtain it from your Beaker profile page.") else: print("Beaker token is set. To run an experiment, ensure you are in a Git repository") print("and execute: gantry run --show-logs -- python -c 'print(\"Hello, Beaker Gantry!\")'") print("For programmatic metric logging from within an experiment:") print(" from gantry.api import write_metrics") print(" write_metrics({'accuracy': 0.95, 'loss': 0.05})")
gantry --version
Debug
Known issues
gotchaAll `gantry` CLI commands must be invoked from the root directory of your Git repository. Running from a subdirectory will likely result in a `GitError` or `DirtyRepoError`.
fix
Change directory to the root of your Git repository before executing `gantry` commands. Alternatively, use the `--remote` option for non-repository contexts (Gantry 3.5.3+).
affects: All versions
breakingGantry relies on Beaker authentication. You must have the `BEAKER_TOKEN` environment variable set or the Beaker command-line client configured locally (e.g., `$HOME/.beaker/config.yml`).
fix
Set the `BEAKER_TOKEN` environment variable (e.g., `export BEAKER_TOKEN='your_token'`) or ensure `beaker-py` can find a valid configuration file.
affects: All versions
gotchaWhen providing a command and its arguments to `gantry run`, use `--` to clearly separate `gantry`'s own options from the command's arguments. Without it, Gantry might misinterpret your command's options as its own.
fix
Always use `--` before your command and its arguments, e.g., `gantry run --show-logs -- python my_script.py --arg value`.
affects: All versions
gotchaFor private Git repositories, Gantry requires a GitHub Personal Access Token (PAT) with `repo` scope to clone your repository on Beaker. Gantry will prompt you for this token the first time it's needed.
fix
Generate a GitHub PAT with `repo` scope and provide it when prompted by Gantry, or set it using `gantry config set-gh-token`.
affects: All versions
gotchaTo save results or metrics from an experiment, your experiment should write files to the `/results` directory within the Beaker container. This directory is automatically configured to be persisted as a Beaker dataset.
fix
Modify your experiment code to output relevant data to the path specified by the `RESULTS_DIR` environment variable (which defaults to `/results` in the container), or use `from gantry.api import write_metrics` for programmatic metric logging.
affects: All versions
Upgrade
Version history
3.7.0latest on PyPI · released Apr 8, 2026
Audit
Dependencies
beaker-pyrequiredGantry is built on top of the Beaker Python client.
Agent activity
27 hits · last 30 days
node
26
OpenAI (training)
1
Resources
beaker-gantry — pip install beaker-gantry · libregistry