nasa / fprime-tools

F´ Python tooling and helpers.
https://github.com/nasa/fprime
Apache License 2.0
20 stars 38 forks source link

Add fpp-to-json utilities #207

Closed mosa11aei closed 1 month ago

mosa11aei commented 3 months ago
Related Issue(s) n
Has Unit Tests (y/n) n
Documentation Included (y/n) y

Change Description

The following PR implements some utilities for using fpp-to-json with Python, specifically an abstract syntax tree (AST) converter and an FPP writer. The utilities have been made broad enough to be able to add visitors for different AST output types (i.e., XML).

mosa11aei commented 2 months ago

Do not merge yet; still needs a bit of refactoring.

mosa11aei commented 1 month ago

Would it be useful to add an entrypoint to fprime-util to have e.g. fprime-util fpp-to-json ? Or is the goal to generate the JSON stuff in the build cache as part of the build process?

So this utility is a parser and data type converter from the abstract syntax tree to Python. Because of this, it is not a CLI that you run to use fpp-to-json, rather you import the visitors and apply them to a given AST (which can be obtained any which way one wants).

In general it may be nice to include a fpp-to-json entry point, which calculates dependencies alongside running the analysis. What use case are you thinking?

bocchino commented 1 month ago

Would it be useful to add an entrypoint to fprime-util to have e.g. fprime-util fpp-to-json ?

I don't think fpp-to-json is a user-facing tool. It's a tool that developers can use to build other tools.