Dependency and package management has seen a lot growth and attention in the Python community even in the last couple years. Everyone has their opinions on what to use, but for enterprise code bases, what is the recommended approach?<p>Ideally responses would include size of user base, number of package dependencies, any issues arisen, etc.<p>Thanks y’all. Needless to say, the most recent pipenv post on the front page has led to more confusion than I’d like to admit.
Unfortunately, there is no official way to handle dependencies in Python projects.<p>You should use what is best for you and the only way to find it is to try all of them.<p>If you find this a mess, it is because it is.<p>Python dependency management is a mess and it seems it will not get better any time soon, unfortunately.<p>This is because none of them are good enough.<p>There is a trend towards Poetry right now, and people seem to like it, but there are also people that complain it is not the right tool for some kind of projects. It deserves a try.<p>I tested PDM but it follows an different approach that Python community is used to and because of this it does not get the same attention as other tools.<p>Pipenv was a tool with lots of promises that got aggressively marketed as the "official" way to manage Python dependencies but it failed to delivery its promises and it seems the community moved from it.
We use `pyenv` in order to manage python installations (it helps when you want to test different versions manually installing and managing can be done too but is a pain)<p>We force the use of `virtualenv` so that within our project we can nuke and rebuild the installed dependencies quickly.<p>There are multiple requirements.txt files, the first one that used for installation installs the pined version of `pip`, and `setuptools`.<p>After that additional dependencies are installed (separate file).<p>One of the senior engineers I used to work with wanted me to checkout `pip compile`. It looks useful.
It's a mess in general<p>The best balance I've managed is with Linux - distributions bundle up most everything I need as packages, and I'm lucky there's very little requirement for specific versions for what I need<p>Anything extra I tend to get with pip/--user
We've been using pipenv + pyenv at work for years, and it's fine to be honest. On Linux, I don't really have a problem with either tool anymore, on Windows it's still a bit buggy. Most of it comes from the pipenv pyenv integration not working automatically. I'd try a couple and find what works best for your workflow.<p>Not saying python package management couldn't be better, but I think that a lot of pipenv's hate comes from earlier versions, and is a bit overblown.
For development, poetry is the most user friendly tool and it's also battle tested. For application deployment/installation pipx "just works" and it's an official PyPA project inspired by npx.<p>I don't know why people are saying it's not going to get better but there is an ongoing effort to actually become better but as with everything it goes through the PEP process which is a slow.
I don’t personally write Python often, especially not in an enterprise context, but from my (admittedly narrow) understanding all these tools try to do what Nix already does. You could look into that.