Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@willmurphyscode
Copy link
Contributor

Because package names in METADATA files may have upper case like Werkzeug or Jinja2, but Syft artifacts have normalized names and are lower case, like werkzeug or jinja2, Syft would miss emitting dependency relationships. Therefore, normalize dependency names before comparing with existing artifacts.

Description

Syft's cataloging of venv/site-packages uses a dependency resolving post processor to compare the requires statements from the METADATA file to other python artifacts emitted and create relationships between them. However, the name comparison between the requires statements from the METADATA files was normalized via a different codepath than the artifact names, so there were missed relationships because, for example "Werkzeug" != "werkzeug".

Therefore, normalize the dependency names via the same normalization used for artifact names before building the relationships.

Fixes #4401

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have added unit tests that cover changed behavior
  • I have tested my code in common scenarios and confirmed there are no regressions
  • I have added comments to my code, particularly in hard-to-understand sections

Because package names in METADATA files may have upper case like
Werkzeug or Jinja2, but Syft artifacts have normalized names and are
lower case, like werkzeug or jinja2, Syft would miss emitting dependency
relationships. Therefore, normalize dependency names before comparing
with existing artifacts.

Signed-off-by: Will Murphy <[email protected]>
Copy link
Contributor

@spiffcs spiffcs left a comment

Choose a reason for hiding this comment

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

I couldn't think of any other cases to add - the tests are great and thanks for the quick fix to a triage bug 😄

@spiffcs spiffcs merged commit c958932 into main Nov 25, 2025
12 checks passed
@spiffcs spiffcs deleted the fix-normalize-python-dep-names branch November 25, 2025 15:20
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.

Syft: The dependency graph does not include all Requires-Dist relationships defined in the package’s METADATA file

3 participants