Phala Cloud Python SDK
Python SDK for Phala Cloud API, aligned with @phala/cloud action surface.
Goals
- Pythonic API (
snake_case, sync-first REPL experience) - Sync + Async parity
- Pydantic request/response validation
- Safe calls (
safe_*) without exceptions
Requirements
- Python >= 3.10
- uv (for development)
Installation
pip install phala-cloud
Quickstart
Sync
from phala_cloud import create_client
client = create_client(api_key="<api-key>")
me = client.get_current_user()
print(me.model_dump())
Async
import asyncio
from phala_cloud import create_async_client
async def main() -> None:
client = create_async_client(api_key="<api-key>")
me = await client.get_current_user()
print(me.model_dump())
await client.aclose()
asyncio.run(main())
Configuration
Environment variables
PHALA_CLOUD_API_KEYPHALA_CLOUD_API_PREFIX(e.g.https://cloud-api.phala.com/api/v1)
Client options
api_keybase_urlversion(2025-10-28/2026-01-21/2026-05-22)timeoutheadersuse_cookie_auth
API Style
- Direct methods: raise on HTTP/validation errors
- Safe methods (
safe_*): returnSafeResult - Function-style wrappers available in
phala_cloud.actions
Example:
result = client.safe_get_kms_list()
if result.ok:
print(result.data.items)
else:
print(result.error)
Development
cd python
# Install dependencies
uv sync
# Run tests
make test
# Lint & format
make check
E2E Test
E2E tests cover sync + async, direct + safe styles, and full interface paths.
Required:
PHALA_CLOUD_E2E_API_KEY— your Phala Cloud API key
Optional:
PHALA_CLOUD_E2E_BASE_URL— defaults tohttps://cloud-api.phala.com/api/v1
Run
cd python
PHALA_CLOUD_E2E_API_KEY="<api-key>" make e2e
Or put them in python/.env.test:
PHALA_CLOUD_E2E_API_KEY=<api-key>
# PHALA_CLOUD_E2E_BASE_URL=https://cloud-api.phala.com/api/v1
Then simply:
cd python
make e2e
License
Apache-2.0
Metadata
Release files for phala-cloud 0.2.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 | |
|---|---|---|---|
| phala_cloud-0.2.0.tar.gz | 144.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| phala_cloud-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 181.3 kB
Release files / phala_cloud-0.2.0.tar.gz
| Download URL | phala_cloud-0.2.0.tar.gz |
|---|---|
| Size | 144.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
56e67ebe82f829500f013af246281a524151ec1fe0ed8a1fe95472ebc2feeea5
|
|
BLAKE2b-256 checksum How to use checksums |
7bd160587f35219db15ae33eafaa363d1fe3d085ce1e952e09bbc2452797d2dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.
Transparency logRelease files / phala_cloud-0.2.0-py3-none-any.whl
| Download URL | phala_cloud-0.2.0-py3-none-any.whl |
|---|---|
| Size | 37.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
957cda901b0a6e1e905865bb86ee59a36d3d3b5dc45a2c92f12cb6177f753ca3
|
|
BLAKE2b-256 checksum How to use checksums |
0323d094d5893afafffc63884e70628760b080220fa14959468297c10a04cd88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.
Transparency log