Old way was to use requirements.txt but its no long recommended.
New way is to use a dependencies manager
Link: https://python-poetry.org/
Installation: https://python-poetry.org/docs/#installing-with-pipx
Installation using Pipx - pipx is used to install global cli tools with isolating then in virtual environments.
sudo pip install pipxpipx install poetry
# upgrade and uninstall is also supportedInit a new project
poetry initAdd Dependencies
poetry add pytestAdd Dependencies with version
poetry add requests@2.12.1[Default] Add Dependencies with latest version un-till major change
poetry add requests^2.12.1This will try to install more newer version but not
3.x.x
Add Dependencies upto latest minor version
poetry add requests~2.12.1This will install
2.12.5
Show all the dependencies
poetry show
# poetry show requestsRemove dependencies
poetry remove pytestInstall Dependencies for new project
poetry installpoetry can create virtual environment for running the application
Spawn a new shell
poetry shellpoetry version patch
# `x.y.z` this will bump zpoetry version minor
# `x.y.z` this will bump ypoetry version major
# `x.y.z` this will bump xpoetry package
# need pypy credentials