DEV Community

Cover image for Package Managers in python 🚀
Rohith Gilla
Rohith Gilla

Posted on

Package Managers in python 🚀

Hola

Hey everyone welcome back to the third post of the series can-python-do-that. Wow it's already the third week and I am enjoying to do this 👨🏻‍💻

Github Repository ⭐️

The repository that holds the assets for the series.

GitHub logo Rohithgilla12 / can-python-do-that

This is official repository of the series "can python do that".

To all the JS folks out there, how many time did you feel it would be great if python also has package manager like npm or yarn with those *.lock files. I'm yarn fan 😛 btw.

How many times have you encountered problems managing versions in python projects 🤔?

How many times have you hit stackoverflow searching for version mismatch problems?

Well today in our series we are going to talk about the package mangers in python.

Alt Text

Libraries that we sail over today 🚢

  • Poetry
  • Pipenv
  • Virtualenv

Poetry

Poetry Logo
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

This is my personal favourite library. I tried different libraries for dependecy management but finally stuck to this.

asciicast

PYPI
Docs
Asciinema

P.S: If you are thinking what toml means it stands for Tom's Obvious, Minimal Language.

Pipenv

Pipenv Logo
Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. 

It automatically creates and manages a virtualenv for your projects, as well as adds/removes packages from your Pipfile as you install/uninstall packages. It also generates the ever-important Pipfile.lock, which is used to produce deterministic builds.

asciicast

PYPI
Docs
Asciinema

Virtualenv

virtualenv is used to manage Python packages for different projects. Using virtualenv allows you to avoid installing Python packages globally which could break system tools or other projects. You can install virtualenv using pip.

asciicast

PYPI
Docs
Asciinema

Thanks

Peace ✌🏻,
Rohith Gilla

Spoiler Alert: Next week it is going to be about AI/ML libraries 🍩

Top comments (9)

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

Both Node.js (NPM/Yarn) and Python (PIP) can install directly from GitHub as well as a tag / commithash.

Not as convenient as Deno, though.

Collapse
 
gillarohith profile image
Rohith Gilla

Wow, How does Deno do it?
Just wanted to know #curious

Collapse
 
xowap profile image
Rémy 🤖

The convenience of Deno is that you put directly the GitHub URL of the repo. Which means that instead of knowing the package name you have to know its full URL (https://github.com/encode/django-rest-framework vs djangorestframework by example) but also if the project moves then you have to change the URL. And of course since the version of the package is in the URL, you have to know the version you're using all over the place (and change it when you upgrade).

Did I mention that Deno is so usable that its website is made with Node?

Thread Thread
 
patarapolw profile image
Pacharapol Withayasakpunt

It is probably better to add tag or commithash as well.

So, https://github.com/encode/django-rest-framework@3.9.3, or something. I haven't tested.

Thread Thread
 
gillarohith profile image
Rohith Gilla

Dammn isn’t that hard. Like every time the repo has some breaking changes and since we link with url in the code won’t that break our application 🤯

Collapse
 
xowap profile image
Rémy 🤖

Can't agree more on Poetry, that's definitely the most convenient tool out there by far!

Collapse
 
gillarohith profile image
Rohith Gilla

True installation of the tool is also sweet.
The repo for this whole series in maintained by poetry files only 😅😌

Collapse
 
rahulbordoloi profile image
Rahul Bordoloi

Nice Article :) Thanks for the Information.

Collapse
 
gillarohith profile image
Rohith Gilla

Thanks 🙌