Skip to content

[K9VULN-14776] Emit pyproject manifest metadata#142

Draft
rjcoulter22 wants to merge 2 commits into
mainfrom
ryan.coulter/pyproject-version-ranges
Draft

[K9VULN-14776] Emit pyproject manifest metadata#142
rjcoulter22 wants to merge 2 commits into
mainfrom
ryan.coulter/pyproject-version-ranges

Conversation

@rjcoulter22
Copy link
Copy Markdown
Contributor

@rjcoulter22 rjcoulter22 commented May 5, 2026

Motivation

Manifest-only pyproject.toml scans need enough metadata for downstream SCA enrichment: ranged dependencies should keep their declared range, and manifest-only dependencies should be marked for transitive enrichment.

Documentation

Document Link or Detail
RFC Resolving version ranges for SCA
Incident N/A
Jira Ticket K9VULN-14776

Summary

Adds manifest-only dependency metadata for pyproject.toml scans.

  • Preserves exact pins as Version.
  • Preserves PEP 508 and Poetry ranges as VersionRange, including wildcard ranges like 1.*.
  • Emits datadog:version-range only for ranged dependencies.
  • Emits datadog:requires-transitive-enrichment=true for all emitted pyproject manifest dependencies.
  • Allows ranged manifest dependencies to emit with an empty CycloneDX version and unversioned PyPI PURL.

Testing

  • New tests were added for new logic.
  • Existing tests were updated for new logic.

Recovery

Notes for on-call - select only one:

  • The change can be rolled back.
  • Do not roll back. Why?:

@rjcoulter22 rjcoulter22 force-pushed the ryan.coulter/pyproject-version-ranges branch from ac79ebf to 08219ba Compare May 5, 2026 19:41
@datadog-prod-us1-4
Copy link
Copy Markdown

datadog-prod-us1-4 Bot commented May 5, 2026

🎯 Code Coverage (details)
Patch Coverage: 82.03%
Overall Coverage: 84.96% (-0.04%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 19880cc | Docs | Datadog PR Page | Give us feedback!

@rjcoulter22 rjcoulter22 changed the title [codex] Support pyproject version ranges Support pyproject version ranges May 6, 2026
@rjcoulter22 rjcoulter22 changed the title Support pyproject version ranges Support parsing pyproject for version ranges May 6, 2026
@rjcoulter22 rjcoulter22 force-pushed the ryan.coulter/pyproject-version-ranges branch 2 times, most recently from c343465 to a77c687 Compare May 6, 2026 20:34
@rjcoulter22 rjcoulter22 force-pushed the ryan.coulter/pyproject-version-ranges branch from a77c687 to 30e4a40 Compare May 14, 2026 15:03
@rjcoulter22 rjcoulter22 changed the title Support parsing pyproject for version ranges [K9VULN-14776] Emit pyproject manifest metadata May 14, 2026
@rjcoulter22 rjcoulter22 force-pushed the ryan.coulter/pyproject-version-ranges branch from 30e4a40 to f4cfddf Compare May 14, 2026 15:17
@rjcoulter22 rjcoulter22 force-pushed the ryan.coulter/pyproject-version-ranges branch from f4cfddf to 19880cc Compare May 14, 2026 15:31
@rjcoulter22
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19880cccce

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +252 to +254
Name: dependency.Name,
Version: dependency.Version,
VersionRange: dependency.VersionRange,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve distinct pyproject version ranges

When the same dependency name is declared with different pyproject constraints, this creates separate PackageDetails entries that all have an empty Version and only differ by VersionRange. Later sanitizeScannedPackages gives each of them the same unversioned PURL (for example pkg:pypi/requests), and purl.Group keys components by that PURL, so PackageMetadata.Merge keeps only the first version-range value and silently drops the other constraint. This produces an SBOM/API payload with an incorrect range whenever a package is constrained differently across prod/optional/dev groups or files; the range needs to be part of the grouping identity or the ranges need to be explicitly combined before grouping.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant