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

uv pip compile of in file containing --no-binary {pkg} does not include that directive in requirements.txt #4420

Closed
philvarner opened this issue Jun 19, 2024 · 7 comments · Fixed by #4463
Assignees
Labels
compatibility Compatibility with a specification or another tool enhancement New feature or improvement to existing functionality

Comments

@philvarner
Copy link

This seems to be intended to be supported based on PR/issues:

Running this version of uv on arm64 / Apple Silicon / MacOS with Python 3.10.12

$ uv --version
uv 0.2.13 (fa6ed3410 2024-06-18)

with this requirements.in file:

rasterio~=1.3.10 --no-binary=rasterio

the uv pip compile command gives an error:

$ uv pip compile --strip-extras -U --no-emit-package setuptools requirements.in -o requirements.txt
error: Expected '--hash', found '"--no-binary=rasterio"' at requirements.in:1:18
@philvarner philvarner changed the title Error with --no-binary, even though it's supposed to be supported Error with pip compile with --no-binary, even though it's supposed to be supported Jun 19, 2024
@zanieb
Copy link
Member

zanieb commented Jun 19, 2024

Hi! These need to be on separate lines e.g.

rasterio~=1.3.10
--no-binary rasterio

@zanieb zanieb added the question Asking for clarification or support label Jun 19, 2024
@philvarner
Copy link
Author

@zanieb Ah, great, that worked, thanks! I'll submit a PR to add that to the compatibility document, as pip-compile accepts it on the same line and two of the examples in the tickets I linked also did that.

@philvarner philvarner closed this as not planned Won't fix, can't repro, duplicate, stale Jun 19, 2024
@philvarner philvarner reopened this Jun 19, 2024
@philvarner
Copy link
Author

@zanieb I spoke too soon -- I don't get the error when It's on a separate line, but the output requirements.txt file is missing --no-binary rasterio

@zanieb
Copy link
Member

zanieb commented Jun 19, 2024

Hm interesting I don't think we echo any settings to the output file. I confirmed this does happen with pip compile

--index-url https://test.pypi.org/simple/
attrs~=23.2.0
❯ uv tool run --from pip-tools -- pip-compile requirements.in
warning: `uv tool run` is experimental and may change without warning.
Resolved 8 packages in 4ms
Installed 8 packages in 20ms
 + build==1.2.1
 + click==8.1.7
 + packaging==24.1
 + pip==24.0
 + pip-tools==7.4.1
 + pyproject-hooks==1.1.0
 + setuptools==70.1.0
 + wheel==0.43.0
WARNING: --strip-extras is becoming the default in version 8.0.0. To silence this warning, either use --strip-extras to opt into the new default or use --no-strip-extras to retain the existing behavior.
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
#    pip-compile requirements.in
#
--index-url https://test.pypi.org/simple/

attrs==23.2.0
    # via -r requirements.in

but not uv.

We'll see what Charlie says — I am not familiar with the intent here.

@notatallshaw
Copy link
Contributor

notatallshaw commented Jun 20, 2024

--index-url has an --emit-index-url option that defaults different between uv and pip-tools: https://github.com/astral-sh/uv/blob/main/PIP_COMPATIBILITY.md#pip-compile-defaults

FYI this is not an issue for my use case, the motivator of that PR, because the packages I want pip compile to resolve on don't have a binary version (wheels), so I don't need to specifiy --no-binary at install time, only at compile time when I am using it in combination with --only-binary :all:.

But perhaps @philvarner has a use case where there is a wheel and they don't want to install it?

@zanieb
Copy link
Member

zanieb commented Jun 20, 2024

Ah thanks for clarifying that, forgot about that default difference.

I feel like we need to emit these for correctness during installations since the .txt lock format doesn't distinguish between wheels and source distributions? Following the pattern of our other flags, maybe we need a --emit-build-options option.

@philvarner philvarner changed the title Error with pip compile with --no-binary, even though it's supposed to be supported uv pip compile of in file containing --no-binary {pkg} does not include that directive in requirements.txt Jun 21, 2024
@charliermarsh
Copy link
Member

It looks like pip-compile has --no-emit-options/--emit-options. We can add that? Or --emit-build-options is fine.

@charliermarsh charliermarsh added enhancement New feature or improvement to existing functionality compatibility Compatibility with a specification or another tool and removed question Asking for clarification or support labels Jun 23, 2024
@charliermarsh charliermarsh self-assigned this Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Compatibility with a specification or another tool enhancement New feature or improvement to existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants