python-poetry / python-poetry/poetry
Not respecting priority for wildcard/inequality requirements
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
- Poetry version: 1.7.1
- Python version: 3.11.6
- OS version and name: macOS Sonoma 14.2.1
- pyproject.toml: https://gist.github.com/tkutcher/70d67b0897017cf10f451d0e57f9ed2c
- I am on the latest stable Poetry version, installed using a recommended method.
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have consulted the FAQ and blog for any relevant entries or release notes.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption) and have included the output below.
Issue
It is mostly self-explanatory in the gist, but I've found that when I have a dependency with a non-pypi source, where that source is specified with priority "default", if I use a more relaxed constraint (wildcard or inequality), then it goes to pypi if there is a naming clash and downloads a pypi package:
[[tool.poetry.source]]
name = "custom-1"
url = "some-url-to-gitlab-private-registry"
priority = "default"
[[tool.poetry.source]]
name = "custom-2"
url = "some-url-to-another-gitlab-private-registry"
priority = "primary"
[tool.poetry.dependencies]
python = "^3.10"
store = ">=0.28.0" # "store" is in "custom-1", but defined like this goes to pypi...
# This also works: store = "^0.28.0"
# This works: store = { version = ">=0.28.0", source = "custom-1" }
Poetry install with that setup downloads a package from pypi with the name "store" at a version 2020.2.10.
Explicitly listing the source it is fine: store = { version = ">=0.28.0", source = "custom-1" }, and using tilde/caret requirements is also fine: store = "^0.28.0"
One of the things I considered was that the caret requirement didn't match anything on pypi hence why it would download the package from gitlab - however I have other scenarios where using the caret requirement does successfully download from my gitlab registry even though both the name and version numbers clash with something on pypi.
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the dependency-resolution behavior using the pyproject.toml configuration in the linked gist and the reported Poetry 1.7.1 and Python 3.11.6 environment. Run Poetry install, optionally with -vvv, for wildcard and inequality requirements involving the custom sources. Done means the resolver respects the default-priority source instead of selecting the conflicting PyPI package.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100