Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest release depends on buggy extra-platforms which fails on Proxmox #1094

Closed
andreby opened this issue Oct 3, 2024 · 6 comments
Closed
Labels
🐛 bug Something isn't working, or a fix is proposed 📦 dependencies Update of dependencies

Comments

@andreby
Copy link

andreby commented Oct 3, 2024

I get this error when click_extra tries to import extra_platforms.
extra_platfoms in turn depends on the distro package, so I'm not sure where to open this bug.

It's unfortunate however, since all click_extra really wants from extra_platforms is is_windows() . It seems excessive to fail completely, since it's clear that at least we're not on Windows :)

Traceback (most recent call last):                                                                                                                                                                          
  File "/usr/local/bin/foo", line 5, in <module>                                                                                                                                                 
    from foo import cli                                                                                                                                                                          
  File "/opt/foo/foo.py", line 40, in <module>
    import click_extra as click
  File "/opt/pipx/venvs/foo/lib/python3.11/site-packages/click_extra/__init__.py", line 65, in <module>
    from .commands import (  # noqa: E402
  File "/opt/pipx/venvs/foo/lib/python3.11/site-packages/click_extra/commands.py", line 32, in <module>
    from .config import ConfigOption
  File "/opt/pipx/venvs/foo/lib/python3.11/site-packages/click_extra/config.py", line 42, in <module>
    from extra_platforms import is_windows
  File "/opt/pipx/venvs/foo/lib/python3.11/site-packages/extra_platforms/__init__.py", line 199, in <module>
    CURRENT_OS_ID: str = current_os().id
                         ^^^^^^^^^^^^
  File "/opt/pipx/venvs/foo/lib/python3.11/site-packages/extra_platforms/__init__.py", line 186, in current_os
    raise RuntimeError(msg)
RuntimeError: Multiple platforms match current OS: [Platform(id='debian', name='Debian', current=True), Platform(id='unknown_linux', name='Unknown Linux', current=True)]

The host looks like this

$ uname -a
Linux foobar 6.8.12-2-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-2 (2024-09-05T10:03Z) x86_64 GNU/Linux
$ pveversion
pve-manager/8.2.7/3e0176e6bb2ade3b (running kernel: 6.8.12-2-pve)

A simple fix would be to change:
from extra_platforms import is_windows
in to
from extra_platforms.detection import is_windows

I think that would avoid triggering the bug.

@kdeldycke kdeldycke added the 🐛 bug Something isn't working, or a fix is proposed label Oct 6, 2024
@kdeldycke
Copy link
Owner

This issue comes from extra-platforms, and has been fixed in extra-platforms v1.3.1. See:

Can double check that you depends on the last version? You can search for the __version__ string in /opt/pipx/venvs/foo/lib/python3.11/site-packages/extra_platforms/__init__.py.

@kdeldycke kdeldycke added the 🧑‍🤝‍🧑 duplicate This issue or pull request already exists label Oct 6, 2024
@andreby
Copy link
Author

andreby commented Oct 6, 2024

tldr - The latest release of pypi depends on extra_platforms~=1.2.0, which gives me extra_platforms==1.2.1, which has the bug.

I don't depend on any version of extra-platforms myself; my only dependency for this util is "click-extra".

My pyproject looks like this:

[project]
dependencies = [
  "click-extra",
]

And once installed using pipx, pip freeze reports version 1.2.1 of extra-platforms

/opt/pipx/venvs/foo/bin/python -m pip freeze                                                                                                                                     
...
click-extra==4.10.0
extra-platforms==1.2.1              

Which I guess is due to release 4.10.0 of click-extra specifying

dependencies = [
    "extra-platforms ~= 1.2.0",
]

Which gives me extra_platforms==1.2.1, the latest of the 1.2.* releases.

However, If I manually upgrade the venv to extra_platforms==1.3.1, then it works.

/opt/pipx/venvs/foo/bin/python -m pip install extra-platforms~=1.3.1

@kdeldycke
Copy link
Owner

Oh. Sorry for closing this issue too fast. You are right. I overlooked the dependency constraints.

I will cut a new release of Click Extra today then, if you're okay with me dropping support for Python 3.9: I already dropped support of it upstream but not released this changes yet.

@kdeldycke kdeldycke reopened this Oct 7, 2024
@kdeldycke kdeldycke changed the title Can't import click-extra on Proxmox Latest release depends on buggy extra-platforms which fails on Proxmox Oct 7, 2024
@kdeldycke kdeldycke added 📦 dependencies Update of dependencies and removed 🧑‍🤝‍🧑 duplicate This issue or pull request already exists labels Oct 7, 2024
@andreby
Copy link
Author

andreby commented Oct 7, 2024

That works for me. Thanks!

@kdeldycke
Copy link
Owner

I'll use the opportunity of a new release to officially declare Click Extra as Python 3.13-compatible. Just waiting for that version to be available in GitHub actions for CI/CD. This should be the case in a couple of hours. Waiting for this PR to be merged upstream: actions/python-versions#312

@kdeldycke
Copy link
Owner

Just release Click Extra 4.11.0! And it is now available on PyPi. Feel free to update this issue if something is wrong with this release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working, or a fix is proposed 📦 dependencies Update of dependencies
Projects
None yet
Development

No branches or pull requests

2 participants