Skip to content

Extra marker is ignored in poetry install, but respected in pip install #7748

@Omegastick

Description

@Omegastick
  • 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 (-vvv option) 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/depsRelated to representing and locking dependencieskind/bugSomething isn't working as expectedstatus/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