python-poetry / python-poetry/poetry
Poetry should attempt to find both wheels and sdist during locking - across sources
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have searched the FAQ and general documentation and believe that my question is not already covered.
Feature Request
Consider the following scenario - separate indexes are used for wheels and sdists.
User wants to prefer wheels over sdists, even if wheel is older version, but if wheel is not available, use sdist.
With pip it is done by using pip install --index-url ... --extra-index-url ... --prefer-binary ...
With poetry, there are 2 issues:
- no
prefer-binaryconfiguration option - we cannot ask poetry to lock an older wheel if newer sdist is available.
However since in our scenario we have separate indexes for wheels, we can leverage "priority" parameter. Setting "default" for wheels index, and "supplemental" for sdist index achieves equvalent of "--prefer-binary". Of course this is not a universal solution, but in this scenario it works. But here's the second issue:
- If poetry finds matching files in default or primary index, it does not check supplemental index at all. Why is this a problem? Because in the aforementioned scenario, poetry would only put wheels into the lock file. wheels may be bound to a certain python version. If user decides to support a newer python version,
poetry installwill start to fail, because it did not record sdist in the lock file, and has no compatible wheel in the lock file. Pip would install sdist in such case.
I think we should add an option to ask poetry to look for at least one instance of wheel and one instance of sdist - separately, so for each type it would separately go through default+primary, then supplemental sources. prefer-binary flag would help as well here, telling poetry which type to use to lock the version (while still trying to find both types for this selected version).
(if there's a way to lock only versions w/o locking specific files or source urls - that would be an OK solution as well)
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
No files, tests, or entry points are named. Start by tracing Poetry's locking and source-priority handling, then define how the selected version should record both a wheel and an sdist across primary/default and supplemental indexes; done should cover the fallback for a Python version without a compatible wheel.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100