Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fpp-to-json utilities #207

Merged
merged 13 commits into from
Aug 1, 2024
Merged

Conversation

mosa11aei
Copy link
Contributor

@mosa11aei mosa11aei commented Jun 28, 2024

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).

src/fprime/fpp/utils/fpp_to_json/parser.py Fixed Show fixed Hide fixed
src/fprime/fpp/utils/fpp_to_json/parser.py Fixed Show fixed Hide fixed
src/fprime/fpp/utils/fpp_to_json/parser.py Fixed Show fixed Hide fixed
src/fprime/fpp/utils/fpp_to_json/writer.py Fixed Show fixed Hide fixed
src/fprime/fpp/utils/fpp_to_json/writer.py Fixed Show fixed Hide fixed
src/fprime/fpp/utils/fpp_to_json/parser.py Fixed Show fixed Hide fixed
src/fprime/fpp/utils/fpp_to_json/parser.py Fixed Show fixed Hide fixed
src/fprime/fpp/utils/fpp_to_json/parser.py Fixed Show fixed Hide fixed
src/fprime/fpp/utils/fpp_to_json/parser.py Fixed Show fixed Hide fixed
@mosa11aei

This comment was marked as outdated.

@LeStarch LeStarch self-requested a review July 25, 2024 18:02
LeStarch
LeStarch previously approved these changes Jul 25, 2024
Copy link
Collaborator

@LeStarch LeStarch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

src/fprime/fpp/utils/fpp_to_json/helpers.py Fixed Show fixed Hide fixed
src/fprime/fpp/utils/fpp_to_json/helpers.py Fixed Show fixed Hide fixed
self.cg_JSON = cg.ast[1]
self.cg_struct.postannot = cg.ast[2]

def convert(self):

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
@mosa11aei mosa11aei requested a review from LeStarch July 25, 2024 21:22
Copy link
Contributor

@thomas-bc thomas-bc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@mosa11aei
Copy link
Contributor Author

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
Copy link
Collaborator

bocchino commented Aug 1, 2024

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.

@thomas-bc thomas-bc merged commit a22b5f4 into nasa:devel Aug 1, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants