Skip to content

Avoid downloading wheels that do not match Python requirement or when platform constraints are specified #7935

@ralbertazzi

Description

@ralbertazzi
  • 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

Poetry by design includes in its lockfile every wheel matching the version requirements of a package. This is done regardless of the Python version requirement, and is generally fine when ran against pypi. However this results in a big performance penalty wen ran against a repository that does not expose package hashes (pytorch once again 👀 ), which results in Poetry downloading a lot of unnecessary wheels.

Suppose I specify python = "~3.11" as Python version and add torch==specific-version as a dependency from its public repository https://download.pytorch.org/whl/torch. As the repository does not provide hashes, Poetry will (rightfully) download wheels to compute a hash on them. However, it does it regardless of the Python specification - i.e. not only cp311 wheels are downloaded, but also cp39, cp38, ... This becomes increasingly slow as new Python versions are released.

I'm wondering if Poetry would accept a PR where the inclusion of packages in the lockfile (and thus its download) is pre-filtered by filtering on the matching wheels, or if I'm missing something for which this can/should not be done. While I agree that the PyTorch team should improve its repository, I think it doesn't hurt for Poetry to stay on the safe side and exploit this performance improvement if possible (as from real world experience PyTorch is not the only repository that does not expose hashes unfortunately).


Related:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureFeature requests/implementationsstatus/triageThis issue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions