python-poetry / python-poetry/poetry

Support for strict release dependency resolution with PEP621/PEP735 style dependency declaration

Open
#10,663 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

Issue Kind

Other

Description

As stated on https://python-poetry.org/docs/dependency-specification/#handling-of-pre-releases :

Per default, Poetry will prefer stable releases and only choose a pre-release if no stable release satisfies a version constraint. In some cases, this may result in a solution containing pre-releases even if another solution without pre-releases exists. If you want to disallow pre-releases for a specific dependency, you can set allow-prereleases to false. In this case, dependency resolution will fail if there is no solution without choosing a pre-release.

This seems to be compliant with Python's specification for handling of pre releases.

Starting with Poetry 2.2.0, dependencies and dependency groups can be declared using project.dependencies/ project.dependency-groups. When doing so, Poetry will choose pre-releases if no stable release satisfies a version constraint by default.

Is there any way to instruct Poetry to excluding pre-releases for all version specifiers (reporting an error or warning if a pre-release is already installed locally, or if a pre-release is the only way to satisfy a particular specifier) without falling back to tool.poetry.dependencies?
A global configuration (instead of a per-package configuration) would also suffice.

Impact

This is not a show stopper. However, we would like to stick to Python's packaging specification as close as we can and use as little proprietary configuration items in pyproject.tomls as possible.

Workarounds

The only known workaround is to fall back to tool.poetry.dependencies.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Poetry's dependency specification documentation and the referenced PEP 440/pre-release handling specification. Inspect how project.dependencies and project.dependency-groups are resolved, then determine where a global strict pre-release policy could apply; done means unsupported pre-releases produce the requested warning or resolution error without requiring tool.poetry.dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.