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

Preserve compiled file:/ requirement names. #9489

Closed
salomon-smekecohen opened this issue Nov 28, 2024 · 3 comments · Fixed by #9493
Closed

Preserve compiled file:/ requirement names. #9489

salomon-smekecohen opened this issue Nov 28, 2024 · 3 comments · Fixed by #9493
Assignees
Labels
bug Something isn't working

Comments

@salomon-smekecohen
Copy link

Issue

Compiling requirements.in files with file: requirements that are named, creates .txt output that lacks the names.
This is in contrast to urls which maintain names.

Thus disallowing .txt generated files from being used as constraints files.

Note: this worked in uv 0.1.2

Info

Version - uv 0.5.5 (95cd8b8b3 2024-11-27)
Platform - 24.1.0 Darwin
Arch - arm64

Example

# requirements.in
# normal requirement
mypy
# url req
nose @ git+https://github.com/salomon-smekecohen/nose@48735f874383f711c3b233ab1442cc9a26e96d6d
# file req
foo @ file:./something
# something/setup.py
from setuptools import setup

setup(name='foo', version='0.1')
# something/something/__init__.py

python -m uv pip compile requirements.in -o requirements.txt

Expectation

# This file was autogenerated by uv via the following command:
#    uv pip compile requirements.in -o requirements.txt
foo @ file:./something
    # via -r requirements.in
mypy==1.13.0
    # via -r requirements.in
mypy-extensions==1.0.0
    # via mypy
nose @ git+https://github.com/salomon-smekecohen/nose@48735f874383f711c3b233ab1442cc9a26e96d6d
    # via -r requirements.in
typing-extensions==4.12.2
    # via mypy

Reality

# This file was autogenerated by uv via the following command:
#    uv pip compile requirements.in -o requirements.txt
file:./something
    # via -r requirements.in
mypy==1.13.0
    # via -r requirements.in
mypy-extensions==1.0.0
    # via mypy
nose @ git+https://github.com/salomon-smekecohen/nose@48735f874383f711c3b233ab1442cc9a26e96d6d
    # via -r requirements.in
typing-extensions==4.12.2
    # via mypy
@charliermarsh
Copy link
Member

I thought pip didn't allow relative paths in file:, but I guess they do?

@salomon-smekecohen
Copy link
Author

I thought pip didn't allow relative paths in file:, but I guess they do?

Yeah 😅. Vendoring this has just been an adventure all around. Excludingfile: in favor of just referencing the relative path produces the same results, but pip-tools outputs an absolute path to the .txt when you do that, so I use file: as a way to stay a bit more cross-compatible just in case other people read my requirements files and try to emulate anything without using uv.

@salomon-smekecohen
Copy link
Author

Wow! Thank you Charlie, that was so fast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants