-
Notifications
You must be signed in to change notification settings - Fork 17
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
Adding basic framework for the CLI, no changes to old cli. #261
base: main
Are you sure you want to change the base?
Conversation
e1ca4e0
to
a5c9ead
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be interesting to see how the performance for (de)serializing larger SBOMs is -- it looks like that will need to happen for every command that gets ran?
Ran some timing on the
Update: Compared msgpack to json, and msgpack is a bit faster, mostly on the packing, but also on the other tasks.
|
f5041c0
to
8358a34
Compare
So pickling is in fact significantly faster if I pickle the class directly. I can't do this unless I take care of the mappingproxy type first, but with some very minimal pre and post processing it works
Timing results here:
|
8358a34
to
dae6e15
Compare
557b78a
to
f705999
Compare
f705999
to
2eae730
Compare
… cli load and cli save
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Co-authored-by: Ryan Mast <[email protected]>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Co-authored-by: Ryan Mast <[email protected]>
899c7d1
to
91f76c7
Compare
self.sbom_filename = "sbom_cli" | ||
self.subset_filename = "subset_cli" | ||
# Create data directory | ||
self.data_dir = self._get_cli_sbom_dir() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the function in the ConfigManager (https://github.com/LLNL/Surfactant/blob/main/surfactant/configmanager.py#L145) get used instead? I think the one difference is it uses Local AppData on Windows -- it doesn't get synchronized between multiple systems, which is probably okay (esp. if the SBOM happens to be very big).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: cli_save.py and cli_load.py are using a different docstring style than the other files.
sbom An internal record of sbom entries the class adds to as it finds more matches. | ||
subset An internal record of the subset of sbom entries from the last cli find call. | ||
sbom_filename: A string value of the filename where the loaded sbom is stored. | ||
subset_filename: A string value of the filename where the current subset result from the "cli find" command is stored. | ||
match_functions A dictionary of functions that provide matching functionality for given SBOM fields (i.e. uuid, sha256, installpath, etc) | ||
camel_case_conversions A dictionary of string conversions from all lowercase to camelcase. Used to convert python click options to match the SBOM attribute's case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sbom An internal record of sbom entries the class adds to as it finds more matches. | |
subset An internal record of the subset of sbom entries from the last cli find call. | |
sbom_filename: A string value of the filename where the loaded sbom is stored. | |
subset_filename: A string value of the filename where the current subset result from the "cli find" command is stored. | |
match_functions A dictionary of functions that provide matching functionality for given SBOM fields (i.e. uuid, sha256, installpath, etc) | |
camel_case_conversions A dictionary of string conversions from all lowercase to camelcase. Used to convert python click options to match the SBOM attribute's case | |
sbom: An internal record of sbom entries the class adds to as it finds more matches. | |
subset: An internal record of the subset of sbom entries from the last cli find call. | |
sbom_filename: A string value of the filename where the loaded sbom is stored. | |
subset_filename: A string value of the filename where the current subset result from the "cli find" command is stored. | |
match_functions: A dictionary of functions that provide matching functionality for given SBOM fields (i.e. uuid, sha256, installpath, etc) | |
camel_case_conversions: A dictionary of string conversions from all lowercase to camelcase. Used to convert python click options to match the SBOM attribute's case |
Summary
This MR adds the basic setup for the new non-interactive surfactant cli.
If merged this pull request will
surfactant cli load
commandsurfactant cli save
commandProposed changes
The changes here will migrate the existing cli interface to the new structure. Proposed workflow is below: