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

Wrong output of uv pip compile #7157

Closed
hexponent opened this issue Sep 7, 2024 · 4 comments
Closed

Wrong output of uv pip compile #7157

hexponent opened this issue Sep 7, 2024 · 4 comments
Labels
question Asking for clarification or support

Comments

@hexponent
Copy link

So I'm planning to add lock file to my project and while comparing existing solutions I encountered a difference in pip-compile (from pip-tools) and uv pip compile results. The result makes me think it is the bug on uv's side.

Consider the following requirements file:
requirements.in

celery<5
flower==0.9.2

After comparing pip-compile and uv pip compile requirements.in -o requirements.txt, there is one more entry in uv's output, namely:

futures==3.4.0
    # via flower

If we check flower's source code, futures is required only for python 2, so it should not appear in uv's output, since it only works with python 3.7+.

@charliermarsh
Copy link
Member

If present, we read from the requires.txt in the shipped source distribution, and that file includes futures. We generally don't really support packages that have requirements that vary across builds (like, in newer releases, this should be expressed as futures ; python_version < "3.0" or similar). So it's consistent with how we treat metadata. I'd suggest either upgrading your flower version (newer versions don't have this issue) or using --no-emit-package futures.

@charliermarsh charliermarsh added the question Asking for clarification or support label Sep 7, 2024
@hexponent
Copy link
Author

Thanks! Upgrading package is definitely something I want to do in the future, but for now I added this setting in pyproject.toml

@andreiburov
Copy link

andreiburov commented Sep 20, 2024

I'd suggest either upgrading your flower version (newer versions don't have this issue) or using --no-emit-package futures.

In case we are using uv as project manager (uv sync/add/remove). Is there an option to skip transient dependency on futures that got picked up although it's not needed? (Something similar to uv pip-compile --no-emit-package futures.)

Here is the error:

error: Failed to prepare distributions
  Caused by: Failed to fetch wheel: futures==3.4.0
  Caused by: Build backend failed to determine extra requires with `build_wheel()` with exit status: 1
--- stdout:

--- stderr:
This backport is meant only for Python 2.
It does not work on Python 3, and Python 3 users do not need it as the concurrent.futures package is available in the standard library.
For projects that work on both Python 2 and 3, the dependency needs to be conditional on the Python version, like so:
extras_require={':python_version == "2.7"': ['futures']}
---

Maybe something like tool.uv.override-dependencies or [[tool.uv.dependency-metadata]]? Although rewriting all transient deps without futures is cumbersome :(

@andreiburov
Copy link

Oh actually I found this solution #4422 (comment).

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

3 participants