Canonical device-data pipeline and artifact generator for Alloy.
Project description
alloy-codegen
alloy-codegen is the source-of-truth pipeline for turning upstream device descriptions
into validated canonical hardware metadata and published alloy-devices artifacts for the
Alloy ecosystem.
The architecture is stage-oriented:
fetchpatchnormalizevalidateemitpublish
The canonical IR sits at the center of the system. Emitters consume validated IR; they do not recover missing semantics from raw vendor data.
Supported Targets
The repository currently supports these published families:
st/stm32g0,st/stm32f4microchip/same70,microchip/avr-danxp/imxrt1060raspberrypi/rp2040espressif/esp32,espressif/esp32c3,espressif/esp32s3
You can inspect the active support matrix directly from the CLI:
alloy-codegen targets
alloy-codegen targets --json
The default scope remains st/stm32g0 when no --vendor, --family, or --device is
provided.
Published Device Matrix
The alloy-devices repository carries a top-level README.md that lists every admitted
(vendor, family) pair plus its devices, packages, and peripherals. This file is auto-
generated by alloy-codegen on every publish — do not edit it manually. It reads
DEVICE_REGISTRY and the family/device patches and stays in sync without operator effort.
Each family can surface a one-line caveat in the auto-generated table by setting
__source_notes.__readme_caveat in its family.json (the field is optional; families
without it are simply omitted from the "Coverage caveats" section).
Selective publish — affected-families detection
Once 9 families turns into 100+, re-publishing every family on every push is wasteful.
The publish workflow runs a detect-affected job that maps the git diff to the subset of
admitted families whose inputs the commit actually changed:
| Path pattern (first match wins) | Families published |
|---|---|
patches/<vendor>/<family>/** |
only that family |
src/alloy_codegen/sources/<adapter>.py |
families that consume that adapter |
src/alloy_codegen/runtime_xtensa_startup.py |
xtensa families |
src/alloy_codegen/runtime_riscv_startup.py |
RISC-V families |
src/alloy_codegen/runtime_avr_startup.py |
AVR families |
src/alloy_codegen/runtime_startup.py |
Cortex-M families |
Other src/alloy_codegen/**.py |
all admitted families (conservative) |
tests/**, openspec/**, *.md, bootstrap-family.yml |
none (publish is skipped entirely) |
publish-alloy-devices.yml, pyproject.toml, uv.lock |
all admitted families |
Unknown / git diff failure |
all admitted families (safe default) |
Inspect what the heuristic would publish for the current diff:
alloy-codegen affected-families --since HEAD~1 --plain
To force a full-matrix run (e.g. cache invalidation, security re-publish), trigger the
publish workflow via gh workflow run (or the Actions UI) with force_all=true.
Quick Start
Install the project in editable mode:
python3 -m pip install -e .
Inspect supported targets:
alloy-codegen targets
Validate one existing family using local source overrides:
alloy-codegen validate \
--vendor microchip \
--family same70 \
--source microchip-dfp-extract=/path/to/Microchip.SAME70_DFP.extract \
--json
Publish one family into a local alloy-devices checkout:
alloy-codegen publish \
--vendor st \
--family stm32g0 \
--source cmsis-svd-data=/path/to/cmsis-svd-data \
--source stm32-open-pin-data=/path/to/stm32-open-pin-data \
--publication-root /path/to/alloy-devices \
--alloy-root /path/to/alloy \
--json
Source Overrides
Each family declares a logical source bundle in src/alloy_codegen/bootstrap.py. Source
paths can be provided either with repeated --source SOURCE_ID=PATH flags or with
environment variables of the form ALLOY_CODEGEN_SOURCE_<SOURCE_ID>_ROOT.
Examples:
cmsis-svd-data->ALLOY_CODEGEN_SOURCE_CMSIS_SVD_DATA_ROOTstm32-open-pin-data->ALLOY_CODEGEN_SOURCE_STM32_OPEN_PIN_DATA_ROOTmicrochip-dfp-pack->ALLOY_CODEGEN_SOURCE_MICROCHIP_DFP_PACK_ROOTmicrochip-dfp-extract->ALLOY_CODEGEN_SOURCE_MICROCHIP_DFP_EXTRACT_ROOTnxp-mcux-soc-svd->ALLOY_CODEGEN_SOURCE_NXP_MCUX_SOC_SVD_ROOTnxp-mcux-sdk->ALLOY_CODEGEN_SOURCE_NXP_MCUX_SDK_ROOT
Documentation
Repository Responsibilities
src/alloy_codegen/bootstrap.py: supported target registry and source bundlessrc/alloy_codegen/sources/: upstream source adapterspatches/<vendor>/<family>/: curated family and device overlaystests/fixtures/: reproducible upstream snapshots and canonical fixtures.github/workflows/publish-alloy-devices.yml: remote publication matrix
SAME70 Note
microchip/same70 already participates in the same publish flow as the other families and
publishes runtime-lite artifacts under generated/runtime/ plus
generated/runtime/devices/<device>/driver_semantics/. If local publication fails while
trying to download the Microchip pack, prefer a microchip-dfp-extract override first; the
CI workflow publishes from a clean environment with working TLS roots.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file alloy_codegen-0.5.0.tar.gz.
File metadata
- Download URL: alloy_codegen-0.5.0.tar.gz
- Upload date:
- Size: 23.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
226a0a29aea8639d0aea13e91394e117d1a8f0cd99134bd74fdd3e93e5a91794
|
|
| MD5 |
1b804bfa87d87630491383219f518bf7
|
|
| BLAKE2b-256 |
b638694be52d0956661d1c16dc3115eb150ccf80b630f47efa2475b83e653462
|
Provenance
The following attestation bundles were made for alloy_codegen-0.5.0.tar.gz:
Publisher:
release.yml on Alloy-Embedded/alloy-codegen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alloy_codegen-0.5.0.tar.gz -
Subject digest:
226a0a29aea8639d0aea13e91394e117d1a8f0cd99134bd74fdd3e93e5a91794 - Sigstore transparency entry: 1436525162
- Sigstore integration time:
-
Permalink:
Alloy-Embedded/alloy-codegen@be1dda9eca5c9817e8a33d8b9ed8e06e26655006 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/Alloy-Embedded
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@be1dda9eca5c9817e8a33d8b9ed8e06e26655006 -
Trigger Event:
push
-
Statement type:
File details
Details for the file alloy_codegen-0.5.0-py3-none-any.whl.
File metadata
- Download URL: alloy_codegen-0.5.0-py3-none-any.whl
- Upload date:
- Size: 130.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4c05859416982f0b4d7926573f2278e398b918e5d3f1108bcd8e9eae7a31904
|
|
| MD5 |
f743d988b96b17b86dbd1efbd7ba112a
|
|
| BLAKE2b-256 |
2991af3c81d2aa5495dae6592da6bde1c85b6e6cec4fdc2ad63e3cda88771339
|
Provenance
The following attestation bundles were made for alloy_codegen-0.5.0-py3-none-any.whl:
Publisher:
release.yml on Alloy-Embedded/alloy-codegen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alloy_codegen-0.5.0-py3-none-any.whl -
Subject digest:
d4c05859416982f0b4d7926573f2278e398b918e5d3f1108bcd8e9eae7a31904 - Sigstore transparency entry: 1436525324
- Sigstore integration time:
-
Permalink:
Alloy-Embedded/alloy-codegen@be1dda9eca5c9817e8a33d8b9ed8e06e26655006 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/Alloy-Embedded
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@be1dda9eca5c9817e8a33d8b9ed8e06e26655006 -
Trigger Event:
push
-
Statement type: