Skip to content

Override hardcode package-dependency? #9713

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

Closed
woutervh opened this issue Dec 8, 2024 · 2 comments
Closed

Override hardcode package-dependency? #9713

woutervh opened this issue Dec 8, 2024 · 2 comments
Labels
question Asking for clarification or support

Comments

@woutervh
Copy link

woutervh commented Dec 8, 2024

I'm trying to find a simple solution for this problem:

the package pyautogui is quite old and has this in setup.py:

 'python3-Xlib;platform_system=="Linux" and python_version>="3.0"',
 'python-xlib;platform_system=="Linux" and python_version<"3.0"',

see https://github.com/asweigart/pyautogui/blob/master/setup.py

Many years later the python3-fork is now unmaintained and the original library now has proper python3-support

see https://stackoverflow.com/questions/74716030/what-is-the-difference-between-python-xlib-python3-xlib-pyxlib-and-xlib-in-pyt

Problem:
we want to use python-Xlib,
but python3-Xlib gets installed as a dependency of pyautogui.

I agree this problem should be fixed at package-level, but releases are glacial.

Is there currently a workaround or quick fix available, idealy in pyproject.toml
that we don't loose whenever we do "uv sync"

Both packages install an Xlib -pythonmodule,
so we want to override the Xlib-module installed by python3-Xlib, with the one provided by python-Xlib,

@zanieb
Copy link
Member

zanieb commented Dec 8, 2024

Is this the same as #4422? (there's a solution there, I believe)

@woutervh
Copy link
Author

woutervh commented Dec 8, 2024

@zanieb Amazing. I never saw sys_platform == 'never' before

Nice elegant solution with:

[project]
name = "demo"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
    "pyautogui>=0.9.54",
    "python-xlib>=0.33",
]

[tool.uv]
override-dependencies = [
    "python3-xlib; sys_platform == 'never'",
]

@woutervh woutervh closed this as completed Dec 8, 2024
@zanieb zanieb added the question Asking for clarification or support label Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

2 participants