Tags: #pip #python #workflow
Some Python projects will have two dependency files:
requirements.txt
requirements-to-freeze.txt
The latter should contain both ‘explicit’ versions (i.e. versions of dependencies our service is known to support) and ‘non-explicit’ versions (e.g. no versions defined), where as the former (requirements.txt
) simply acts as a lockfile.
If we execute pip freeze
the output will include dependencies that have the explicit versions we requested and the latest version for those dependencies where we defined no explicit version. We can direct that output to a new file called requirements.txt
.
For example, your requirements-to-freeze.txt
could look like:
# install these explicit versions...
pyjwt>=1.5.3
# install the latest of these...
flake8
pytest
pytest-cov
mock