poetry icon indicating copy to clipboard operation
poetry copied to clipboard

Poetry export platform markers broken on Linux in `>=1.1.12`

Open ingvaldlorentzen opened this issue 1 year ago • 1 comments

  • [x] I am on the latest Poetry version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Debian 11.4 (python:3.10-slim docker image)
  • Poetry version: 1.1.14
  • Link of a Gist with the contents of your pyproject.toml file: https://github.com/ingvaldlorentzen/poetry-pywin-bug/blob/main/pyproject.toml

Issue

When using poetry export in Poetry 1.1.12 and above on Linux platform markers are not properly added. Not quite sure why, but I'm guessing it's related to this commit/PR.

This does not seem to be an issue on macOS or Windows, only Linux. Testet primarily with the python3.10-slim image, but the same issue was present on the -alpine image.

The issue is not present in the Poetry 1.2.0b3 beta. Feel free to close this issue if you think having the fix in the new version is enough, but if possible, a backport fix to the 1.1.x branch would be great if the release of 1.2.0 is a ways away.

Encountered this issue when having azure-identity as a dependency, as pywin32 is a subdependency.

Heres a few examples of pywin32 related output from poetry export:

macOS 12.5, Python 3.10.5 Poetry 1.1.14:

pywin32==304; python_version >= "3.6" and platform_system == "Windows"

Debian 11.4, Python 3.10.6, Poetry 1.1.14:

pywin32==304

Debian 11.4, Python 3.10.6, Poetry 1.1.12:

pywin32==304

Debian 11.4, Python 3.10.6, Poetry 1.1.11:

pywin32==304; python_version >= "3.6" and platform_system == "Windows"

Debian 11.4, Python 3.10.6, Poetry 1.2.0b3:

pywin32==304 ; python_version >= "3.10" and platform_system == "Windows" and python_version < "3.11"

Full export outputs and generated lockfiles can be seen here: https://github.com/ingvaldlorentzen/poetry-pywin-bug

When attempting an install with the generated requirements.txt file on a non-Windows platform it will fail for the versions where the output is simply pywin32=304 as pip will attempt to install a package not compatible with non-Windows platforms.

ingvaldlorentzen avatar Aug 08 '22 09:08 ingvaldlorentzen

I'm also affected, if I run:

poetry init
poetry add --lock msal-extensions
poetry export --output=requirements.txt

If I have this in the poetry.lock

...
[[package]]
name = "msal-extensions"
version = "1.0.0"
description = "Microsoft Authentication Library extensions (MSAL EX) provides a persistence API that can save your data on disk, encrypted on Windows, macOS and Linux. Concurrent data access will be coordinated by a file lock mechanism."
category = "main"
optional = true
python-versions = "*"

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

I will have in the requirements.txt:

...
pywin32==304; python_version >= "3.5" and platform_system == "Windows"
...

But sometimes the 2 lines int the portalocker are inverted, then ; python_version >= "3.5" and platform_system == "Windows"is missing for pywin32...

sbrunner avatar Aug 08 '22 16:08 sbrunner

As I understand it there's no plan for any more 1.1 releases, so if this is all working fine at 1.2 then there's nothing to do here.

dimbleby avatar Aug 13 '22 16:08 dimbleby

I have the same issue. If you find any hack around this I would be interested

pievalentin avatar Aug 25 '22 15:08 pievalentin

The 1.2 release is imminent, you just have to wait for that - or use poetry 1.2.0rc1.

(And this issue should be closed)

dimbleby avatar Aug 25 '22 15:08 dimbleby

Awesome thank you!

pievalentin avatar Aug 25 '22 15:08 pievalentin

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Mar 01 '24 03:03 github-actions[bot]