Skip to content

feat: support explicit main component metadata for projects without pyproject.toml #1105

Description

@abhijit24learning

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

  • [ x ] I am willing to provide an implementation
  • I will wait until somebody else implements it

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions