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)
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.1.1.tar.gz
(8.0 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.1.1.tar.gz.
File metadata
- Download URL: driftstone-1.1.1.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a07d9ffc023f3cde1b3764b26c35246a596123b1fb7b8a8601d24a8fa66c6611
|
|
| MD5 |
522edda295e370f490bee2eaed0be345
|
|
| BLAKE2b-256 |
8c882bfb9ee1dee595080f16502da831d2241bb1d0045b080a05456acfe73cdb
|
File details
Details for the file driftstone-1.1.1-py3-none-any.whl.
File metadata
- Download URL: driftstone-1.1.1-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
172fc363cfdbb0d8d0cab3e6d0ab6c8c078c58b8af1a1788d04f873a70a65e38
|
|
| MD5 |
7e9bbf02506f1ca4f0c593787908a440
|
|
| BLAKE2b-256 |
c0d27abf1eb0bdf76285ecd47c036e4fde560b97efcc71c8ca401c650e96a2ae
|