-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Inconsistent behavior with override-dependencies across package sources #9073
Comments
In the pip interface, we don't respect the constraints in the |
It's not really intended to be part of the published package metadata -- you could view it as local project configuration. |
Thanks for the quick response! That makes sense as a general approach. Is there any way it could be extended to be part of the published package metadata? The project I'm working on is designed for direct use by end users. Like a lot of end-user python packages, it's recommended the user creates an environment, and installs just our package in it. It would be great if there were some way to say "when you're installing |
Package metadata is part of the Python packaging standards (https://packaging.python.org/en/latest/specifications/core-metadata/), such discussion to extend the metadata is held at: https://discuss.python.org/c/packaging/14 I'm not sure if uv could add it's own non-standard metadata, I know PyPI is now doing some metadata validation but not sure if it blocks unknown fields, but what would happen is if these packages got uploaded then uv would start treating packages differently than other installers (pip, poetry, pdm, hatch, etc.) and it would bifurcate the packaging ecosystem. Though, expect to receive serious pushback around standardizing fields which allow for broken resolutions to be installed. Also be prepared to answer questions like, what if two different packages try to override each other, which one wins? |
Your problem is not unique, but I don't know a "best way" to handle this, especially for non-technical users. Here are solutions I have seen:
There is definitely space for someone, like astral / uv 😉, to provide a disruptive solution that better answers how to distribute application-like Python tools to users. But I don't exactly know what the solution would look like. |
@notatallshaw-gts Thanks for the thoughtful answer! It's definitely helping me understand python packaging better. I'll have to dig into the process more to understand fully. As far as extending project metadata goes, I don't know if that's the best solution, or if what I want could be achieved other ways. As far as broken resolutions go, it's an interesting problem. The only working version of our software fails If it's true the problem we're facing is deeper than Python can currently handle, it may be best to go the We've also tried the executable methods, and while the binary installers have failed, PyApp has been very promising. It's not perfect yet, but it does get some of our users over the technical hump. Thanks again for the help. I think this is a real trouble in the python packaging ecosystem, and it would be amazing if the astral folks could find a way to handle it gracefully. |
I'm trying to use the overrides feature to exclude a package download, as described in #4422 (comment)
So, I added the following to my
pyproject.toml
:The issue I'm trying to solve is that we depend on multiple pose estimation libraries, including
mediapipe
, which depends onopencv-python
, andultralytics
, which depends onopencv-contrib-python
, a superset ofopencv-python
.opencv-python
andopencv-contrib-python
conflict with each other, but runningpip check
with both in the same environment passes.I tried testing the change with different package sources (based on this https://docs.astral.sh/uv/pip/packages/), and got different results based on different sources:
With
uv pip install -e.
: when installing from within the project folder, this works as intended - noopencv-python
, the override worksWith
uv pip install 'freemocap @ /Users/philipqueen/Documents/GitHub/freemocap/'
: when installing from disk (with the correct branch active), this doesn't work.opencv-python
is still downloaded, override doesn't seem to workWith
uv pip install "git+https://github.com/freemocap/freemocap@philip/use_uv"
: when installing from git (on the correct branch), this doesn't work.opencv-python
is still downloaded, override doesn't seem to work.I may be doing something wrong, or using the feature outside its intended purpose, but it seems like a bug that it works with some package sources and not others.
My goal is that when I publish to PyPI, running
uv pip install freemocap
doesn't installopencv-python
. I really appreciateuv
adding support for this reaturePlatform/Version Info
uv version: uv 0.5.1 (95e7d87 2024-11-12)
uv platform: mac 12.6.2
The text was updated successfully, but these errors were encountered: