Python SDK for githosted — git-backed file storage for AI agents
Project description
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).
repo.write_file("output.json", b'{"status": "ok"}', message="Run #42")
# Read it back.
result = repo.read_file("output.json")
print(result.content.decode())
# 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_file("missing.txt")
except NotFoundError:
...
RepoBusyError and StaleHeadError are retryable — with_retry() is included for the common backoff loop.
Documentation
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file githosted-0.1.0.tar.gz.
File metadata
- Download URL: githosted-0.1.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93b6793168a32a1635350c3b9a62eef41df81e606bb53c3b2beaa17e0f7a18a9
|
|
| MD5 |
f624afd1474e8c82bf4737e77f3433f7
|
|
| BLAKE2b-256 |
a7358798512b793a2b1db05876a70e989923b43fe7161d637de73b705d002195
|
Provenance
The following attestation bundles were made for githosted-0.1.0.tar.gz:
Publisher:
release.yml on githosted-dev/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
githosted-0.1.0.tar.gz -
Subject digest:
93b6793168a32a1635350c3b9a62eef41df81e606bb53c3b2beaa17e0f7a18a9 - Sigstore transparency entry: 1417797431
- Sigstore integration time:
-
Permalink:
githosted-dev/python-sdk@aca60664fd4aa6b2dd7e06328e2d8b8097ef1b94 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/githosted-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@aca60664fd4aa6b2dd7e06328e2d8b8097ef1b94 -
Trigger Event:
push
-
Statement type:
File details
Details for the file githosted-0.1.0-py3-none-any.whl.
File metadata
- Download URL: githosted-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e915075c1a815c73de6277ff6b59f6e4f8974b4a8bf74b8ab7315d4ddc12af5
|
|
| MD5 |
ce91d59f3c9c948bd2d823b639070be6
|
|
| BLAKE2b-256 |
8970a5f1bdb29f7ea61db6adc1f8b0ba1b9b3e9c97383d532afb8edf6ba15dd1
|
Provenance
The following attestation bundles were made for githosted-0.1.0-py3-none-any.whl:
Publisher:
release.yml on githosted-dev/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
githosted-0.1.0-py3-none-any.whl -
Subject digest:
0e915075c1a815c73de6277ff6b59f6e4f8974b4a8bf74b8ab7315d4ddc12af5 - Sigstore transparency entry: 1417797436
- Sigstore integration time:
-
Permalink:
githosted-dev/python-sdk@aca60664fd4aa6b2dd7e06328e2d8b8097ef1b94 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/githosted-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@aca60664fd4aa6b2dd7e06328e2d8b8097ef1b94 -
Trigger Event:
push
-
Statement type: