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

Specify Constraints File In Dependencies #1797

Closed
juftin opened this issue Feb 21, 2024 · 4 comments
Closed

Specify Constraints File In Dependencies #1797

juftin opened this issue Feb 21, 2024 · 4 comments
Labels
duplicate This issue or pull request already exists

Comments

@juftin
Copy link

juftin commented Feb 21, 2024

uv doesn't specify a constraints file as a dependency when enumerating which packages depend on one-another. IMO, having -c constraints.txt is helpful information in the following example (uv==0.1.6):

--- a/piptools_requirements.txt
+++ b/uv_requirements.txt
@@ -1,9 +1,5 @@
-#
-# This file is autogenerated by pip-compile with Python 3.12
-# by the following command:
-#
-#    pip-compile --constraint=constraints.txt --output-file=piptools_requirements.txt -
-#
+# This file was autogenerated by uv via the following command:
+#    uv pip compile - -o uv_requirements.txt -c constraints.txt
 certifi==2024.2.2
     # via requests
 charset-normalizer==3.3.2
@@ -11,8 +7,5 @@ charset-normalizer==3.3.2
 idna==3.6
     # via requests
 requests==2.31.0
-    # via -r -
 urllib3==2.2.1
-    # via
-    #   -c constraints.txt
-    #   requests
+    # via requests

Recreation Steps

docker run --rm -it python:3.12 /bin/bash
pip install -q pip-tools uv
echo "urllib3==2.2.1" > constraints.txt
echo "requests" | pip-compile - -o piptools_requirements.txt -c constraints.txt
echo "requests" | uv pip compile - -o uv_requirements.txt -c constraints.txt
git diff piptools_requirements.txt uv_requirements.txt
@juftin
Copy link
Author

juftin commented Feb 21, 2024

Same goes for requirements.in files, I think having them included is helpful too:

pip install -q pip-tools uv
echo "urllib3==2.2.1" > constraints.txt
echo "requests" > requirements.in
pip-compile requirements.in -o piptools_requirements.txt -c constraints.txt
uv pip compile requirements.in -o uv_requirements.txt -c constraints.txt
git diff piptools_requirements.txt uv_requirements.txt
--- a/piptools_requirements.txt
+++ b/uv_requirements.txt
@@ -1,9 +1,5 @@
-#
-# This file is autogenerated by pip-compile with Python 3.12
-# by the following command:
-#
-#    pip-compile --constraint=constraints.txt --output-file=piptools_requirements.txt requirements.in
-#
+# This file was autogenerated by uv via the following command:
+#    uv pip compile requirements.in -o uv_requirements.txt -c constraints.txt
 certifi==2024.2.2
     # via requests
 charset-normalizer==3.3.2
@@ -11,8 +7,5 @@ charset-normalizer==3.3.2
 idna==3.6
     # via requests
 requests==2.31.0
-    # via -r requirements.in
 urllib3==2.2.1
-    # via
-    #   -c constraints.txt
-    #   requests
+    # via requests

@T-256
Copy link
Contributor

T-256 commented Feb 21, 2024

Related #1343

@charliermarsh
Copy link
Member

charliermarsh commented Feb 21, 2024

Yeah I think this is the same as #1343. Gonna merge into that issue. Thanks!

@charliermarsh charliermarsh closed this as not planned Won't fix, can't repro, duplicate, stale Feb 21, 2024
@zanieb zanieb added the duplicate This issue or pull request already exists label Feb 21, 2024
@charliermarsh
Copy link
Member

Supported in the next version via #3269.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants