Skip to content

Markers not correctly assigned to nested dependencies #3511

@johnmacnamararseg

Description

@johnmacnamararseg
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: macOS Catalina (10.15.3) (Issue is not OS dependent)
  • Poetry version: 1.1.4

Issue

Issue present in 1.1.4 but not in 1.1.3. Chased it down to the rewrite done in PR #3237

Here is a simple (and real) pyproject.toml that will illustrate this issue

[tool.poetry]
name = "test-repo"
version = "0.1.0"
description = ""
authors = ["John Macnamara <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.9"
azure-identity = "^1.5.0"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

and the corresponding lockfile (with irrelevant deps removed)

[[package]]
name = "azure-identity"
version = "1.5.0"
description = "Microsoft Azure Identity Library for Python"
category = "main"
optional = false
python-versions = "*"

[package.dependencies]
msal-extensions = ">=0.3.0,<0.4.0"

[[package]]
name = "msal-extensions"
version = "0.3.0"
description = ""
category = "main"
optional = true
python-versions = "*"

[package.dependencies]
msal = ">=0.4.1,<2.0.0"
portalocker = [
    {version = ">=1.0,<2.0", markers = "platform_system != \"Windows\""},
    {version = ">=1.6,<2.0", markers = "platform_system == \"Windows\""},
]

[[package]]
name = "portalocker"
version = "1.7.1"
description = "Wraps the portalocker recipe for easy usage"
category = "main"
optional = true
python-versions = "*"

[package.dependencies]
pywin32 = {version = "!=226", markers = "platform_system == \"Windows\""}

[[package]]
name = "pywin32"
version = "300"
description = "Python for Window Extensions"
category = "main"
optional = true
python-versions = "*"

[metadata]
lock-version = "1.1"
python-versions = "^3.9"
content-hash = "123456789"

[metadata.files]
azure-identity = [
]
msal-extensions = [
]
portalocker = [
]
pywin32 = [
]

running poetry export on that lockfile will show that the "platform_system == \"Windows\"" marker on pywin32 is not
present in poetry==1.1.4

More generally, issue seems to only occur under the following conditions:

  • level n dependency has multiple markers for level n+1 dep
  • level n+2 dep has marker

Results in:

  • level n+2 marker is dropped

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions