# [2019.02.03] Pipenv

Yes, I agree that `conda` is much more mature `python` package
manager. And I know about general disappointment in `pipenv` among
its early adepts. I use `pipenv.el` for Emacs which has quite good
integration with `projectile`, but even this porcelain maintainer
quitted using `pipenv` in early December. But I manage to use it and
have fun somehow. I started using `pipenv` nearly a year ago for
pretty pragmatic reasons: it helped our team much to get our
development-testing-deployment-operation pipeline more
straightforward and DevOps-friendly. And yes, I know that `pipenv` is
an extremely raw and bug-infested project. But I prefer to use it,
and today even came up with an Elisp function which can be used as a
`pipenv-projectile-after-switch-function`:

```elisp
(defun pipenv-projectile-after-switch-custom ()
 "Activate pipenv, pyvenv and set PYTHONPATH"
 ;; Always clean up, in case we were in a Python project previously.
 (pipenv-deactivate)
 ;; Only activate if we can verify this is a Pipenv project.
 (when (pipenv-project?)
   (pipenv-activate)
   (pyvenv-activate
     (file-name-as-directory python-shell-virtualenv-root)
   )
   (setenv "PYTHONPATH" (pipenv-project-p))
 )
)
```