-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
- Poetry version: 1.4.1
- Python version: 3.9
- OS version and name: Ubuntu 22.04 on WSL2
- pyproject.toml: https://gist.github.com/Omegastick/713164402b450b16b35c84f425db0a29
- 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
If my understanding is correct, a dependency like this should install the PyPI repository version of the dependency if installed as package_a[repo], and the path dependency if installed as package_a{local]:
[tool.poetry.dependencies]
package-b = [
{version = "^0.1.0", markers = "extra == 'repo'", optional = true},
{path = "../package_b", develop = true, markers = "extra == 'local'", optional = true},
]
[tool.poetry.extras]
repo = ["package-b"]
local = ["package-b"]pip install -e .[local] installs the path dependency, and pip install -e .[repo] fails because package_b doesn't exist (as it should). poetry install -E local and poetry install -E repo both install the path dependency, though.
Use case
I have quite a few repos, all using Poetry, that I would like to install locally with a single poetry install at the top of the dependency tree.
Example dependency tree:
package_a -> package_b -> package_c
If you alter the package_b dependency specification to add the right extras:
package-b = [
{version = "^0.1.0", extras = ["repo"], markers = "extra == 'repo'", optional = true},
{path = "../package_b", extras = ["local"], develop = true, markers = "extra == 'local'", optional = true},
]You could use poetry install -E local to install the whole tree for local development. pip install -e .[local] seems to work this way, unless I'm missing something.
I'm aware that including path dependencies outside of groups specifies the full path (not relative) in PKG-INFO. That's not a problem for us, because the packages are only being uploaded to a private PyPI.