Skip to content

Non-deterministic markers order #10702

@Spikhalskiy

Description

@Spikhalskiy

Description

Consecutive runs of poetry install after poetry update change markers or versions restriction order in a non-consequential way.
This also seems to reproduce when running install across different Linux distributions and machines, as well as with the update-install sequence on the same machine.

Ex:

[[package]]
name = "google-api-core"
version = "2.29.0"
...
[package.dependencies]
proto-plus = [
    + {version = ">=1.22.3,<2.0.0"},
    {version = ">=1.25.0,<2.0.0", markers = "python_version >= \"3.13\""},
    - {version = ">=1.22.3,<2.0.0"},
]
description = "Fast implementation of asyncio event loop on top of libuv"
optional = false
python-versions = ">=3.8.1"
groups = ["main"]
- markers = "sys_platform != \"win32\" and sys_platform != \"cygwin\" and platform_python_implementation != \"PyPy\""
+ markers = "platform_python_implementation != \"PyPy\" and sys_platform != \"win32\" and sys_platform != \"cygwin\""

The first reordering occurred in Poetry 2.2.1. I did not see the second one before upgrading to 2.3.1.

This issue is especially disruptive with Coding Agents, especially cloud-deployed ones like GitHub Copilot, because it creates unnecessary noise in the pull requests.

It would be great if this issue could be mitigated by deterministic ordering of markers and version ranges by hash or lexicographically.

Workarounds

Adding .lock files to .gitignore and committing them only when needed.

Poetry Installation Method

pip

Operating System

Ubuntu 25.10

Poetry Version

Poetry (version 2.3.1)

Poetry Configuration

cache-dir = "/home/dmitry/.cache/pypoetry"
data-dir = "/home/dmitry/.local/share/pypoetry"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = false
keyring.enabled = true
python.installation-dir = "{data-dir}/python"
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false

Python Sysconfig

sysconfig.log
Paste the output of 'python -m sysconfig', over this line.

Example pyproject.toml

[tool.poetry]
name = "adk-chat-demo"
version = "0.1.0"
readme = ""

[tool.poetry.dependencies]
python = ">=3.12,<3.14"
google-adk = "1.23.0"

[tool.poetry.group.dev.dependencies]
ruff = "0.14.13"

[tool.pytest.ini_options]
pythonpath = [
    "src/"
]

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

Also find two lock files attached:
The poetry.lock.zip was produced by poetry 2.2.1 during poetry update, and poetry_install.lock.zip includes modifications that an immediate follow-up poetry install does.

Poetry Runtime Logs

poetry-runtime.log
Paste the output of 'poetry -vvv <command>', over this line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/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