Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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.0a1.tar.gz (194.4 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.0a1-py3-none-any.whl (103.1 kB view details)

Uploaded Python 3

File details

Details for the file fprime_python_model-3.3.0a1.tar.gz.

File metadata

  • Download URL: fprime_python_model-3.3.0a1.tar.gz
  • Upload date:
  • Size: 194.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for fprime_python_model-3.3.0a1.tar.gz
Algorithm Hash digest
SHA256 0b7cb8b1055c0c05cfb1e4b4a15deeccb343bf9e1d10ee910e8f904863ee1888
MD5 6cd57b4b49588fe4f641e36c9640aa55
BLAKE2b-256 6b9d25096120c2be771fed857ec235aa7e20e94bbdc6b82ca0534f09c606d5fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for fprime_python_model-3.3.0a1.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.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for fprime_python_model-3.3.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 13c5e0acc32af1445d77f99e868c10f26312c06b66aafba4b43a4b8a25b319ca
MD5 e347d41954f16eeef3de62a2e8b4b874
BLAKE2b-256 ee0e67dc949939d1b2de74168804590fcb85a051ef94849a09d873c08b838965

See more details on using hashes here.

Provenance

The following attestation bundles were made for fprime_python_model-3.3.0a1-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

3.3.1

2 files

3.3.0

2 files

This release

3.3.0a1 This release

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