Skip to main content

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 parameters
  • ModelConfigBuilder - Builder pattern for configs

Graph

  • NodeId - Unique node identifier
  • GraphNode - Graph node with config and metadata
  • BuildGraph - 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_ACCEL feature flags at runtime.

Pipeline

  • BuildPipeline - Multi-stage build pipeline with hooks
  • BuildContext - Execution context with backend and tracing
  • PipelineStage - Custom stage protocol (subclass in Python)

Diagnostics

  • TraceLevel - Log levels (Debug, Info, Warn, Error)
  • TraceEvent - Structured trace event
  • InMemoryTraceSink - Collects events in memory

Validation

  • ValidationError - Validation failure details
  • NameValidator - Validates model names
  • VersionValidator - Validates semver versions
  • CompositeValidator - Combines multiple validators

Feature Flags

Python constants to check available backends at runtime:

  • HAS_BURN - Whether Burn backend is available
  • HAS_CUBECL - Whether CubeCL backend is available
  • HAS_RUST_AI_CORE - Whether rust-ai-core is available
  • HAS_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

aphelion_framework-1.1.0.tar.gz (79.6 kB view details)

Uploaded Source

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

Hashes for aphelion_framework-1.1.0.tar.gz
Algorithm Hash digest
SHA256 1090c4e53427120a9de4e1728f72d9964fcbc9eed74a8699534c9c732a96fa52
MD5 3128b10fa566abd1b2de4213304d174b
BLAKE2b-256 27594419ba6e436799981c42350e3ef8feeb21971b593e0c5d7f4b14f0734283

See more details on using hashes here.

Provenance

The following attestation bundles were made for aphelion_framework-1.1.0.tar.gz:

Publisher: release.yml on tzervas/aphelion-framework-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page