Why specifically do you use it instead of virtualenv (+virtualenvwrapper)?
Why specifically do you use it instead of virtualenv (+virtualenvwrapper)?
$ mkdir myproj
$ cd myproj
$ pipenv --python 3.6 # This creates a virtualenv with Python 3.6 for you project.
$ pipenv install flask # This installs flask in your virtualenv.
$ pipenv run flask # This runs flask in your virtualenv.
$ pipenv run python # This runs a REPL with the interpreter of your venv.
$ pipenv shell # This opens a shell in your venv.
Pipenv replaces requirements.txt with Pipfile and Pipfile.lock. (Similar to what you get from npm or yarn in the JS world, and cargo in Rust)If you use pipenv for a project, you no longer need to care about pip, requirements.txt or virtualenv.
Pipenv/Pipfile is the new standard recommended by Python.org/PyPA:
https://packaging.python.org/tutorials/managing-dependencies...
This is where pipenv delivers. It is a destillation of best practices for virtualenv-configuration.
In your overview, I'd just add an example for a dev installation
pipenv install --dev pytest1. It transparently creates the virtualenv for you
2. The pipfile format handles dependencies and version locking (including hashes of packages), including updates. That means that the versions won't change without your knowledge but upgrading to the latest versions of everything is simply running "pipenv update" to have the virtualenv completely rebuilt (i.e. you'll never forget to add a dependency to a requirements file) and the lock file updated so the next time you push your code the same versions you tested are certain to be used.
3. It'll automatically load the .env file for every command – i.e. your project can have "DJANGO_SETTINGS_MODULE=myproject.site_settings" in that file and you will never need to spend time talking about it in the future.
4. It separates regular and developer dependencies so you don't install as much on servers
5. "pipenv check" will let you know whether any of the versions of any of the packages installed have known security vulnerabilities
6. Pipfile also includes the version of the Python interpreter so e.g. your Python 2 project will seamlessly stay on 2.7 until you upgrade even if your system default python becomes 3.
None of this is something you couldn't do before but it's just easier. Every time a Python point release happens you have to rebuild a virtualenv and now it takes 5 seconds and no thought.
pip install -r requirements-to-freeze.txt --upgrade && pip freeze -l -r requirements-to-freeze.txt > requirements.txt
Pipenv makes this much nicer.https://github.com/jazzband/pip-tools would be what I used before pipenv came to be.
1. `pip-sync`, An easy way to ensure my local environment actually matches my defined requirements. I guess the pipenv version of this would be `pipenv uninstall --all && pipenv install` which isn't quite as elegant, but perhaps good enough.
2. The ability to create more than two requirement sets. For my projects it's often handy to three sets of requirements:
• Normal production requirements end users will need to run the app
• CI requirements needed for testing, but not running the app in production (Selenium, Flake8, etc)
• Local debugging tools (ipython, ipdb)
I could include my local debugging tools in the `--dev` requirements, but then I'm unnecessarily making my CI builds slower by adding requirements for packages that should never actually be referenced in committed code. Alternatively, I could leave them out of my dependencies entirely, but then I have to remember to reinstall them every time I sync my local env to ensure it matches the piplock file.
pip-compile --upgrade
pip-compile --upgrade-package
are also necessary features to quickly track your dependencies (and transitive deps).pipenv uses pip-tools, but they haven't exposed these features as far as I can tell.
It also, like pew, opens the virtualenv in a new shell instead of activating the current shell. A much saner approach.
The UI is also more user friendly: one entry point for everything, pretty colors and icons, auto-correct of package name, and so on.
Using Pipfiles, instead of requirements, are generally a better experience than requirements.txt since it contains dev and prod dependancies and allow separated dependancy pinning, with file hash.