Repository navigation
Conversation
…t for CycloneDX 1.7 When CycloneDX 1.7 or later is requested, `cyclonedx-py environment` adds the Python runtime of the analyzed environment as a component with `type=platform` and `isExternal=true`, named `python` and versioned like `3.13.5`. The version is taken from the analyzed interpreter. If a root component is known, it depends on the runtime component. The implementation (CPython, PyPy, etc.) is intentionally not recorded. Requires `cyclonedx-python-lib` with `Component.is_external` (>= 11.12); with older versions of the lib, the runtime component is omitted. Resolves CycloneDX#597 Signed-off-by: juliosuas <juliosuas@users.noreply.github.com>
Documentation build overview
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | ✅ 14 (≤ 20 complexity) |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Early draft to showcase the results for #597, as suggested in #597 (comment).
Implements the expected outcome from #597 (comment) for
cyclonedx-py environmentonly:when CycloneDX 1.7 is requested, the Python runtime of the analyzed environment is added as a component with
type=platformandisExternal=true.Example (
cyclonedx-py environment --sv 1.7 --pyproject pyproject.toml .venv):Behavior:
--sv 1.6).nameispython,versionisplatform.python_version()of the analyzed interpreter. For a target<python>(and for-S/-Ewithout a target) the version is probed from that interpreter with the same flags as the path detection. The implementation (CPython, PyPy, etc.) is not recorded.--pyproject), it depends on the runtime component. Without a root component, the runtime appears as a standalone node in the dependency graph.isExternalneedscyclonedx-python-lib>=11.12. The supported range stays>=8, <12; with an older lib the runtime component is omitted, so nothing breaks.poetry,requirementsandpipenvare not covered in this draft.Details open for discussion:
environmentonly, or shouldpoetry/requirements/pipenvalso emit the runtime component (e.g. frompython-requires/ markers) in this PR or a follow-up?--sv 1.7, or behind an explicit switch?bom-refvaluepython-runtime.is_externalvs. raising the lib floor to>=11.12.Tests:
CDX_TEST_RECREATE_SNAPSHOTS=1. The runtime version is normalized intests/__init__.py(pythonVersion-testing), so snapshots do not depend on the interpreter running the tests.-S,-E); omitted for spec versions < 1.7; omitted when the lib lacksis_external.docs/usage.rst, environment section.Resolves or fixes issue: #597
AI Tool Disclosure
Grok Bot (coding agent)not exposed by the toolImplement the expected outcome from #597 (python runtime as type=platform, isExternal=true, CycloneDX 1.7) in "cyclonedx-py environment" only, following CONTRIBUTING.md; regenerate snapshots; add tests and docs.I reviewed the changes and ran the test suite and linters locally.Affirmation