This is sort of a followup to https://github.com/pypa/pip/issues/8792 since that was locked. I don’t fully understand the outcome, so maybe this is just user error.
I have a monorepo at work that I manage something like:
/
|- app1
| |- requirements.in
|- app2
| |- requirements.in
|- requirements.in
|- constraints.txt
Where:
app1/requirements.in
boto3
app2/requirements.in
starlette
uvicorn
requirements.in
-r app1/requirements.in
-r app2/requirements.in
And constraints.txt
is generated by pip-tools
: pip-compile --output-file=constraints.txt --strip-extras --generate-hashes --resolver=backtracking constraints.in
And when I want to install dependencies for app1
: pip install -r app1/requirements.in -c constraints.txt
.
This generally works great for my use case, but if I add --generate-hashes
when I generate constraints.txt
I then get an error when I do pip install
: ERROR: In --require-hashes mode, all requirements must have their versions pinned with ==
. From the discussion linked above it sounds like this is because my .in
files don’t have any hashes and the valid hashes are computed as an intersection. I guess this makes sense at some level: if you have pytest<7
in a .in
file and and pytest>5
in a constraints.txt
file the valid versions are the intersection (pyetest>5,<7
).
So a couple of questions:
- Is my conceptual understanding of what’s going on correct?
- Are there any easy changes to this workflow that might enable me to have package hashes?
- Would it be possible to add an option to say “consider lack of a --hash equal to any hash instead of no hashes” or something like this?