githosted
Python SDK for githosted — read, write, and diff files in versioned Git repos without shelling out.
githosted exposes a small, typed surface for the operations you actually do against a repo: read a file, commit a change, list history, diff two refs. Real Git underneath; you're not talking to a custom blob store.
Install
pip install githosted
Requires Python 3.10+.
Quick start
from githosted import Client
repo = Client(token="gw_…").repo("my-agent")
# Write a file (creates a commit). `message` is positional.
repo.write("output.json", b'{"status": "ok"}', "Run #42")
# Read it back. `content` is the UTF-8-decoded string;
# `raw_content` is the original bytes.
result = repo.read("output.json")
print(result.content)
# Walk recent history.
for commit in repo.log(limit=5):
print(commit.hash[:7], commit.subject)
# Diff between two refs.
delta = repo.diff("HEAD~1", "HEAD")
print(delta.patch)
Authentication
Tokens are scoped to a workspace. Mint one at app.githosted.dev → Tokens, then pass it to Client(token=…).
| Token prefix | Scope |
|---|---|
gw_… |
Read + write |
gr_… |
Read-only |
For local development, set GITHOSTED_TOKEN and use Client.from_env().
Errors
The SDK raises typed exceptions you can match on:
from githosted import (
Client,
NotFoundError,
RepoBusyError,
StaleHeadError,
)
try:
repo.read("missing.txt")
except NotFoundError:
...
RepoBusyError and StaleHeadError are retryable — with_retry() is included for the common backoff loop.
Documentation
License
MIT.
Metadata
Release files for githosted 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 | |
|---|---|---|---|
| githosted-0.1.1.tar.gz | 11.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| githosted-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.0 kB
Release files / githosted-0.1.1.tar.gz
| Download URL | githosted-0.1.1.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14b43f848d73b7dbedc3f773c6593b3d8ffb88249da59732985021f34d5e6366
|
|
BLAKE2b-256 checksum How to use checksums |
9cf63428e6390626050211ebb1a4ca5b783aedf4780f7324900847afd2eb9c00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 1, 2026.
Transparency logRelease files / githosted-0.1.1-py3-none-any.whl
| Download URL | githosted-0.1.1-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b749f83767154bbbcee70f6cf42f3eda2cc8e7b02d996147bc8134090af7d60d
|
|
BLAKE2b-256 checksum How to use checksums |
baaf6b7cf98ed30d9026127ab199225a3fc069695fd98daf70478b02371f3d3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 1, 2026.
Transparency log