Warn/Deprecate when hash is provided in constraints file #12956
Labels
C: error messages
Improving error messages
state: needs discussion
This needs some more discussion
type: deprecation
Related to deprecation / removal.
What's the problem this feature will solve?
It appears hashes in constraint files only enforce hashes in requirement files and the behaviour of if they are different in constraint files vs. requirement files is not well defined.
Many scenarios of why they would be useful in a constraint file (such as pinning requirements or build requirements) do not seem possible because they also need to be in the requirements file, e.g.
constraints.txt
with the contents:pip install setuptools==74.1.1 -c constraints.txt
, and get error:I think the fact that hashes are accepted in constraint files leads users to believe that requirements or build requirements will be "constrained" to those hashes, and this error isn't very clear, it says the requirement requires a hash and then shows it having a hash, leading to a lot of effort by users to find out this isn't the case.
Describe the solution you'd like
When a hash is specified in the constraint file, log a warning or a deprecation warning.
Alternative Solutions
Maybe there is some useful use case I am missing and this shouldn't be done?
Additional context
Example of spending a lot of time finding out expected behaviour doesn't work: #12942
Code of Conduct
The text was updated successfully, but these errors were encountered: