DEV Community

Cover image for Python Package Manager Comparison 📦

Python Package Manager Comparison 📦

Adam Hill on November 13, 2023

This article started as a random thought and then this post on Mastodon. If you haven't read Hypermodern Python from 2020, it is a good companion...
Collapse
 
m0n0x41d profile image
Ivan Zakutnii

Hey, nice post, thanks!
It would be nice to hear more criticism on poetry from you, really! Please describe what you mean by 'too designed'?

Regarding built-in scripts, I agree with you here. Yet, all the automations are easy to describe with good old makefiles. :D

Collapse
 
adamghill profile image
Adam Hill

My biggest criticism of poetry is that it isn't completely PEP-compliant. For some people that's a big deal. It hasn't stopped me from using it in the past, though.

Dealing with Poetry and pyenv can be annoying (hence why rye's approach is appealing to me). I've run into a few problems that could only be solved by nuking the venv folder and re-installing everything from scratch which is not ideal.

I have run into a few gnarly bugs over the years (one was github.com/python-poetry/poetry/is... which has now been fixed), but that doesn't really feel like a fair comparison -- I've used Poetry consistently for 3+ years, whereas I haven't used any other package manager nearly that much.

Collapse
 
m0n0x41d profile image
Ivan Zakutnii

Yeah, those are exactly the same pains I assumed you would be talking about! :D It's so true, especially when it comes to poetry+pyenv and nuking .venv

Probably I should try rye for my side-projects. Thanks a lot!

Collapse
 
himansingh profile image
Himanshu Singh • Edited

Nice article here, Adam. I compared all the above tools and came back here to give my understanding and opinion.

Have used poetry and because it was the first tool to take the initiative and push the development in this structured direction, it deserves all the praise. Having said that, I want pdm to grow much more than others because of the PEP standards and all the built-in functionalities. Haven't found Rye and Hatch to be so much mature though but they are definitely good.

If poetry doesn't follow the PEP standards people would slowly but eventually migrate to one of the others fo sure.

Collapse
 
adamghill profile image
Adam Hill

Poetry is actively working to support PEP 621, see github.com/python-poetry/roadmap/i... and the linked PR. Handling a large installed base of current users makes it tricky I'm sure.

PDM is next on my list to try out on a real library to get a more in-depth understanding of how it works.

Collapse
 
proteusiq profile image
Prayson Wilfred Daniel

I have danced with conda/mamba when I started my journey in DS. Then switched to pyenv and poetry after having issues with pipenv as I advanced in DS and CS.

I have tried hatch on the early days and not heard of rye until now 🙃. I will give it a try.

Today, I use pyenv + poetry, but also pixi when I want packaged from conda and other none Python.

Thank you for sharing comparison

Collapse
 
adamghill profile image
Adam Hill

Thanks! I thought about investigating conda as well, but for some reason that feels like it solves different problems than these 4. I'd love to hear your thoughts about it, though.

Collapse
 
proteusiq profile image
Prayson Wilfred Daniel

I would not bother with conda/mamba. Pixi, written in Rust, is what I would explore where I to want Anaconda Continuum packages 📦.

conda is like a merge of pyenv + poetry|pipenv into a single not so smart tool. Not so smart in a way you cannot share Python cross projects that use the same Python version.

The positive about it is that packages from official channels are reviewed before publication and thus not likely to be malicious.

Here is a list comparison from yet another package manager pyflow.

Collapse
 
ldrscke profile image
Christian Ledermann
Collapse
 
kehoecj profile image
Clayton Kehoe

Nice overview! I hadn’t heard of several of these before

Collapse
 
dunkbing profile image
dunkbing

Are Python's toolings just too bad that we need this many package managers?

Collapse
 
adamghill profile image
Adam Hill

Well... that's not my view. :)

Python is 30+ years old and has grown organically over time (mostly through volunteers) and the number of users who use the language is massive. Trying to solve everyone's use cases is nigh impossible. Newer languages (Rust, Go, Node.JS) can look at pain points in Python and design tooling that solves those problems. And even with that advantage Node.JS has a few package managers (NPM, Yarn, pnpm, bun, and maybe more I don't even know about?). It just seems to happen at some point.

I realize it can be confusing for end-users to have too many options, but tools stagnating and not continuing to push the ecosystem forward seems worse to me. The newer PEPs were a welcome breath of fresh air that has reinvigorated Python tooling and I'm here for it.

Like I said in my conclusion, all of these tools are pretty stable at this point -- just pick one and stick with it.