-
Notifications
You must be signed in to change notification settings - Fork 30
feat: add dependency resolution for Python #748
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
Conversation
cb230a1 to
9dd8f1a
Compare
3e6e840 to
4e2c3ab
Compare
| ) | ||
| ) | ||
|
|
||
| def remove_sboms(self, dir_path: str) -> bool: |
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 might not be relevant to this PR, but it looks to me that the return value of this method is not used anywhere.
The only place where this method is being used (as far as I know) -
| dep_analyzer.remove_sboms(main_ctx.component.repository.fs_path) |
I guess we could consider remove the return value of this method if we are not using it.
For this method, is the reason we always return True is because cyclonedx-py only produces one file as we specified from the command line options, instead of producing bom.json in multiple directories like for mvn and gradle?
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.
Yes, that's correct. Cyclonedx-py does not behave like maven and gradle cyclonedx plugins and does not produce bom files in the target repo.
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.
I think having a comment here stating that there are no files to remove would be useful.
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.
See commit a300d7d
50b5669 to
799e750
Compare
de28baf to
e368ee0
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.
LGTM. Thanks for the changes!
Signed-off-by: behnazh-w <behnaz.hassanshahi@oracle.com>
Signed-off-by: behnazh-w <behnaz.hassanshahi@oracle.com>
Signed-off-by: behnazh-w <behnaz.hassanshahi@oracle.com>
Signed-off-by: behnazh-w <behnaz.hassanshahi@oracle.com>
Signed-off-by: behnazh-w <behnaz.hassanshahi@oracle.com>
Signed-off-by: behnazh-w <behnaz.hassanshahi@oracle.com>
…test Signed-off-by: behnazh-w <behnaz.hassanshahi@oracle.com>
Signed-off-by: behnazh-w <behnaz.hassanshahi@oracle.com>
e368ee0 to
a300d7d
Compare
This PR adds a new feature to automatically analyze the dependencies of a Python package by providing the path to environment where the package is installed: `run_macaron.sh analyze -purl pkg:pypi/django@5.0.6 --python-venv <path-to-the-virtual-environment>` To implement this feature, it was necessary to detect the target software component in an SBOM to find its dependencies. So, the metadata section of an SBOM is only required for multi-module Java projects and for other projects we should be able to resolve the dependencies even if metadata is not present in the SBOM. To enhance the processing of the SBOMs, two new dependencies are added: * cyclonedx-bom * cyclonedx-python-lib cyclonedx-bom is used to automatically generate the SBOM from a virtual environment and cyclonedx-python-lib is used to improve deserialization of SBOMs and processing the components. Signed-off-by: behnazh-w <behnaz.hassanshahi@oracle.com>
This PR adds a new feature to automatically analyze the dependencies of a Python package by providing the path to environment where the package is installed:
metadatasection of an SBOM is only required for multi-module Java projects and for other projects we should be able to resolve the dependencies even ifmetadatais not present in the SBOM.cyclonedx-bomis used to automatically generate the SBOM from a virtual environment andcyclonedx-python-libis used to improve deserialization of SBOMs and processing the components.DependencyAnalyzerclass has CycloneDX-specific implementations, I have moved it to thecyclonedx.pymodule to avoid confusions.get_purl_from_cdx_componentto customize how a PURL should be constructed.Closes #429