Skip to main content

fprime-fpp-python

Native Python bindings to the FPP compiler. Installed as fprime-fpp-python, imported as fpp.

The extension binds directly to the Rust FPP compiler via PyO3.

Installation

pip install fprime-fpp-python

An abi3 wheel, usable on CPython ≥ 3.10. Building from source needs Rust ≥ 1.85 and maturin.

Usage

import fpp

model = fpp.analyze(source="""
module M {
  array Arr = [4] U32
  constant answer = 6 * 7
}
""")

model.has_errors                             # False
for d in model.diagnostics:
    d.level                                  # fpp.DiagnosticLevel.Error
    print(d.display)                         # 'path:line:col: error: message'
    print(d)                                 # the compiler's console rendering

(unit,) = model.ast                          # one translation unit per input
(module,) = unit.members                     # fpp.ast.DefModule
[type(m).__name__ for m in module.members]   # ['DefArray', 'DefConstant']

arr = model.lookup("M.Arr")                                     # Symbol.ArrayType
arr.definition.resolved_type.array_size                         # 4
model.lookup("M.answer").definition.value.resolved_value.value  # 42

All inputs to one call are analyzed together. A bare string is a path, source= is text, and imports= — the counterpart of fpp-to-cpp -i — is analyzed the same way but is not part of what you asked about:

model = fpp.analyze(["MyComponent.fpp"], imports=["Fw/Fw.fpp"])
[u.uri for u in model.ast if u.is_source]    # ['MyComponent.fpp']

parse is the fast front end: it stops after include resolution, so you get syntax and nothing resolved.

tree = fpp.parse(["A.fpp", "B.fpp"])
[u.uri for u in tree.units]                  # ['A.fpp', 'B.fpp']

The syntax tree lives in the fpp.ast submodule — one class per grammar production, plus the AstNode base and the enums the grammar spells (fpp.ast.IntegerKind, fpp.ast.ComponentKind). fpp itself is the analysis: Model, Analysis, the symbol/type/value unions, and the semantic entities. The split is what lets both keep the compiler's own names, since three of them belong to each — fpp.Connection is the analyzed connection, fpp.ast.Connection the syntax it came from.

from fpp.ast import DefArray

isinstance(module.members[0], DefArray)      # True
type(module.members[0]).__module__           # 'fpp.ast'

Subclass fpp.AstVisitor — it takes AST nodes, but it is an entry point, so it stays in fpp beside analyze — and override visit_<type(node).__name__>. Traversal is deep by default: super() descends, omitting it prunes.

class Constants(fpp.AstVisitor):
    def __init__(self):
        self.values = {}

    def visit_DefConstant(self, node):
        self.values[node.name] = node.value.resolved_value.value
        super().visit_DefConstant(node)

consts = Constants()
consts.visit(model)                          # or a SyntaxTree, TransUnit, or node
consts.values                                # {'answer': 42}

Semantic types are closed unions.

match arr.definition.resolved_type:
    case fpp.Type.Array() as a:
        elt = a.anon_array.elt_type
        isinstance(elt, fpp.Type.PrimitiveInt) and elt.value == fpp.ast.IntegerKind.U32

Annotate with <Base>.Variant — fpp.Type.Variant, fpp.Value.Variant — rather than the base class. It is the closed union over the variants, so a type checker can tell you which case you forgot.

def describe(v: fpp.Value.Variant) -> str:
    match v:
        case fpp.Value.Integer():
            return f"integer {v.value}"
        case fpp.Value.String():
            return f"string {v.value}"
        ...
        case _:
            typing.assert_never(v)   # fails while any variant is unhandled

Findings of your own report like compiler errors: build a Diagnostic against any node's span, add child annotations and notes, and print it.

node = model.lookup("M.answer").definition
print(fpp.Diagnostic(
    "answer is unused", level=fpp.DiagnosticLevel.Warning,
    span=node.span,
    children=[fpp.DiagnosticMessage("delete it")],
))
#  --> mem.fpp:4:3
#   |
# 4 |   constant answer = 6 * 7
#   |   ^^^^^^^^^^^^^^^^^^^^^^^ answer is unused
#   |
#   = note: delete it

A check can raise its finding instead of returning it: fpp.DiagnosticError carries a Diagnostic, and everything on that diagnostic stays writable, so each handler on the way out can add the context it knows.

try:
    check_component(instance.component)
except fpp.DiagnosticError as error:
    error.diagnostic.add_note("in this instance", span=instance.node.span)
    raise

Development

A Cargo workspace member of fpp-tools. The node wrappers and the recording walk are expanded by fpp_python_macros from checked-in declarations (src/ast/defs.rs, src/sem/defs.rs); the core (pipeline, ir_core, lower_core, noderef, model, visitor, diagnostics) is hand-written.

Those declarations and the two stubs are generated and checked in. Change the generator or the macro, never the file, and re-run make. CI fails on drift.

maturin develop            # build + install into the active venv
pytest tests/              # run the tests

make nightly               # one-time: the nightly the bindgen's rustdoc needs
make                       # regenerate the declarations, then the stubs
make help                  # the individual codegen targets

The bindgen reflects fpp_analysis from rustdoc JSON, whose schema is unstable, so the nightly is pinned exactly — in fpp_python_bindgen/nightly-toolchain alongside the rustdoc-types pin in its Cargo.toml. Bump the two together. FPP_BINDGEN_TOOLCHAIN overrides the toolchain for a one-off run.

Metadata

Release files for fprime-fpp-python 4.0.1

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

Source distribution (sdist)

Source distribution for fprime-fpp-python 4.0.1
File Size Uploaded Provenance Actions
fprime_fpp_python-4.0.1.tar.gz 669.1 kB With provenance Details for fprime_fpp_python-4.0.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for fprime-fpp-python 4.0.1
File Actions
fprime_fpp_python-4.0.1-cp310-abi3-win_arm64.whl CPython 3.10 abi3 Windows ARM64 Details for fprime_fpp_python-4.0.1-cp310-abi3-win_arm64.whl
fprime_fpp_python-4.0.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for fprime_fpp_python-4.0.1-cp310-abi3-win_amd64.whl
fprime_fpp_python-4.0.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for fprime_fpp_python-4.0.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
fprime_fpp_python-4.0.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for fprime_fpp_python-4.0.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
fprime_fpp_python-4.0.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for fprime_fpp_python-4.0.1-cp310-abi3-macosx_11_0_arm64.whl
fprime_fpp_python-4.0.1-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for fprime_fpp_python-4.0.1-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 15.2 MB

Release files / fprime_fpp_python-4.0.1.tar.gz

Download URL fprime_fpp_python-4.0.1.tar.gz
Size 669.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3193c26c4787d9eb7b3777137942f295795400982d56059ff1638c1ee4906135
BLAKE2b-256 checksum
How to use checksums
147fd0ab219c367418bb2c6ca1340141f2c6c20095f0f40bad9b5d0c2cfd45d6
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 10, 2026.

Transparency log

Release files / fprime_fpp_python-4.0.1-cp310-abi3-win_arm64.whl

Download URL fprime_fpp_python-4.0.1-cp310-abi3-win_arm64.whl
Size 2.2 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
401c467221f4a8a8c1e7623d792c1136977c9eddbc8f7c8faa870b9cdbdc55c0
BLAKE2b-256 checksum
How to use checksums
fe0366d68ab6c3f1dd1bf6fdcd76f01036e5f2f3d833ced006bf4966822e5751
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 10, 2026.

Transparency log

Release files / fprime_fpp_python-4.0.1-cp310-abi3-win_amd64.whl

Download URL fprime_fpp_python-4.0.1-cp310-abi3-win_amd64.whl
Size 2.5 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ebbaa83403fbe5debb02851944384b557ff645e554f072b487cd0a2e7dd96b81
BLAKE2b-256 checksum
How to use checksums
a7b0ba9517019567585c4d2b6f7a8385e6d9338766650457a67358514b20c179
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 10, 2026.

Transparency log

Release files / fprime_fpp_python-4.0.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL fprime_fpp_python-4.0.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 2.6 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
98aaec573428c7ede5a2ca68567a2af39b7860a2b783b27e3dc200af5fba6891
BLAKE2b-256 checksum
How to use checksums
fc435c4c956c80a2c1433356d9baf5c97724a64c0409cc4f98c9084c163c1340
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 10, 2026.

Transparency log

Release files / fprime_fpp_python-4.0.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL fprime_fpp_python-4.0.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 2.5 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
f4b113303e580c079095ab62bb8dd791bbc9a446f4ffcb98271a62be8390e10d
BLAKE2b-256 checksum
How to use checksums
ddafedec83a122db0265c5520ea5b290dbeb69458a102708527760b60af8b2c7
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 10, 2026.

Transparency log

Release files / fprime_fpp_python-4.0.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL fprime_fpp_python-4.0.1-cp310-abi3-macosx_11_0_arm64.whl
Size 2.3 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e038b5da9fbcea7718fc4712a7fae356046f7d607584cf1ceb24bd84870e0192
BLAKE2b-256 checksum
How to use checksums
808482fb3b871f079060bcfc4d20b5eecc987bf73caff6f817524f8ee395cd02
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 10, 2026.

Transparency log

Release files / fprime_fpp_python-4.0.1-cp310-abi3-macosx_10_12_x86_64.whl

Download URL fprime_fpp_python-4.0.1-cp310-abi3-macosx_10_12_x86_64.whl
Size 2.5 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
e85a848ed48fe770c2b691c46efa617c997ed21e179d0815c0b73baa7c6a063b
BLAKE2b-256 checksum
How to use checksums
09f3609c3f464face27aca38d9ef31a08a7befd20980cacf3276ff14ef0a9fe3
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 10, 2026.

Transparency log

Security for fprime-fpp-python 4.0.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.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for fprime_fpp_python-4.0.1.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 10, 2026.

Transparency log

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.

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