Description
Many Python projects, especially older or minimal ones, do not have a pyproject.toml file. In those cases, the current root-component metadata flow depends on --pyproject, which makes it difficult to generate an SBOM with the correct main component name and version unless a project metadata file is present.
This creates a gap for projects that are still valid Python applications or libraries but are not structured around PEP 621 metadata.
Solution
Add CLI support for explicitly setting the main component metadata when pyproject.toml is not available.
Specifically:
--mc-name: Set the main component name directly from the CLI
--mc-version: Set the main component version directly from the CLI
- Keep
--mc-type support for specifying the main component type
- Use directory-name fallback as a final fallback when neither explicit metadata nor
pyproject.toml is available
This should be supported for the requirements and environment subcommands, and should complement the existing --pyproject behavior rather than replacing it.
mc here stands for "main component".
Describe alternatives you've considered
- Inferring the root component name from the current directory name only
- Adding a custom config file for component metadata
Additional context
This is especially useful for legacy Python projects, simple scripts, or deployments where the project metadata is not stored in pyproject.toml, but the SBOM still needs a valid top-level component.
Contribution
Description
Many Python projects, especially older or minimal ones, do not have a
pyproject.tomlfile. In those cases, the current root-component metadata flow depends on--pyproject, which makes it difficult to generate an SBOM with the correct main component name and version unless a project metadata file is present.This creates a gap for projects that are still valid Python applications or libraries but are not structured around PEP 621 metadata.
Solution
Add CLI support for explicitly setting the main component metadata when
pyproject.tomlis not available.Specifically:
--mc-name: Set the main component name directly from the CLI--mc-version: Set the main component version directly from the CLI--mc-typesupport for specifying the main component typepyproject.tomlis availableThis should be supported for the
requirementsandenvironmentsubcommands, and should complement the existing--pyprojectbehavior rather than replacing it.mchere stands for "main component".Describe alternatives you've considered
Additional context
This is especially useful for legacy Python projects, simple scripts, or deployments where the project metadata is not stored in
pyproject.toml, but the SBOM still needs a valid top-level component.Contribution