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


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.0.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.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

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

Hashes for githosted-0.1.0.tar.gz
Algorithm Hash digest
SHA256 93b6793168a32a1635350c3b9a62eef41df81e606bb53c3b2beaa17e0f7a18a9
MD5 f624afd1474e8c82bf4737e77f3433f7
BLAKE2b-256 a7358798512b793a2b1db05876a70e989923b43fe7161d637de73b705d002195

See more details on using hashes here.

Provenance

The following attestation bundles were made for githosted-0.1.0.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.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

Hashes for githosted-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e915075c1a815c73de6277ff6b59f6e4f8974b4a8bf74b8ab7315d4ddc12af5
MD5 ce91d59f3c9c948bd2d823b639070be6
BLAKE2b-256 8970a5f1bdb29f7ea61db6adc1f8b0ba1b9b3e9c97383d532afb8edf6ba15dd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for githosted-0.1.0-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