Skip to main content

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). `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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

githosted-0.1.1.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

githosted-0.1.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file githosted-0.1.1.tar.gz.

File metadata

  • Download URL: githosted-0.1.1.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

Hashes for githosted-0.1.1.tar.gz
Algorithm Hash digest
SHA256 14b43f848d73b7dbedc3f773c6593b3d8ffb88249da59732985021f34d5e6366
MD5 c045cf08155778eb5e38b8e1af875ac6
BLAKE2b-256 9cf63428e6390626050211ebb1a4ca5b783aedf4780f7324900847afd2eb9c00

See more details on using hashes here.

Provenance

The following attestation bundles were made for githosted-0.1.1.tar.gz:

Publisher: release.yml on githosted-dev/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file githosted-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: githosted-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for githosted-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b749f83767154bbbcee70f6cf42f3eda2cc8e7b02d996147bc8134090af7d60d
MD5 f2fdcc405068f6c22b1eb1b6d3716d52
BLAKE2b-256 baaf6b7cf98ed30d9026127ab199225a3fc069695fd98daf70478b02371f3d3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for githosted-0.1.1-py3-none-any.whl:

Publisher: release.yml on githosted-dev/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page