Indeed. I’ve been wanting to stop using PIP for a long time. It’s not that it’s bad at doing what it does, which it is, but it’s just that I’ve been using it for a long time -I think since I started programming with Python- and it’s time to switch to something more modern, functional and that manages dependencies better.
Poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
Installing Poetry is very simple, it can be done for example using pip install poetry… but as we had agreed to stop using pip, we will use the recommended method:
On Linux and Mac:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python -
It is not necessary to install Poetry every time we have to create a project. It detects the version of Python you have and will create the necessary virtualenvs automatically. Of course we can use it in our projects with Django, Flash, scripts, etc.
For more information, go to the official website. The most basic commands are as follows:
poetry new -> Create new project poetry shell -> Run shell with Poetry env poetry init -> Create pyproject.toml file poetry build -> Create package (.whl y .tar.gz) poetry publish -> Publish on pypi.org
As I said, I’ve been using it for a few months in all my Python projects. I have even moved some old ones to this system.