Alien Python bindings
alienplatform gives async Python applications typed access to resources linked by Alien. Provider selection, short-lived credential refresh, error metadata, and cloud behavior stay in the shared Rust binding core.
The package is under development and is not published to a package registry yet.
Local development
Build an editable local-provider package from the repository root:
python -m venv .venv
source .venv/bin/activate
python -m pip install 'maturin>=1.9,<2' 'pytest>=8,<10' 'pytest-asyncio>=1,<2'
maturin develop --manifest-path crates/alien-bindings-python/Cargo.toml \
--no-default-features --features local
pytest -q crates/alien-bindings-python/tests
The native extension uses Python's asyncio interface and runs Alien futures on its Tokio runtime. Resource factories are lazy: missing or malformed bindings fail when first used with a structured AlienError.
Resources
from alienplatform import ai, container, key, kv, postgres, queue, sandbox, storage, vault, worker
from sqlalchemy.ext.asyncio import create_async_engine
files = storage("files")
await files.put("reports/today.json", b"{}", condition="absent")
assert await files.get("reports/today.json") == b"{}"
assert await files.get_optional("reports/missing.json") is None
cache = kv("cache")
await cache.put("status", b"ready", condition="absent")
jobs = queue("jobs")
await jobs.send({"kind": "index"})
secrets = vault("secrets")
api_token = await secrets.get("api-token")
database = await postgres("database").connection()
engine = create_async_engine(**database.sqlalchemy_async_engine_kwargs())
service_url = await container("api").internal_url()
response = await worker("processor").invoke(
method="POST", path="/jobs", body=b"{}", timeout_ms=30_000
)
ciphertext = await key("records").encrypt(b"private", {"tenant": "tenant-42"})
model = await ai("assistant").connection()
# OpenAI-compatible clients use model.openai_base_url. model.api_key is None
# for ambient Bedrock, Vertex, and Foundry resources because the embedded Rust
# gateway authenticates with the workload identity.
Do not log or render Postgres connection strings, passwords, vault values, or model credentials. Connection object representations redact credentials by default.
AI
ai(name).connection() returns a provider-neutral base URL. Managed Bedrock,
Vertex, and Foundry resources start the same in-process Rust gateway used by the
TypeScript SDK, so signing and short-lived credential refresh stay in the shared
implementation. External OpenAI and Anthropic bindings return the projected key
and provider endpoint. Pass openai_base_url to an OpenAI-compatible client.
Sandbox commands stream raw stdout and stderr frames with production-order sequence numbers:
runtime = sandbox("runtime")
instance, created = await runtime.get_or_create(tenant_key="tenant-42", timeout_ms=300_000)
stream = await runtime.run_command(
instance.sandbox_id,
"python",
["-c", "print('hello')"],
timeout_ms=30_000,
)
try:
async for frame in stream:
if frame.data is not None:
print(frame.data.decode(errors="replace"), end="")
if frame.exit_code is not None and frame.exit_code != 0:
raise RuntimeError(f"command exited with {frame.exit_code}")
finally:
await stream.close()
Long-running commands can use start_job, poll_job, and cancel_job. Call capabilities() before optional file, job, pause/resume, or isolation behavior because support differs by platform.
PostgreSQL TLS
Postgres.connection() returns the provider-neutral connection parameters, a wire-protocol URL, CA certificates, and SSL mode. sqlalchemy_async_engine_kwargs() translates the URL and supplies the verified TLS context together so create_async_engine() cannot omit provider CA certificates. Lower-level integrations can use sqlalchemy_async_url() and ssl_context() directly.
Errors
AlienError includes stable code, context, retryable, internal, http_status_code, and hint fields. Branch on code rather than parsing the message. Errors from object storage are intentionally mapped without object paths or provider response bodies so application logs do not leak customer data.
Release files for alienplatform 3.3.24
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| alienplatform-3.3.24-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| alienplatform-3.3.24-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| alienplatform-3.3.24-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| alienplatform-3.3.24-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 87.4 MB
Release files / alienplatform-3.3.24-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | alienplatform-3.3.24-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 23.4 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5ff4c224d0392942ed698c14a3760214aa8cf7db8b061a8f097497b408c57ed6
|
|
BLAKE2b-256 checksum How to use checksums |
b1ee11c61d8ebd883d0a72e54a23b2f8acd7d5cb104e8156562be82d601973ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 25, 2026.
Transparency logRelease files / alienplatform-3.3.24-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | alienplatform-3.3.24-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 22.9 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
147ed1fc2178f2b172638ea6f8c9b3189181975b45833887aa0aeebc15a06b7f
|
|
BLAKE2b-256 checksum How to use checksums |
8a8e19a5a34f90e8ea490fc7a061536c700e77f5fd1f7803ab6214de2afcf01d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 25, 2026.
Transparency logRelease files / alienplatform-3.3.24-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | alienplatform-3.3.24-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 20.3 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bd27ef1b67df8abe11e7e4510309d18ade0374db9a1334534e7deb07157b9735
|
|
BLAKE2b-256 checksum How to use checksums |
3e9f04f136fecd340b93fc9058d1317fd4ca2af0e02752f5c9b5ddd59e21dfb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 25, 2026.
Transparency logRelease files / alienplatform-3.3.24-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | alienplatform-3.3.24-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 20.9 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
387b74bd864cbfa65f97b97240af7e5dcdfb64f73f99f97b86339853d6e7aec4
|
|
BLAKE2b-256 checksum How to use checksums |
d1c17030d648a7150c5f90d3d239c79e10a505fcf38069235de92dceb164b1f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 25, 2026.
Transparency log