HACKER Q&A
📣 Elikapeka

How to setup a Python dev environment at the end of 2021


I like to learn more about python but I'm intrigued by all the options. Currently Poetry seems like the way to go. Is this still true?


  👤 jbiams77 Accepted Answer ✓
Poetry is a great tool if you plan on building a single package with wide distribution. Ie. numpy, pandas, requests. The reason is because of the lock file. You provide poetry with a range of acceptable dependencies and their versions and it will solve potential conflicts and produces a compatible lock file. Pip can do it in a half-baked way with 'pip freeze'. This makes your distribution protected from 3rd part changes that may introduce bugs to your code. If you plan on building a large mono repo of many packages, poetry sucks. At this point, you don't really care about semantic versioning, you just want to develop in several packages at once. A lock file in this case will kick your butt and slow development down.

👤 runjake
Why are people using stuff like Poetry and pipenv instead of just plain old python3 -m venv venv && source venv/bin/activate ? (This is a question, not a challenge.)

👤 8b16380d
If you are just learning, I would go with whatever latest python3 version is in the package repos for your system and just manage the virtualenvs yourself.

Ive used poetry and pyenv; they are useful when you are working on python applications that use different python versions. They may introduce unneeded complexity for a beginner.