Python SDK for the Driftstone API.
Project description
Driftstone - Python
Python SDK for the Driftstone repository API.
Install
pip install driftstone
Quick Start
from driftstone import Driftstone
client = Driftstone(api_key="your-api-key")
repo = client.repos.create(
"hello-world",
)
upload = client.repos.create_upload(
"hello-world",
storage_dir="ver-1234abcd",
branch="main",
files=[{"name": "README.md", "hash": "64-character-sha256-or-client-hash"}],
)
# Upload each file to the returned signed URL with PUT and
# Content-Type: application/octet-stream.
for upload_url in upload.upload_urls:
print(upload_url.name, upload_url.url)
client.repos.complete_upload("hello-world", upload.upload_id)
download = client.repos.create_download(
"hello-world",
type="main",
files=[{"path": "ver-1234abcd/README.md"}],
)
for download_url in download.download_urls:
print(download_url.path, download_url.url)
branch = client.repos.create_branch(
"hello-world",
"feature-readme",
storage_dir="state-123",
transforms={"README.md": "# Example Repo\nUpdated content.\n"},
)
empty_branch = client.repos.create_branch(
"hello-world",
"empty-feature",
derive_from_main=False,
)
branch_upload = client.repos.create_upload(
"hello-world",
storage_dir="state-456",
branch=branch.name,
files=[{"name": "README.md", "hash": "64-character-sha256-or-client-hash"}],
)
client.repos.complete_upload("hello-world", branch_upload.upload_id)
print(repo.id, branch.name)
Extensions
extension = client.extensions.create(
name="README reviewer",
prompt="Inspect README changes and suggest concise release-note updates.",
presets=["openclaw"],
)
run = client.extensions.run(
extension.id,
path="organizations/org-.../repositories/hello-world/main/ver-1234abcd",
prompt="Focus on docs/README.md.",
)
status = client.extensions.poll(run.run_id)
print(status.status, status.result)
Using A Context Manager
from driftstone import Driftstone
with Driftstone(api_key="your-api-key") as client:
repo = client.repos.get("hello-world")
branches = client.repos.list_branches(repo.slug)
print(repo.name, [branch.name for branch in branches])
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
driftstone-1.3.0.tar.gz
(10.1 kB
view details)
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 driftstone-1.3.0.tar.gz.
File metadata
- Download URL: driftstone-1.3.0.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6a82d4fb69fdea4ccb115bbd994393b28afa623513eb611a2055a6199974c98
|
|
| MD5 |
e7d828ce348a1e3c785ecf9aaaaf2d78
|
|
| BLAKE2b-256 |
b0428c2d3f51db3c440fc8704b215724be34e9a9002ff16078372c9511dda7fe
|
File details
Details for the file driftstone-1.3.0-py3-none-any.whl.
File metadata
- Download URL: driftstone-1.3.0-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe06aa8fd3da15c796b35dfeaf13a0cdef3a3001cdfc50dc5a34563525078945
|
|
| MD5 |
b93a141c0bd72bdcdcb95d61724e6bc9
|
|
| BLAKE2b-256 |
c864f31badda315801e61324906a2004e544ed1a4514fbbbfb42e1bbe3f0d861
|