In the context of this lesson, I just saw an article, RIP Pipenv: Tried Too Hard. Do what you need with pip-tools. | by Nick Timkovich | Telnyx Engineering | Medium, dated Jan 25, 2020, which says pipenv is dead. Well, it is now mid-2021, so is this still true that pipenv is dead? Should we still follow what is being taught in the lesson, which is to use pipenv? What are you all using, if not pipenv? What is the current best Python environment manager in use?
For Application Dependency Management, when pipenv does not meet your use case, the Python Packaging Authority (PyPA) recommends the following tools:
For Installation Tools, PyPA recommends pip to install Python packages.
If you want to create isolated Python Virtual Environments, use virtualenv or venv (I currently use vevn).
For Packaging Tools, PyPA recommends setuptools to define projects and create Source Distributions, and to use twine for uploading distributions to.
Source: The Python Packing User Guide
Pipenv was never dead. The author of that article doesn’t know what he’s talking about. The latest release of pipenv was 25 days ago and there were 8 releases in 2020. He also says he uses pyenv for virtual environment management, but pyenv doesn’t even do that. It manages your python versions, which is not the same thing.
I use pipenv regularly and I’ve also used regular pip with venv, conda and poetry. They all do slightly different things, and you should use the one that you need for your particular project.
If you’re doing data science, conda is fantastic for virtual environments and dependency management – but if you’re going to be working with any engineers who need to reproduce your work, you’ll typically want to use venv or pipenv, as those are the two they will be most comfortable with.
If you’re not doing a data science project, the two most commonly used ones are venv and pipenv. A big difference between the two is that with venv, you will have to manage your
requirements.txt yourself, which can become a hassle if your project becomes big (or with multiple environments like development, testing and production) or if you over-zealously installed too many packages to your environment because you thought you’d need them.
Poetry is the new kid on the block, and it works very similarly to pipenv – it has a lock file with your dependencies, the
pyproject.toml file looks a lot like the
pipfile, it creates a virtual environment for you when you initialize a project, etc.
Poetry does have a few distinct advantages though:
- Way better documentation (the pipenv docs are attrocious)
- Simplifies the process of building and packaging your project
- Built-in publishing capability if you want to publish your project on PyPI
So knowing this, choose the one that you like or that fits the needs of your project the best.
Personally, I tend to use conda for DS, venv for small personal projects, pipenv for medium to large projects. I may consider switching to poetry in the future but for most projects it seems a little overkill since I’m not looking to build, package and publish them.
It almost looks like you can believe what is being discussed because there are diagrams and technical justifications, and it is inside Medium’s paywall.
This is actually a very good selling point for Codecademy. The fact that you can trust what they teach.