Skip to main content

Aidge logo

EPL 2.0 Examples PyPi Examples Documentation Status GitLab Contributors Open GitLab Issues Closed GitLab Issues

Aidge Deploy

aidge_deploy is a dedicated Eclipse Aidge module responsible for board-specific build compilation, packaging, transport, flashing, execution, output parsing, and hardware-in-the-loop (HIL) validation/benchmarking.


1. System Architecture

The package decouples model code generation (export) from target-specific deployment orchestration. Once a model is exported to standard C++ or CPU/NPU libraries, aidge_deploy automates the process of building, deploying, executing, and benchmarking it on physical microcontrollers (baremetal) or Single Board Computers (Linux/SBC).

graph TD
    A["Aidge Model Export"] -->|Generated Code Folder| B["aidge_deploy.deploy"]
    B --> C["DeployTarget Registry"]
    C -->|Match Target & Backend| D["Target Instance"]
    D -->|Step 1: prepare| E["Copy Board Files & Jinja Templates"]
    D -->|Step 2: build| F["Local/Docker C++ Compilation"]
    D -->|Step 3: transfer| G["Upload / SSH / Flash transport"]
    D -->|Step 4: flash| H["Hardware Programming (pyOCD / J-Link)"]
    D -->|Step 5: execute| I["Run model on target & capture logs"]
    D -->|Step 6: parse_output| J["Collect timings, cycles & validation predictions"]
    J --> K["DeployResult & metrics dict"]

2. Public Interfaces & APIs

aidge_deploy.deploy(export_dir, config)

The main orchestrator entry point. It resolves the target implementation and executes the deployment pipeline.

  • Parameters:
    • export_dir: An ExportArtifact returned by export(), or its directory containing .aidge-export.json.
    • config (DeployConfig): Configuration defining the deployment target, connection backend, timing parameters, and validation details.
  • Returns: A DeployResult object containing:
    • output (dict): The parsed timing and prediction results.
    • metrics (dict): Key metrics (e.g. clock cycles, peak RAM/flash memory usage).
    • memory_peak_bytes (int): Peak RAM usage (if profiled).
    • timings (list[float]): Measured inference execution times (in ms).
    • accuracy (float | None): Computed validation accuracy (if validation was enabled).

DeployConfig Class

Encapsulates all parameters necessary to orchestrate a deployment:

from aidge_deploy.config import DeployConfig, ValidationConfig, BenchmarkConfig

config = DeployConfig(
    target="stm32h7a3",         # Target device name (e.g., 'stm32h7a3', 'ake7', 'raspberrypi')
    backend="api",              # Connection backend (e.g., 'local', 'ssh', 'ssh_docker', 'api')
    use_docker=True,            # Whether compilation should run inside a Docker container
    api_url="http://...",       # URL of the board-farm API server
    api_board_name="...",       # Hardware board queue name on the API server
    api_username="...",         # Board-farm API credentials
    api_password="...",
    validation=ValidationConfig(
        validation_on_target=True,
        inference_type="classification",
        nb_validation_iterations=100
    ),
    benchmark=BenchmarkConfig(
        nb_warmup=10,
        nb_iterations=100,
        profiling=True
    )
)

The DeployTarget Lifecycle Interface

Every target class implements this abstraction to represent its pipeline steps:

  1. prepare(export_dir, config) -> DeployContext: Copies target-specific startup code, generates configuration files, resolves JINJA main entrypoint templates, and initializes deployment metadata.
  2. build(context) -> BuildResult: Performs local or containerized compilation of the code project (e.g. producing ELF binaries or executable scripts).
  3. transfer(context, build): Copies the generated binary/source files to the target physical filesystem or debug host.
  4. flash(context, build): Programs the board memory (only relevant for baremetal MCU devices).
  5. execute(context, build) -> ExecutionResult: Runs the compiled code on the target board and captures the raw serial/console stdout.
  6. parse_output(context, output) -> DeployResult: Parses timings, clock cycles, and validation predictions from raw log files.

3. Dynamic Selection Registry

Targets are registered via class decorators rather than complex conditional routing. The deployment registry matches a (target, backend) tuple:

from aidge_deploy.registry import register_deploy_target, DeployTarget

@register_deploy_target("my_board", "local")
class MyBoardLocalTarget(DeployTarget):
    ...

To instantiate a target:

from aidge_deploy.registry import get_deploy_target

# Instantiates and returns the class instance registered for (stm32h7a3, api)
target = get_deploy_target("stm32h7a3", "api")

5. BSP assets belong to exporters

aidge_deploy does not resolve, download, or copy BSP files. A successful aidge_core.export_utils.export() call produces a self-contained buildable project; deployment only builds, transfers, flashes, executes, and parses it.

The generic download/cache implementation lives in aidge_core.export_utils.bsp_manager. Each hardware exporter declares the complete BSPPackage(name, version, archive_name) for every supported board. There is intentionally no global package prefix and no package name inferred from a deployment target.

Access Token Configuration

Authentication is managed via environment variables. Set any of the following in your shell or CI pipeline:

export GITLAB_TOKEN="<your_personal_access_token>"
# or
export GITLAB_PRIVATE_TOKEN="<your_private_access_token>"
# or (automatically set in GitLab CI/CD)
export CI_JOB_TOKEN="<job_token>"

Environment overrides

  • Custom Registry Endpoint: export AIDGE_BSP_REGISTRY_URL="https://gitlab.eclipse.org/api/v4/projects/13013/packages/generic"
  • Custom Cache Directory: export AIDGE_BSP_CACHE_DIR="/path/to/custom/bsp/storage"

6. How to Package and Publish BSP Assets to GitLab

When introducing a board, first add its explicit package coordinates to its exporter profile. Publish the same coordinates to the GitLab Generic Package Registry.

Option A: Python API

Run the following Python command in your environment:

from pathlib import Path
from aidge_core.export_utils import BSPPackage, publish_bsp_package

upload_url = publish_bsp_package(
    Path("/tmp/stm32f413-bsp"),
    BSPPackage(
        name="aidge_deploy_bsp_stm32f413",
        version="v1.2.5",
        archive_name="stm32f413.tar.gz",
    ),
    token="your_gitlab_access_token"
)
print(f"Successfully published to: {upload_url}")

Option B: Using curl from Terminal

# 1. Compress the contents of the board's board_files directory
tar -czvf stm32f413.tar.gz -C /tmp/stm32f413-bsp .

# 2. Upload to GitLab Generic Package Registry
curl --header "PRIVATE-TOKEN: <YOUR_GITLAB_TOKEN>" \
     --upload-file stm32f413.tar.gz \
     "https://gitlab.eclipse.org/api/v4/projects/5138/packages/generic/aidge_deploy_bsp_stm32f413/v1.2.5/stm32f413.tar.gz"

The Cortex-M exporter downloads that package while producing the project; aidge_deploy never accesses the registry.

Metadata

Release files for aidge-deploy 0.10.1

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

Built distribution (wheel)

Table of built distributions (wheels) for aidge-deploy 0.10.1
File Interpreter ABI Platform Actions
aidge_deploy-0.10.1-py3-none-any.whl Python 3 none any Details for aidge_deploy-0.10.1-py3-none-any.whl

Release files / aidge_deploy-0.10.1-py3-none-any.whl

Download URL aidge_deploy-0.10.1-py3-none-any.whl
Size 106.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3fde45a8d8ff2943b479160b419520a02eae331972967dd846505f39026284b3
BLAKE2b-256 checksum
How to use checksums
6d9b38f4b7483e6bff9f416efa4cf87d1f1910103e6bc7723064c7bf4691b13c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for aidge-deploy 0.10.1

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.

Release history Release notifications | RSS feed

This release

0.10.1 This release

1 release file No provenance

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