Perceptra Python SDK
Official Python SDK for the Perceptra Hub Computer Vision MLOps platform.
Installation
pip install perceptra
Quick Start
import perceptra
# Initialize with your API key
client = perceptra.Perceptra(api_key="ph_live_abc123...")
# Or set PERCEPTRA_API_KEY environment variable
client = perceptra.Perceptra()
# Create a project
project = client.projects.create(
name="Hard Hat Detection",
project_type_id=1,
)
# Upload images
from pathlib import Path
for path in Path("./images").glob("*.jpg"):
client.images.upload(file=path, project_id=project.project_id)
# Add annotations
client.annotations.create(
project_id=project.project_id,
image_id="...",
annotation_type="bbox",
annotation_class_id=0,
data=[0.1, 0.2, 0.5, 0.8],
)
# Split dataset
client.projects.split_dataset(project.project_id, 0.7, 0.2, 0.1)
# Create a dataset version
version = client.versions.create(project.project_id, "v1.0")
# Create and train a model
model = client.models.create(
project_id=project.project_id,
name="YOLOv8 Hard Hat",
task="object-detection",
framework="yolo",
)
result = client.models.train(
model_id=model.id,
dataset_version_id=version.id,
config={"epochs": 100, "batch_size": 16},
)
# Stream training logs
for line in client.training.stream_logs(result.training_session_id):
print(line, end="")
Async Support
import asyncio
import perceptra
async def main():
async with perceptra.AsyncPerceptra(api_key="ph_live_abc123...") as client:
projects = await client.projects.list()
for p in projects:
print(p["name"])
asyncio.run(main())
Error Handling
from perceptra import NotFoundError, RateLimitError, AuthenticationError
try:
project = client.projects.retrieve("nonexistent-id")
except NotFoundError:
print("Project not found")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except AuthenticationError:
print("Invalid API key")
Available Resources
| Resource | Description |
|---|---|
client.projects |
Project CRUD, image management, dataset splitting |
client.images |
Image upload, listing, bulk operations |
client.annotations |
Annotation CRUD, batch operations |
client.models |
ML model CRUD, training triggers |
client.training |
Training session monitoring, log streaming |
client.versions |
Dataset version management, export |
client.organizations |
Organization details, members |
client.jobs |
Annotation job management |
client.classes |
Annotation class management |
client.tags |
Image tag management |
client.api_keys |
API key management, rotation |
client.storage |
Storage profile management |
Configuration
| Parameter | Default | Environment Variable |
|---|---|---|
api_key |
— | PERCEPTRA_API_KEY |
base_url |
http://localhost:29085 (the data API) |
PERCEPTRA_BASE_URL |
timeout |
30.0 |
— |
max_retries |
3 |
— |
License
MIT
Metadata
Release files for perceptra 1.1.1
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 |
|---|---|---|---|---|
| perceptra-1.1.1.tar.gz | 21.5 kB | Without provenance | Details for perceptra-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| perceptra-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for perceptra-1.1.1-py3-none-any.whl |
Total release size: 54.5 kB
Release files / perceptra-1.1.1.tar.gz
| Download URL | perceptra-1.1.1.tar.gz |
|---|---|
| Size | 21.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
64964433d49621f4a2aabf159e8e1d6aeecd0362de84b120cc0fde2bf3896369
|
|
BLAKE2b-256 checksum How to use checksums |
d4c15d20338f211e4304ab7ca05ff0aa1d0154dd671ea3bf5f7f28b73e45cfe9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / perceptra-1.1.1-py3-none-any.whl
| Download URL | perceptra-1.1.1-py3-none-any.whl |
|---|---|
| Size | 33.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
842b9545b8af78c8028540e86650ee8a2edde4900e287336127fb89f7e5656ba
|
|
BLAKE2b-256 checksum How to use checksums |
343ab3c9741cd135ccc4dc831245b6667cf4cef46a4fb438e0a76438b78a14fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for perceptra 1.1.1
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.