[ANE-2877] Support PEP 621 project.dependencies in Poetry 2.x strategy#1683
Draft
[ANE-2877] Support PEP 621 project.dependencies in Poetry 2.x strategy#1683
Conversation
Poetry 2.x introduced PEP 621 support, allowing production dependencies to be declared in the project.dependencies section instead of the legacy tool.poetry.dependencies. The Poetry strategy only read the latter, causing production deps to be missed for Poetry 2.x projects using the standard format. Changes: - allPoetryProductionDeps now merges PEP 621 deps with legacy Poetry deps (legacy takes precedence for dedup) - pyProjectDeps includes PEP 621 deps as production in the no-lock-file path - Extract reqName to shared Util module (used by both Poetry and PDM) - Add test fixtures and tests for PEP 621 and mixed-format projects Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Poetry 2.x introduced PEP 621 support, allowing production dependencies to be declared in
[project].dependencies(PEP 508 strings) instead of the legacy[tool.poetry.dependencies](TOML tables). FOSSA's Poetry strategy only read the latter, causing production deps to be missed entirely for Poetry 2.x projects using the standard format.Customer BIS reported that their
pymedal>=2.3.4dependency declared under[project].dependencieswas invisible to FOSSA. The[project]section was already being parsed intoPyProjectMetadatabut was never consumed by the Poetry strategy -- only by PDM.This fix wires PEP 621
[project].dependenciesinto both the lock-file and no-lock-file code paths, while preserving full backward compatibility with legacy[tool.poetry.dependencies].Key changes:
allPoetryProductionDepsnow merges PEP 621 deps with legacy Poetry deps (legacy takes precedence for dedup, since they can carry richer metadata like explicit sources)pyProjectDepsincludes PEP 621 deps as production dependencies in the no-lock-file fallback pathreqNamehelper extracted toStrategy.Python.Util(previously duplicated in PDM)Acceptance criteria
[project].dependencies(PEP 621) have their production deps correctly detected[tool.poetry.dependencies]continue to work unchangedTesting plan
[project].dependenciesdetection (CommonSpec.hs)allPoetryProductionDepswith PEP 621 depspep621/pyproject.tomlandpep621-mixed/pyproject.tomlRisks
Minimal -- the change is additive. Legacy
[tool.poetry.dependencies]behavior is completely unchanged. PEP 621 deps are merged viaMap.unionwhere legacy entries take precedence, so existing projects cannot regress.Metrics
N/A
References
Checklist
allPoetryProductionDeps.docs/.Changelog.md. If this PR did not mark a release, I added my changes into an## Unreleasedsection at the top..fossa.ymlorfossa-deps.{json.yml}, I updateddocs/references/files/*.schema.jsonAND I have updated example files used byfossa initcommand.docs/references/subcommands/<subcommand>.md.