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

Skip to content

Conversation

@wagoodman
Copy link
Contributor

PDM lock files represent the same logical package as multiple [[package]] entries when extras are used in the dependency tree. This differs from Poetry, which uses a single entry with conditional markers.

For example, when a project depends on coverage[toml], PDM generates:

[[package]]
name = "coverage"
version = "7.4.1"
# base package

[[package]]
name = "coverage"
version = "7.4.1"
extras = ["toml"]
dependencies = [
    "coverage==7.4.1",
    "tomli; python_full_version <= \"3.11.0a6\"",
]

Similarly, if different packages require different extras combinations (e.g., package[redis] and package[postgres]), PDM creates separate entries for each.

The fix in this PR merges pkg.Package instances for the same high-level/logical package together. Variants are captured in the metadata.

Changes

  • removed custom buildPdmRelationships() function and used the standard dependency specifier pattern used in other catalogers
  • added support for detecting and processing extras (added PythonPdmLockExtraVariant struct to represent extras combinations)
  • preserves full dependency strings including environment markers (e.g., ; python_version < "3").... these were being stripped
  • filters self-references in extras dependencies (e.g., coverage[toml] depending on coverage==7.4.1)

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

Signed-off-by: Alex Goodman <[email protected]>
Signed-off-by: Alex Goodman <[email protected]>
@wagoodman wagoodman added the bug Something isn't working label Nov 7, 2025
@github-actions github-actions bot added the json-schema Changes the json schema label Nov 7, 2025
@wagoodman wagoodman changed the title Fix Python PDM cataloging (support extras) Support extras statements in Python PDM cataloger Nov 10, 2025
Signed-off-by: Alex Goodman <[email protected]>
@wagoodman wagoodman marked this pull request as ready for review November 10, 2025 13:58
@wagoodman wagoodman requested a review from a team November 10, 2025 15:02
Signed-off-by: Alex Goodman <[email protected]>
@wagoodman wagoodman self-assigned this Nov 10, 2025
@wagoodman wagoodman added this to OSS Nov 10, 2025
@wagoodman wagoodman moved this to In Review in OSS Nov 10, 2025
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.

🟢 with single comment 😄

Signed-off-by: Alex Goodman <[email protected]>
Signed-off-by: Alex Goodman <[email protected]>
Signed-off-by: Alex Goodman <[email protected]>
@wagoodman wagoodman merged commit 7bf7bcc into main Nov 14, 2025
12 checks passed
@wagoodman wagoodman deleted the fix-pdm branch November 14, 2025 20:13
@github-project-automation github-project-automation bot moved this from In Review to Done in OSS Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working json-schema Changes the json schema

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants