During code review at work, I got to learn more about pip
and poetry
. I still don’t know too much about them so this is brief summary of what I know so far.
pip
According to pip documentation, pip
is a package installer for Python from PyPI (Python Package Index) and other indexes. Often times, there is usually a requirements.txt
file
where all dependency libraries are written and we can use pip
to install them all at once for a Python program.
For instance, if there is the following requirements.txt
file:
celery
sphinx
If we do pip install -r requirements.txt
, it will install the above dependencies (celery
and sphinx
) to either activated virtual environment or globally on your machine.
It is recommended to install dependencies to an activated virtual environment as that will help us install and manage dependenceis in an isolated environment.
We can install Python packages from PyPI or a private PypI server as well.
poetry
According to poetry documentation, poetry
is a tool for dependency management and also packaing in Python.
Similar to pip
, it enables us to install and manage dependency Python packages to your environment. In addition, poetry
provides a lockfile where it locks versions of all dependencies so that anyone installing Pyhton packages
via the lockfile will have the same environment. This may be greatly helpful when many people work on the same project together.
From code review, I learned that poetry
can be used for packaing a Python library as well.