Repository navigation
Closed
Description
Some tools distinguish between regular runtime dependencies and other dependencies that are only needed during development phases (like building, linting, testing, etc.).
There should be an option to omit those non-runtime-dependencies from the SBOM.
This feature is seen as essential for this very tool, since this very tool analyses the source information in the first place, so it already should know the group/category of a dependency.
Scope:
poetry- knows a "dev" categorypipenv- knows a "develop" group
Out of scope:
environment- no possible way to distinguish purpose of installationrequirements- the file is already a whitelist. It's in it what is in it.conda- does not support dev dependencies. Or does it?
Solution:
- CLI gets a new option
--omitwhich accepts (choices) currently only one value:dev.
As more such options might come later, this option can be used multiple times (useparser.add_argument(..., action='append'))
State that the "omit" might not be fully supported by all information sources. - Implementation
CycloneDxCmd- Is responsible for parsing the option for
omit. Is also responsible for translating this option to the correct values of the respective*Parserclasses. - creates instances of
PoetryParserwith the according value foromit_category. If the option foromitcontaineddevthen,devis added to theomit_group. - creates instances of
PipEnvParserwith the according value foromit_group. If the option foromitcontaineddevthen,developis added to theomit_group.
- Is responsible for parsing the option for
PoetryParser- has a new
omit_category: Set[str]parameter. - filter packages based on
omit_category. - See also [POETRY] option to omit dev-requirements #374
- has a new
PipEnvParser- has a new
omit_group: Set[str]parameter. - filter packages based on
omit_group.
- has a new
- Docs (
README.md&./docs/**)- new CLI switch was added to "usage"
Requirements to the tests:
- the existing test-fixtures were extended by development requirements.
- existing tests were extended to expect the development requirements.
- new tests were written, that use the new
omitfilters, and the results tests, that the unexpected results are not included.
Reacted by Tristan Keen
Activity
[-]Feat: omit dev dependencies.[/-][+]Feat: omit development dependencies from SBOM results[/+]tngraf commentedon Mar 9, 2023
Very good description on what needs to be done.
But there is one unanswered question: the current implementation of
PoetryParserincludes by default the dev dependencies. The current implementation ofPipEnvParserdoes not include the dev dependencies.So if we add omit_group to
PipEnvParserand no omit value is given, do we then want to include the dev dependencies? This would break the current behavior.Proposal:
--omit dev.jkowalleck commentedon Mar 9, 2023
alternative:
how does this sound?
The property could be property ala
cdx:poetry:component:category = whatever-it-is. if applied, register to https://github.com/CycloneDX/cyclonedx-property-taxonomy/blob/main/cdx/poetry.mdThe property could be property ala
cdx:poetry:pipenv:group= whatever-it-is. if ap[plied, register a new taxonomy https://github.com/CycloneDX/cyclonedx-property-taxonomyBreaking changes? Then we just release a new major version. Embrace change, drive forward.
JCHacking commentedon Oct 13, 2023
Note that poetry now includes dependency groups, in fact the development dependencies option is deprecated in favor of using dependency groups
https://python-poetry.org/docs/master/managing-dependencies/#dependency-groups
jkowalleck commentedon Oct 14, 2023
noted, and already properly implmented:
cyclonedx-python/cyclonedx_py/parser/poetry.py
Lines 36 to 41 in e277819
cyclonedx-python/cyclonedx_py/parser/poetry.py
Lines 76 to 79 in e277819
jkowalleck commentedon Dec 25, 2023
fixed by #605
jkowalleck commentedon Dec 25, 2023
This feature will be part of the next/upcoming major release.
Changelog: see #605
Install via:
pip install cyclonedx-bom==4.0.0rc1