Skip to main content

alpha2 for Python

Build, validate and render alpha2 project documents from Python. A project is a plain dict in the engine's project.v1 shape (typed as alpha2.types.Project). Validation runs the engine's own validator in-process; rendering runs the native alpha2-host process on the GPU.

pip install alpha2

On Linux x86_64 and aarch64, macOS arm64 and Windows x64 this also installs alpha2-host, the native renderer, as a platform wheel of the same version. Elsewhere, or where that wheel cannot be installed (a Linux older than its glibc baseline), see Finding alpha2-host.

import alpha2

project = alpha2.ProjectBuilder("Intro", width=1280, height=720, frame_rate=30)
title = project.source("image", "title.png")
project.video_track().clip(title, at=0, duration=3)

result = alpha2.export(
    project.build(),
    "intro.mp4",
    assets={title: "title.png"},
    on_progress=lambda p: print(f"{p.completed}/{p.total}"),
)
print(result["videoOutputPath"], result["frames"])
  • alpha2.export, alpha2.conform and alpha2.capabilities run on a shared HostClient; make your own (alpha2.HostClient(concurrency=2)) to bound or separate them.
  • Setting a cancel event (threading.Event) or pressing Ctrl-C ends the host, which removes its partial output, before the call returns.
  • Every failure is an alpha2.Alpha2HostError with a machine-readable code and a classified failure dict for retry policies.
  • Options you write use snake_case (loudness={"target_lufs": -14, ...}); what the host reports keeps the protocol's camelCase keys (result["effectiveRange"]).

Finding alpha2-host

In this order: the host_path argument, ALPHA2_HOST_PATH, the alpha2-host wheel of this version, the archive of this version in the shared cache, then PATH.

python -m alpha2 install downloads the release archive into the cache (ALPHA2_HOST_CACHE_DIR, else ~/.cache/alpha2, ~/Library/Caches/alpha2 or %LOCALAPPDATA%\alpha2), the one @alpha2-sh/node uses, so one download serves both; --thin installs the archive that loads the system's FFmpeg 8. Or unpack the archive from the GitHub release yourself and point ALPHA2_HOST_PATH at its bin/alpha2-host.

Development

The extension module is the Rust crate bindings/alpha2-python; maturin builds it into the package.

cd python/alpha2
uv venv -p 3.11 && uv pip install --group dev
uv pip install --no-deps -e .         # rebuild after changing the Rust crate
.venv/bin/pytest                       # end-to-end tests use ALPHA2_HOST_BINARY or target/debug/alpha2-host
.venv/bin/mypy && .venv/bin/ruff check

--no-deps because the pinned alpha2-host wheel exists only once a release is published; the tests find a host through ALPHA2_HOST_BINARY, ALPHA2_HOST_PATH or the cache instead. src/alpha2/types.py is generated from the project schema by npm run generate:schema. python/alpha2-host builds the alpha2-host wheel from a release archive.

Metadata

Release files for alpha2 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for alpha2 0.4.2
File Actions
alpha2-0.4.2-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for alpha2-0.4.2-cp311-abi3-win_amd64.whl
alpha2-0.4.2-cp311-abi3-manylinux_2_34_x86_64.whl CPython 3.11 abi3 Linux glibc 2.34+ x86-64 Details for alpha2-0.4.2-cp311-abi3-manylinux_2_34_x86_64.whl
alpha2-0.4.2-cp311-abi3-manylinux_2_34_aarch64.whl CPython 3.11 abi3 Linux glibc 2.34+ ARM64 Details for alpha2-0.4.2-cp311-abi3-manylinux_2_34_aarch64.whl
alpha2-0.4.2-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for alpha2-0.4.2-cp311-abi3-macosx_11_0_arm64.whl

Total release size: 3.7 MB

Release files / alpha2-0.4.2-cp311-abi3-win_amd64.whl

Download URL alpha2-0.4.2-cp311-abi3-win_amd64.whl
Size 852.1 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b6ed6fe89a92ff757623b6d072625c928e2faaa50e74c353287da97f81f72a6c
BLAKE2b-256 checksum
How to use checksums
6b1be729316f34b6e791d8343fd1f3e8c7876046abb31006b9da3cc95a7cc9f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / alpha2-0.4.2-cp311-abi3-manylinux_2_34_x86_64.whl

Download URL alpha2-0.4.2-cp311-abi3-manylinux_2_34_x86_64.whl
Size 989.7 kB
Tags CPython 3.11 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
2900c02c4f8a1694110c4e376727488cbe3348184520ee2e2cf1609912f5c9e4
BLAKE2b-256 checksum
How to use checksums
e343718250e4693cfa7103636f7dfe47fbd26020b29e5ee334920af57cbd50ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / alpha2-0.4.2-cp311-abi3-manylinux_2_34_aarch64.whl

Download URL alpha2-0.4.2-cp311-abi3-manylinux_2_34_aarch64.whl
Size 985.4 kB
Tags CPython 3.11 Linux glibc 2.34+ ARM64 abi3
SHA-256 checksum
How to use checksums
e93a905a1866372aa92c241b3c55910c7040f8735e76db749b319a18da7b7a73
BLAKE2b-256 checksum
How to use checksums
97eec9ab80440dc05a09c5d09aebbb6b3e726db86e2bc3f074e964d1fae15910
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / alpha2-0.4.2-cp311-abi3-macosx_11_0_arm64.whl

Download URL alpha2-0.4.2-cp311-abi3-macosx_11_0_arm64.whl
Size 908.9 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6d794e913741e31574c1491472bced36a0d21f900f06b372e7dd27ef841f3b21
BLAKE2b-256 checksum
How to use checksums
25ab168e87b7e9e82ad677bc5c1f2903e524e71f4af3f7dfd4139a2e319c95e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for alpha2 0.4.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page