Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support PEP 621 in Poetry 2.0+ #1002

Closed
mkniewallner opened this issue Jan 5, 2025 · 0 comments · Fixed by #1003
Closed

Support PEP 621 in Poetry 2.0+ #1002

mkniewallner opened this issue Jan 5, 2025 · 0 comments · Fixed by #1003
Assignees
Labels
enhancement New feature or request

Comments

@mkniewallner
Copy link
Collaborator

mkniewallner commented Jan 5, 2025

Is your feature request related to a problem? Please describe.

Poetry 2.0 now supports defining project metadata using PEP 621 format.

Currently, we assume that a project uses Poetry if we find a [tool.poetry] section in pyproject.toml. Once found, we only look for dependencies under [tool.poetry.dependencies], [tool.poetry.dev-dependencies] and [tool.poetry.group.<group>.dependencies].

The assumptions we do are not correct anymore, as projects using Poetry can have a [tool.poetry] section for Poetry specific metadata, while having their dependencies in dependencies under [project].

Besides, even with the new format, it is still possible to define dependencies under [tool.poetry.dependencies], either to fully define dependencies, or enrich dependencies under [project] with some additional information.

Describe the solution you would like

Need to dig more into that, but a possible solution would be to:

  • make PoetryDependencyGetter extends PEP621DependencyGetter
  • continue assuming that Poetry is used if we detect a [tool.poetry] section
    • if the section is not present but the project uses Poetry, this means that it doesn't use any Poetry-specific sections for defining dependencies
  • enrich PEP 621 dependencies with Poetry-specific ways of defining dependencies, similarly to what we do for uv and PDM

Additional context

Dependency groups (PEP 735) are not supported, but we can assume that since this is not supported by Poetry, people using Poetry would not populate those sections (like we did for PDM at the time before it added support for it).

@mkniewallner mkniewallner added the enhancement New feature or request label Jan 5, 2025
@mkniewallner mkniewallner pinned this issue Jan 5, 2025
caksoylar added a commit to caksoylar/keymap-drawer that referenced this issue Jan 6, 2025
There is a breaking change in 2.0, where `tool.poetry.include` items
no longer include format = wheel by default. This breaks reading all
resource files, so at least that needed to be fixed, or the poetry-core
in build-system needed to be version pinned.

Took this opportunity to migrate most settings to under project, which
poetry 2.0 supports. Unfortunately deptry gets confused about this
(fpgmaas/deptry#1002) so disable it for now.
@mkniewallner mkniewallner self-assigned this Jan 7, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant