fpgather
Gather your FPGA sources. Build in order.
A Python package that recursively resolves sources.yml files and exports an
HDL build list. An external tool supplies module repositories at
target/dependency/<library>/<module> by default; the library root is
configurable. This package does not fetch repositories.
Installation
Requires Python 3.10 or newer:
python3 -m venv .venv
.venv/bin/python -m pip install -e '.[test]'
For the resolver and exporter alone, use pip install .. Their only runtime
dependency is PyYAML. The test extra installs pytest and VUnit.
Run the example
From the package directory:
.venv/bin/fpgather test/src/rtl/scripts/sources.yml \
--project-root test \
--work-lib-name top_lib \
--tool vunit \
--file-type csv \
--output test/build/vunit/sources.csv
Alternatively, use .venv/bin/python -m fpgather with the same arguments.
--project-rootlocates the project directory.--libraries-rootselects the directory containing the library folders. It defaults totarget/dependencyand accepts an absolute path or a path relative to--project-root. The same root applies at every inclusion depth.--work-lib-namesets the entry manifest's library. Its tool-independent default iswork. VUnit rejects that reserved name, so select a concrete name such astop_libfor VUnit.--libraryremains an alias.--toolselects the target tool;vunitandghdlare supported.--file-typeselects the output format, not a source suffix filter. Usecsvfor VUnit orshfor GHDL.--outputselects the CSV location. Each run regenerates the CSV and its.settings.jsoncompanion file.
The Python resolver has the corresponding default:
resolve(entry, project_root=root, library="work").
Pass libraries_root="vendor" to use <project-root>/vendor/<library>/,
or supply an absolute path to a shared library directory. The CLI equivalent
is --libraries-root vendor; source paths remain relative to their YAML file.
Additional tool/format combinations can be added to the registry in
src/fpgather/exporters.py without changing dependency resolution.
GHDL analysis
Export a Bash analysis script with --tool ghdl --file-type sh. Configure
--build-dir, --ghdl and repeatable --ghdl-option=FLAG arguments as needed.
Each source retains its language version by default. --ghdl-standard highest
uses the newest selected version for all sources; --ghdl-standard 2008
explicitly selects one common version. VUnit exports are unaffected.
See GHDL CLI and Python examples for a complete runnable example, standard compatibility, supported flags and build directory behavior.
Manifest format
syntax_version: 1
language_defaults:
".vhd": "2008"
".vhdl": "2008"
defines:
debug: true
target: xilinx
data_width: 32
sources:
- ../hdl/core.vhd
- ../hdl/debug.vhd:
if: debug
- ../hdl/legacy.vhd:
language_version: "93"
if:
data_width: 32
dependencies:
lib_a:
- module_a/src/rtl/scripts/sources.yml
- module_d/src/rtl/scripts/sources.yml:
if:
target: xilinx
syntax_versionis optional. Omitting it always means version 1, including after future upgrades. Explicit unsupported versions are rejected.- Source paths are relative to the YAML file containing them.
- Dependency paths are relative to
<libraries-root>/<library>/at every inclusion depth. The default is<project-root>/target/dependency/<library>/. - Each library can reference multiple manifests.
- Definitions are inherited by child manifests. Local definitions override inherited values only within that subtree; siblings are unaffected.
if: debugrequires booleantrue. A comparison mapping checks equality; multiple entries in that mapping are combined with AND.- Missing definitions and false conditions skip the entry. A skipped source or dependency file does not need to exist. Conditions do not execute code.
- Strings and numbers are not coerced, and
trueis distinct from1. - Language defaults apply only to sources in the declaring manifest.
A file's
language_versionoverrides its suffix default. Versions are strings. - Dependencies are processed first; list order is preserved. A shared source appears once per library. Conflicting versions, cycles, missing active files and invalid YAML produce errors with file context.
- Library names are normalized to lowercase; their directory names must match.
- An explicit stack supports deep inclusion graphs without Python recursion.
Original source paths
The CSV contains absolute paths to the original files, including their original suffixes. The exporter never copies, moves or renames HDL files. Only the CSV and its settings file are written.
In the supplied example, all six selected files remain under test/:
test/target/dependency/lib_b/module_b/src/rtl/hdl/module_b.vhd
test/target/dependency/lib_b/module_b/src/rtl/hdl/wide_datapath.vhd
test/target/dependency/lib_b/module_b/src/rtl/hdl/legacy.vhd
test/target/dependency/lib_a/module_a/src/rtl/hdl/module_a.vhd
test/target/dependency/lib_a/module_a/src/rtl/hdl/debug.vhd
test/src/rtl/hdl/top.vhd
The CSV prefixes these paths with the absolute package directory.
optional.vhd remains in its original directory but is excluded because
optional_feature is undefined. No source path points into test/build/.
CSV and settings can be stored in a temporary directory or moved together without rebasing source paths. Original sources must exist when imported.
Import into VUnit
The CSV has no header and exactly two columns: library,path.
It cannot represent per-file language versions or explicit source types.
For the supplied .vhd example, use the provided helper:
from vunit import VUnit
from fpgather.vunit import import_vunit_csv
vu = VUnit.from_argv(compile_builtins=False)
files = import_vunit_csv(vu, "test/build/vunit/sources.csv")
vu.main()
The helper reads sources.settings.json, passes each original path directly
to VUnit with file_type="vhdl" and its individual vhdl_standard, and adds
explicit dependencies to preserve the resolved order. A hash detects mismatched
CSV/settings. Original files are imported without changing their name or location.
VUnit's native add_source_files_from_csv(csv_path, vhdl_standard="2008")
works directly for recognized suffixes such as .vhd and .vhdl when one
common standard is sufficient. It does not infer VHDL from .hdl and
cannot apply individual language versions. The supplied .vhd fixture can be
imported directly with the native method. Use the helper to retain its mixed
VHDL-2008 and VHDL-1993 standards.
The VUnit exporter supports VHDL-1993, -2002, -2008 and -2019, including aliases
93, 02, 08 and 19. It treats .hdl as VHDL. Unsupported languages or
standards are rejected explicitly; the resolver itself is tool-independent.
Reference: VUnit CSV import.
Code style
Python code uses four-space indentation, a 79-character code line limit,
72-character comment and docstring lines,
snake_case functions and variables, PascalCase classes, grouped imports,
and type hints on public functions. Ruff formats the code and checks PEP 8
style, import ordering and common Python errors. Configuration lives in
pyproject.toml.
.venv/bin/python -m pip install -e '.[test,dev]'
.venv/bin/ruff format --check .
.venv/bin/ruff check .
To apply formatting, run .venv/bin/ruff format ..
Python testbench
.venv/bin/python -m pytest -q
.venv/bin/python test/run.py
Tests use isolated copies of the three-level fixture under test/ and check
typed conditions, inheritance, shared dependencies, language versions, errors,
more than 1,000 levels, CLI behavior, original absolute paths and actual VUnit
imports. Native CSV import is tested with recognized suffixes; the helper is
tested with original .vhd files and mixed standards.
test/run.py regenerates the example CSV, verifies selection and compile order,
checks native CSV import, imports the original paths with individual standards
and prints the final CSV.
This is a Python testbench for the resolver. The seven original HDL files are intentionally empty, so no HDL simulation is performed or required.
Continuous integration
GitHub Actions runs on pushes, pull requests and manual dispatches. CI checks
Ruff lint and formatting, runs the tests and VUnit import testbench on Python
3.10–3.14, and builds the wheel and source distribution. A dedicated GHDL job
uses ghcr.io/vhdlivery/docker-ghdl:6.0.0-1 and installs the current checkout
in a fresh Python environment. Package builds require this job to pass.
The Python matrix skips real GHDL tests when GHDL is unavailable.
The build job validates package metadata with Twine and checks the installed
wheel's CLI in a fresh environment. Successful builds are available as the
distributions workflow artifact for seven days. CI requires no repository
secrets and does not publish to PyPI. Publishing is handled separately below.
Publishing to PyPI
The release.yml workflow publishes when a GitHub release is published. It
checks that the release tag equals v followed by the version in
pyproject.toml, reruns the complete CI workflow on the release commit, and
uploads those validated distributions using PyPI Trusted Publishing.
Ordinary pushes and pull requests never publish packages.
One-time setup:
- Create a GitHub environment named
pypiin this repository's settings. - Sign in to PyPI and open
account publishing settings.
Add a pending GitHub publisher with these exact values:
- PyPI project:
fpgather - Owner:
VHDLivery - Repository:
fpgather - Workflow filename:
release.yml - Environment:
pypiFor an existing project you own, add it under that project's publishing settings instead. No API token or GitHub secret is required.
- PyPI project:
To release:
- Set the new version in
pyproject.toml, commit and push the release changes. - Publish a GitHub release with the matching tag, initially
v0.1.0, targeting that commit. Publishing the release triggers the PyPI upload. - Check the
Publish to PyPIworkflow, then verify the release withpython -m pip install fpgather==0.1.0in a fresh environment.
A pending publisher does not reserve the project name. PyPI distribution filenames cannot be reused; subsequent releases need a new version.
License
Copyright (c) 2026 VHDLivery. Released under the MIT License.
Author: VHDLivery — vhdlivery@gmail.com.
Metadata
Release files for fpgather 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fpgather-0.2.0.tar.gz | 32.5 kB | With provenance | Details for fpgather-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fpgather-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for fpgather-0.2.0-py3-none-any.whl |
Total release size: 50.3 kB
Release files / fpgather-0.2.0.tar.gz
| Download URL | fpgather-0.2.0.tar.gz |
|---|---|
| Size | 32.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6f5aad3c6f5ce9bf3394eae12adb64242ab844c35ecc0b7d0d98223b39356c9
|
|
BLAKE2b-256 checksum How to use checksums |
21d94b936e7f49cd55bac2efd80faa73f592d2910c386656bc9968af2e9567bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / fpgather-0.2.0-py3-none-any.whl
| Download URL | fpgather-0.2.0-py3-none-any.whl |
|---|---|
| Size | 17.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
44ef07ab85ef4f75b7e25b86e09ca3d5ce8cd2b4d256e51ac15963053650b615
|
|
BLAKE2b-256 checksum How to use checksums |
8984be26a2ffbf5f3ecc78f7d3da03dd39fa1e8a9f8fb49d949fcb5ff7495607
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logSecurity for fpgather 0.2.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for fpgather-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logA 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.