Skip to main content

F Prime Python Model

F Prime Python Model is a utility for translating fpp-to-json AST, Location Map, and Analysis JSON to Python data structures. For more information on the fpp-to-json tool, see the FPP User's Guide.

Installation

pip install git+https://github.com/fprime-community/fprime-python-model.git

Usage

In order to use this utility, you must first run the fpp-to-json tool to generate the AST, Location Map, and Analysis JSON files for a given FPP model.

  • When using fpp-to-json as part of a larger project, you can set FPRIME_ENABLE_JSON_MODEL_GENERATION=ON in your settings.ini to generate JSON files automatically.

  • For specific steps on how to run fpp-to-json manually, see the FPP User's Guide.

    Note: When running the fpp-to-json tool, ensure that you do not include the -s option as that will prevent the Analysis JSON from being generated.

Once the AST, Location Map, and Analysis JSON files have been generated, you can translate the model JSON to it's Python representation by doing:

from fprime_python_model.model import FprimePythonModel

model = FprimePythonModel(
    ast_file_path, # Path to AST JSON file
    locations_file_path, # Path to Location Map JSON file
    analysis_json_file_path # Path to Analysis JSON file
)

Once an FprimePythonModel is constructed, you can access the python data structures that represent the FPP AST, Location Map, and Analysis of the model:

model.ast # Model AST
model.location_map # Location map
model.analysis # Model Analysis data structure

Traversing AST

You can traverse AST nodes by writing an AST visitor, which can be used to query or search the AST of a model. An AST visitor base class (AstVisitor) is provided in fprime_python_model/utils/fpp_ast_visitor.py.

Examples of how the AstVistor is used in this project are:

  • fprime_python_model/utils/fpp_ast_writer.py, which is used to print the AST to the console
  • fprime_python_model/translators/construct_ast_id_map.py, which is used to create a mapping from AST IDs to AST nodes.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fprime_python_model-3.3.1.tar.gz (194.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fprime_python_model-3.3.1-py3-none-any.whl (103.4 kB view details)

Uploaded Python 3

File details

Details for the file fprime_python_model-3.3.1.tar.gz.

File metadata

  • Download URL: fprime_python_model-3.3.1.tar.gz
  • Upload date:
  • Size: 194.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fprime_python_model-3.3.1.tar.gz
Algorithm Hash digest
SHA256 f2140b4d9dfaa5bbad113fcb4235d2b724a4351dd10b4ad778542f2343287bc8
MD5 8b15f882c12c201a997cf9edcaaf8ed3
BLAKE2b-256 25be4993279add321aea27b1587bd093b5816ff3e1012907211de6122666ac94

See more details on using hashes here.

Provenance

The following attestation bundles were made for fprime_python_model-3.3.1.tar.gz:

Publisher: publish.yml on fprime-community/fprime-python-model

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

File details

Details for the file fprime_python_model-3.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fprime_python_model-3.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d13d0e7fd9917b723654280ba79c4767384718b460ac5ef6471ec73518d5b540
MD5 f998e2dfbb8de0d2c09284b9c9a39c4f
BLAKE2b-256 2622dedff63e19f32a5d8f056f5d6a536bc5c7aac5f54e5c3d241055f6a815ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for fprime_python_model-3.3.1-py3-none-any.whl:

Publisher: publish.yml on fprime-community/fprime-python-model

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

Release history Release notifications | RSS feed

This release

3.3.1 This release

2 files

3.3.0

2 files

Supported by

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