gagarin — Python
pip install gagarin
Python 3.9+, standard library only.
from gagarin import Gagarin, GagarinError
gg = Gagarin() # GAGARIN_TOKEN, GAGARIN_API; or Gagarin(token=...)
# What `gg run` does: submit, wait, exit with the script's code.
res = gg.jobs.run_and_wait(
"shop", "migrate",
image="migrate:v3", # or registry.gagarin.cloud/<project-id>/migrate:v3
env={"LOG_LEVEL": "debug"},
deps=["db"],
size="m",
timeout_seconds=900,
on_update=lambda run: print(run.phase),
)
raise SystemExit(res.exit_code)
Fire and forget, then check later:
sub = gg.jobs.run("shop", "backfill", image="backfill:v1")
run = gg.jobs.wait("shop", "backfill", sub.revision)
print(gg.jobs.logs("shop", "backfill", since="30m")["logs"])
A scheduled job (runs nothing now):
gg.jobs.run("shop", "nightly", image="report:v2", schedule="0 3 * * *", time_zone="Europe/Berlin")
The basics (answers are plain dicts, typed with TypedDict):
me = gg.account.whoami() # me["account"], me["can"], me["registry"]
bill = gg.account.billing() # bill["balance"], bill["runway_hours"]
projects = gg.projects.list()
p = gg.projects.create("shop") # raises project_exists if you have one
st = gg.projects.status("shop") # st["services"], st["notices"], st["usage_today"]
web = gg.projects.service_status("shop", "web")
logs = gg.services.logs("shop", "web", since="1h", contains="error")
history = gg.services.deployments("shop", "web")
health = gg.platform.health() # an unhealthy platform is an answer, not an exception
API refusals raise GagarinError with status, code, message and fix_hint.
PYTHONPATH=src python -m unittest discover -s tests
Metadata
Release files for gagarin 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gagarin-0.1.1.tar.gz | 16.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gagarin-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.7 kB
Release files / gagarin-0.1.1.tar.gz
| Download URL | gagarin-0.1.1.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06f4a632ecc90ce3a0f58ede976433b8818c91a6de6b830c825af270aeaf241a
|
|
BLAKE2b-256 checksum How to use checksums |
03ce5c5d0a35865a77a2eb390943b76ef4856f1654c87de7935c1a337f9c706d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / gagarin-0.1.1-py3-none-any.whl
| Download URL | gagarin-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb28c7b25c586d442dbe5ce4769bd79edf3b357689cf653c6f9a26c6fdd6e465
|
|
BLAKE2b-256 checksum How to use checksums |
996dc969528a9f3801abc50c727860ffff16f384ac2ec3ad13cab240dd58e251
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency log