Python bindings for the Aphelion AI Framework (aphelion-framework-rs)
Project description
aphelion-framework
Python bindings for the Aphelion AI Framework.
Installation
pip install aphelion-framework
Building from source
Requires maturin:
pip install maturin
cd crates/aphelion-python
maturin develop
Feature flags
Build with specific backends:
maturin develop --features burn
maturin develop --features cubecl
maturin develop --features tritter-accel
maturin develop --features full # all backends
Quick Start
import aphelion
import asyncio
async def main():
# Create configuration
config = aphelion.ModelConfig("my-model", "1.0.0")
config.with_param("hidden_size", 256)
config.with_param("layers", 4)
# Build graph
graph = aphelion.BuildGraph()
node1 = graph.add_node("input", config)
node2 = graph.add_node("output", config)
graph.add_edge(node1, node2)
# Validate
assert not graph.has_cycle()
print(f"Hash: {graph.stable_hash()}")
# Create pipeline context
backend = aphelion.NullBackend.cpu()
trace = aphelion.InMemoryTraceSink()
ctx = aphelion.BuildContext(backend, trace)
# Execute pipeline (async)
pipeline = aphelion.BuildPipeline.standard()
result = await pipeline.execute_async(ctx, graph)
# Get trace events
for event in trace.events():
print(f"[{event.level}] {event.id}: {event.message}")
asyncio.run(main())
API Overview
Configuration
ModelConfig- Model configuration with typed parametersModelConfigBuilder- Builder pattern for configs
Graph
NodeId- Unique node identifierGraphNode- Graph node with config and metadataBuildGraph- Computation graph with cycle detection and hashing
Backend
NullBackend- CPU-only reference backend for testing
Note: Additional backends (Burn, CubeCL, Tritter-Accel) will be available in future releases. Check
HAS_BURN,HAS_CUBECL,HAS_TRITTER_ACCELfeature flags at runtime.
Pipeline
BuildPipeline- Multi-stage build pipeline with hooksBuildContext- Execution context with backend and tracingPipelineStage- Custom stage protocol (subclass in Python)
Diagnostics
TraceLevel- Log levels (Debug, Info, Warn, Error)TraceEvent- Structured trace eventInMemoryTraceSink- Collects events in memory
Validation
ValidationError- Validation failure detailsNameValidator- Validates model namesVersionValidator- Validates semver versionsCompositeValidator- Combines multiple validators
Feature Flags
Python constants to check available backends at runtime:
HAS_BURN- Whether Burn backend is availableHAS_CUBECL- Whether CubeCL backend is availableHAS_RUST_AI_CORE- Whether rust-ai-core is availableHAS_TRITTER_ACCEL- Whether Tritter hardware acceleration is available
License
MIT OR Apache-2.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file aphelion_framework-1.1.0.tar.gz.
File metadata
- Download URL: aphelion_framework-1.1.0.tar.gz
- Upload date:
- Size: 79.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1090c4e53427120a9de4e1728f72d9964fcbc9eed74a8699534c9c732a96fa52
|
|
| MD5 |
3128b10fa566abd1b2de4213304d174b
|
|
| BLAKE2b-256 |
27594419ba6e436799981c42350e3ef8feeb21971b593e0c5d7f4b14f0734283
|
Provenance
The following attestation bundles were made for aphelion_framework-1.1.0.tar.gz:
Publisher:
release.yml on tzervas/aphelion-framework-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aphelion_framework-1.1.0.tar.gz -
Subject digest:
1090c4e53427120a9de4e1728f72d9964fcbc9eed74a8699534c9c732a96fa52 - Sigstore transparency entry: 854576959
- Sigstore integration time:
-
Permalink:
tzervas/aphelion-framework-rs@071aaa7c9442f47aba70c8bf1a984ab54d125911 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/tzervas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@071aaa7c9442f47aba70c8bf1a984ab54d125911 -
Trigger Event:
push
-
Statement type: