https://github.com/allenai/beaker-py
A pure-Python Beaker client
https://github.com/allenai/beaker-py
api-client beaker python
Last synced: 3 months ago
JSON representation
A pure-Python Beaker client
- Host: GitHub
- URL: https://github.com/allenai/beaker-py
- Owner: allenai
- License: apache-2.0
- Created: 2021-11-04T20:56:28.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-09-15T18:51:37.000Z (4 months ago)
- Last Synced: 2025-09-15T20:30:20.100Z (4 months ago)
- Topics: api-client, beaker, python
- Language: Python
- Homepage:
- Size: 910 KB
- Stars: 17
- Watchers: 5
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
â NOTICE: this project has moved! The latest version of beaker-py is now maintained in [allenai/beaker](https://github.com/allenai/beaker/tree/main/bindings/python), with documentation at [beaker-py-docs.allen.ai](https://beaker-py-docs.allen.ai/index.html). Version 1 will continue to survive here for folks that need it. We also provide a [migration guide](https://github.com/allenai/beaker/blob/main/bindings/python/MIGRATION_GUIDE.md) to make upgrading easier.
## 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
- [PyPI package](https://pypi.org/project/beaker-py/)
- [Contributing](https://github.com/allenai/beaker-py/blob/main/CONTRIBUTING.md)
- [License](https://github.com/allenai/beaker-py/blob/main/LICENSE)
*See also ð*
- [Beaker project](https://github.com/allenai/beaker)
- [Beaker Gantry](https://github.com/allenai/beaker-gantry)
- Beaker-relevant *GitHub Actions*
- [setup-beaker](https://github.com/marketplace/actions/setup-beaker)
- [beaker-command](https://github.com/marketplace/actions/beaker-command)
- [beaker-run](https://github.com/marketplace/actions/beaker-run)
## Installing
### Installing with `pip`
**beaker-py** is available [on PyPI](https://pypi.org/project/beaker-py/). Just run
```bash
pip install 'beaker-py<2.0'
```
### Installing from source
To install **beaker-py** from source, first clone [the repository](https://github.com/allenai/beaker-py):
```bash
git clone https://github.com/allenai/beaker-py.git
cd beaker-py
```
Then run
```bash
pip install -e .
```
## Quick start
If you've already configured the [Beaker command-line client](https://github.com/allenai/beaker/), **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](https://beaker.org/user).
Either way, you should then instantiate the Beaker client with `.from_env()`:
```python
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:
```bash
beaker dataset create --name foo .
```
The **beaker-py** equivalent would be:
```python
beaker.dataset.create("foo", ".")
```