pip-tools has more functionality than this, but compile alone is quite useful.
Start with a loose list of dependencies in requirements.in
:
typer
rich
The requirements.in
file can have things like >=
and such if you have some restrictions on your dependencies.
Now install pip-tools
:
pip install pip-tools
Then, in create a requirements.txt
file with compile
:
pip-compile requirements.in
or:
python -m piptools compile requirements.in
The output will be shown on stdout, but also in requirements.txt
:
# autogenerated by: pip-compile requirements.in
click==7.1.2
# via typer
colorama==0.4.4
# via rich
commonmark==0.9.1
# via rich
pygments==2.9.0
# via rich
rich==10.2.2
# via -r requirements.in
typer==0.3.2
# via -r requirements.in
Now, do the same with a dev-requirements.ini
to create dev-requirements.txt
.
Then, of course:
pip install -r requirements.txt
pip install -r dev-requirements.txt
- And test your application.
- All good? Push changes.
To force pip-compile
to update all packages in an existing requirements.txt
, run pip-compile --upgrade
.