python-poetry / python-poetry/poetry

Externally managed dependencies

Open
#6,847 2 comments 2 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

  • 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

In this issue/discussion, it's clear that automatically installing the correct CUDA versioned PyTorch will probably remain out of scope for Poetry until there is a standard for this and it is supported by PyPI, if ever. In that issue it was suggested that a tool like light-the-torch could be used in various ways, including hooks. However, for that to happen, Poetry would have to cooperate to some extent, essentially relinquishing control to the other tool.

[tool.poetry]
dependencies-external = ["pytorch"]

I have taken to using the current workaround myself e.g. in Dockerfiles or in CI, when needing a specific version of PyTorch:

poetry export --without-hashes > requirements.txt && \
    sed -i '/torch/d' requirements.txt && \
    python3 -m pip install -r requirements.txt && \
    # < INSTALL PYTORCH SOME OTHER WAY >>

I guess this provides a sort of specification for how this should work. It should make poetry install work as resolution happens and then the dependency is removed before it is installed. It should also avoid removing the externally managed package if it is already installed beforehand. I think having some kind of support like this within Poetry would be helpful. I think this only works at the project level i.e. when poetry install is run, and so would not change behavior at all when being used as a library.

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 by reading discussion 6680 and the project-level poetry install behavior described here, then compare it with the poetry export workaround. Done requires a settled design for declaring an external dependency, resolving it without Poetry installing it, and preserving an already-installed package.

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
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.