'Pipenv install package with exact latest version

When I run pipenv install requests it will add the following to Pipfile:

requests = "*"

But I want pipenv to add the latest package to Pipfile as a fixed (hard-coded) version that is exact or compatible:

requests = "=={latest_version}"
# or
requests = "~={latest_version}"

The problem with requests = "*", is that it causes pipenv to accidentally upgrade the package to the latest version (which might cause compatibility issues) when relocking (for example when installing a new package).

With node running npm install axios will add a fixed (compatible) version:

"axios": "^0.21.1" // compatible

Currently, I have to go to the https://pypi.org/project/requests/ to determine the latest version and then run pipenv install requests=={latest_version}. Further version updates are managed by dependabot.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source