Skip to main content

s6r-odoo-sh

Resolve the current build of an odoo.sh branch — its build number and its live SSH host — from Python.

Odoo.sh recycles old dev builds, so the SSH host of a branch changes on every rebuild and any host cached elsewhere quickly dies. The current build lives only in the odoo.sh dashboard (a GitHub-OAuth-gated Odoo instance), whose generic RPC is locked down. s6r-odoo-sh reads it through the dashboard's own JSON routes.

How it works

  • Runtime is httpx-only (light). It reuses a persisted browser session and, if the odoo.sh session expired but the GitHub session is still alive, the GitHub OAuth code flow replays transparently while following redirects.
  • Login is interactive and one-time (the "PyCharm / gh auth login" model): a browser window opens once for the GitHub login, the session is persisted, and every subsequent call runs headless. This step needs the optional login extra (Playwright); the runtime does not.

Install

pip install s6r-odoo-sh                 # runtime only (httpx)
pip install "s6r-odoo-sh[login]"        # + Playwright, for the one-time login
s6r-odoo-sh --install-browser           # download the Playwright browser (once)

CLI

# one-time interactive login (opens a browser window)
s6r-odoo-sh --login -p myproject BRANCH

# current build of a branch (headless afterwards)
s6r-odoo-sh migration_19_v1 -p myproject
s6r-odoo-sh migration_19_v1 -p myproject --ssh-host   # host string only
s6r-odoo-sh --list          -p myproject              # all branches

# ODOO_SH_PROJECT / ODOO_SH_STATE env vars are honored as defaults

Example output:

{
  "project": "myproject",
  "branch": "migration_19_v1",
  "stage": "dev",
  "build_id": 34305175,
  "host_slug": "myproject-migration-19-v1-34305175",
  "status": "done",
  "result": "success",
  "ssh_host": "34305175@myproject-migration-19-v1-34305175.dev.odoo.com"
}

Python API

from s6r_odoo_sh import OdooShClient, resolve

# one-shot (auto-login on first use)
build = resolve("myproject", "migration_19_v1")
print(build["build_id"], build["ssh_host"])

# reusable client, custom session path
client = OdooShClient(state_path="/path/to/state.json")
host = client.get_ssh_host("myproject", "migration_19_v1", auto_login=True)
for b in client.list_branches("myproject"):
    print(b["name"], b["last_build_id"])

OdooShClient(state_path=None, base_url="https://www.odoo.sh", login_browser="firefox", login_timeout=300) — state_path defaults to $XDG_CONFIG_HOME/odoo-sh/state.json. NeedLogin is raised when no valid session exists and auto_login is not set.

Watching a build (CI: build + unit tests)

s6r-odoo-sh --build-status -p myproject BRANCH        # current status/result/status_info

# after `git push`: wait for the new build to start, then for the tests to finish
s6r-odoo-sh --wait-build -p myproject BRANCH --commit "$(git rev-parse HEAD)"
s6r-odoo-sh --wait-build -p myproject BRANCH --after-build 34345516   # or by baseline build id
res = client.wait_for_build("myproject", "BRANCH", commit="abc123…")
# → {build_id, status: "done", result: "success"|"failed"|"warning", status_info, run_time, …}

status_info carries the test outcome (e.g. which modules failed). Match the build you pushed with commit (SHA) or after_build_id (a build id captured before pushing).

Backups & database dumps

# create & download a dump of a branch in one go: triggers it, waits for the
# "Database dump ready" notification, then downloads the ZIP
s6r-odoo-sh --create-dump          -p myproject BRANCH   # → Downloads folder, auto-named
s6r-odoo-sh --create-dump ./db.zip -p myproject BRANCH   # → explicit path (file or dir)
#   --filestore  include the filestore   --prod  production dump (default: neutralized test dump)

# download an ALREADY-prepared dump (no new dump) — pick it by build id or by date
s6r-odoo-sh --download-dump -p myproject --build 34345516
s6r-odoo-sh --download-dump -p myproject --backup-datetime "2026-07-02 13:40:53"

# create a persistent backup of a branch's current build
s6r-odoo-sh --create-backup -p myproject BRANCH --comment "before migration"

# any command targeting a build accepts --build <id> instead of a branch
s6r-odoo-sh --create-dump -p myproject --build 34345516

# inspect
s6r-odoo-sh --backups     -p myproject   # repository backups
s6r-odoo-sh --dump-notifs -p myproject   # ready "database dump" notifications (with URLs)
res = client.create_dump("myproject", "BRANCH", "db.zip")   # → {notif_id, url, build_id, backup_datetime_utc, dest}
client.create_backup("myproject", "BRANCH", comment="…")
client.dump_notifications("myproject")                      # ready dumps + their download URLs
client.download_url(url, "db.zip")                          # download any dump URL

Dumps are asynchronous: odoo.sh assigns the backup_datetime_utc and publishes a notification carrying the authoritative download URL, which create_dump waits for. It only accepts a notification newer than the ones present before the request and whose build id and test_dump/filestore options match what it triggered, so a different in-flight dump is not picked up by mistake. (odoo.sh returns no request id, so two identical dumps of the same build launched at the same instant cannot be told apart — an inherent, documented limitation.) The download is a ZIP (dump.sql + filestore/); the worker authorizes it from the session via a redirect, and prepared test dumps stay available for ~2h.

License

LGPL-3.0-or-later.

Metadata

Release files for s6r-odoo-sh 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for s6r-odoo-sh 0.2.4
File Size Uploaded
s6r_odoo_sh-0.2.4.tar.gz 22.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for s6r-odoo-sh 0.2.4
File Interpreter ABI Platform
s6r_odoo_sh-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 43.8 kB

Release files / s6r_odoo_sh-0.2.4.tar.gz

Download URL s6r_odoo_sh-0.2.4.tar.gz
Size 22.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5ec40f4ccae685317b1fc8a5d83da5757c801044c3a55b4042f2cddf90b45fbb
BLAKE2b-256 checksum
How to use checksums
9f47add7737dbff6b6e8fdd276f2fd99121e68b6336faca02d1e6d6ef835545d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / s6r_odoo_sh-0.2.4-py3-none-any.whl

Download URL s6r_odoo_sh-0.2.4-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
187f10abaf526a9922eb758d8166fe5230de8a3c010ff4edd6c66f12c7d52913
BLAKE2b-256 checksum
How to use checksums
1fab943e76cf4765859f1bada6d9231636634559b88a4f74a32b5e61701b1086
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page