Dataerai Python SDK
Python client for the Dataerai transfer daemon.
Supports authenticated uploads, downloads, and metadata operations.
The daemon is started automatically if it is not already running.
Requirements
- Python ≥ 3.10
- The
dataeraibinary must be installed and onPATH(or passbinary_pathexplicitly) - The user must be logged in via
dataerai auth loginbefore callingauth_status()/upload()/download()
Installation
pip install dataerai-sdk
# or, from source:
pip install -e sdk/python/
Quick start
from dataerai import DataeraiClient
with DataeraiClient(binary_path="/usr/local/bin/dataerai") as client:
# Check auth
status = client.auth_status()
print(f"Logged in as {status.user_email}, token expires {status.expires_at}")
# Upload a file
result = client.upload(
"/path/to/data.csv",
title="My dataset",
owner_type="project",
owner_id="proj-abc123",
on_progress=lambda p: print(f" {p.percent:.0f}% {p.rate_mbps:.1f} MB/s"),
)
print(f"Uploaded asset_id={result.asset_id} content_id={result.content_id}")
# Download it back
dl = client.download(result.asset_id, dest_dir="/tmp/downloads")
for f in dl.files:
print(f" {f.local_path} ({f.size:,} bytes)")
# Read / update metadata
meta = client.get_metadata(result.asset_id)
updated = client.set_metadata(result.asset_id, title="My dataset v2", tags=["csv", "demo"])
API reference
DataeraiClient(*, socket_path, binary_path, auto_start, start_timeout_s, request_timeout_s)
| Parameter | Default | Description |
|---|---|---|
socket_path |
$DATAERAI_SOCKET or /run/user/<uid>/dataerai-transfer.sock |
Unix socket path |
binary_path |
None |
Path to the dataerai binary (required for auto_start) |
auto_start |
True |
Spawn the daemon if the socket does not exist |
start_timeout_s |
10.0 |
Seconds to wait for the daemon socket to appear |
request_timeout_s |
30.0 |
Per-request timeout in seconds |
Use as a context manager (with DataeraiClient(...) as client:) for automatic cleanup, or call client.connect() / client.close() manually.
Methods
| Method | Returns | Description |
|---|---|---|
auth_status() |
AuthStatus |
Logged-in user and token expiry |
upload(local_path, *, title, owner_type, owner_id, ...) |
UploadResult |
Upload a file; blocks until complete |
download(asset_id, dest_dir, ...) |
DownloadResult |
Download latest asset content; blocks until complete |
get_metadata(asset_id) |
AssetMetadata |
Retrieve asset metadata |
set_metadata(asset_id, **fields) |
AssetMetadata |
Update metadata fields |
upload() keyword arguments
| Argument | Type | Description |
|---|---|---|
title |
str |
Asset title (required) |
owner_type |
str |
"project" or "collection" (required) |
owner_id |
str |
Owner entity ID (required) |
description |
str | None |
Free-text description |
alias |
str | None |
Short identifier |
tags |
list[str] | None |
Tag list |
metadata |
dict | None |
Arbitrary key-value metadata |
collection_id |
str | None |
Collection to add the asset to |
chunk_size_mb |
int | None |
Override default 64 MiB chunk size |
on_progress |
Callable[[ProgressEvent], None] | None |
Progress callback |
transfer_timeout_s |
float |
Max seconds to wait for completion (default 3600) |
Progress events
@dataclass
class ProgressEvent:
transfer_id: str
bytes_done: int
bytes_total: int
chunk_index: int
chunk_count: int
rate_bps: float
file_index: int
file_name: str
@property
def percent(self) -> float: ... # 0–100
@property
def rate_mbps(self) -> float: ...
Error types
| Exception | When raised |
|---|---|
DaemonError(code, message) |
Daemon returned a coded error (see code attribute) |
DaemonTimeoutError |
Request or transfer exceeded the configured timeout |
ConnectionError |
Daemon disconnected unexpectedly |
Metadata
Release files for dataerai-sdk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dataerai_sdk-0.1.0.tar.gz | 53.9 kB | Without provenance | Details for dataerai_sdk-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dataerai_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for dataerai_sdk-0.1.0-py3-none-any.whl |
Total release size: 94.3 kB
Release files / dataerai_sdk-0.1.0.tar.gz
| Download URL | dataerai_sdk-0.1.0.tar.gz |
|---|---|
| Size | 53.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc7a32b46ac13af85e6791330db336aed1e312f9b8f8a27429f71fbf69aabbc0
|
|
BLAKE2b-256 checksum How to use checksums |
b7d41e8070a6d19b599749440a5d514aeefe52e8986c60a97bfc5e8194c2dfe0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.13
|
Release files / dataerai_sdk-0.1.0-py3-none-any.whl
| Download URL | dataerai_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 40.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64130b95a1b5c9ec4f29e59b4b6e3d3787e22d43b9534d1aac4132c943b3d29b
|
|
BLAKE2b-256 checksum How to use checksums |
88f800f491d2cbd63a61f90ce4762f0d620edda749efbb0185f5c7f6efde41aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.13
|
Security for dataerai-sdk 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.