Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Pipenv! Python dev workflow for humans.

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Pipenv! Python dev workflow for humans.

Pipenv: it’s a package and virtualenv managing system, it’s aimed to replace the use of pip and virtualenv.

Avatar for Andreu Vallbona Plazas

Andreu Vallbona Plazas

October 06, 2018

More Decks by Andreu Vallbona Plazas

Other Decks in Programming

Transcript

  1. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Who am I Andreu Vallbona @avallbona Bachelor degree in computer science Web developer at APSL, Mallorca, Spain Mainly developing with Python and Django
  2. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 What we do at APSL Web development Systems engineering - devops Data science Mobile apps Consulting and formation
  3. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 What it is? it’s a package and virtualenv managing system it’s aimed to replace the use of pip and virtualenv
  4. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Created by Kenneth Reitz Creator of many useful projects such as: Requests: HTTP for Humans Maya: Datetimes for Humans Records: SQL for Humans Requests-HTML: HTML Parsing for Humans
  5. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Current state of the art Before pipenv we used to create a python environment with virtualenv install some packages freeze the dependencies
  6. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 requirements.txt anatomy list of dependencies with pinned versions
  7. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Problems pip and virtualenv are concepts difficult to understand for beginners
  8. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Problems requirements.txt is difficult to maintain
  9. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Problems we have to remember to update the requirements.txt file
  10. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Problems For different environments we need to maintain several requirements.txt files
  11. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Problems we do not easily know what python version the project uses
  12. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Problems transitive relations A -> B -> C
  13. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 What problems does pipenv solve? avoid manually maintenance of the dependencies
  14. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 What problems does pipenv solve? easy to know which version of python the project uses
  15. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 What problems does pipenv solve? show us the dependencies in a more concise way
  16. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 What problems does pipenv solve? update dependencies securely and automatically
  17. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 What problems does pipenv solve? allow us to have a default environment and a development environment
  18. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Installation Installation
  19. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Installation pip install --user pipenv
  20. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Pipfile anatomy Specify the packages we want Production and development sections Human readable Toml format Specify the python version
  21. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Pipfile.lock anatomy Specify the packages we need Json format Machine readable Easy to parse Pinned versions Hashes
  22. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Pipfile.lock anatomy Specify the packages we need Json format Machine readable Easy to parse Pinned versions Hashes
  23. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Usage pipenv install creates the virtualenv
  24. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Usage pipenv shell activates the virtualenv
  25. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Usage pipenv install <package-name> install a package
  26. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Usage pipenv install <package-name> --dev install a package in the development environment
  27. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Usage pipenv uninstall <package-name> uninstall a package
  28. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Usage pipenv clean uninstall packages not specified in Pipfile.lock
  29. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Usage pipenv graph Displays currently installed dependency graph information
  30. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Usage pipenv run command runs a command inside the virtualenv without activating it
  31. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Usage pipenv check checks for security vulnerabilities
  32. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Usage pipenv lock -r > requirements.txt generates a requirements.txt file
  33. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Usage pipenv install -r requirements.txt imports a requirements.txt file
  34. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Usage load .env files automatically
  35. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 usage pipenv install -c . can discover requirements from the codebase
  36. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 usage pipenv check --unused . show potentially unused dependencies
  37. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Integration with pyenv pipenv --python 3.4.1 install integrates well with pyenv
  38. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 Integration with platforms and editors integrated with platforms and editors Heroku (Cloud Hosting) Platform.sh (Cloud Hosting) PyUp (Security Notification) Emacs (Editor Integration) Fish Shell (Automatic $ pipenv shell!) VS Code (Editor Integration) PyCharm (Editor Integration)
  39. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 utility Pipenv Pipes https://github.com/gtalarico/pipenv-pipes Pipenv Environment Switcher
  40. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 caveats It’s slow when locking dependencies Always tries to update dependencies by default
  41. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 alternatives Alternatives
  42. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 alternatives Poetry https://poetry.eustace.io/ Hatch https://github.com/ofek/hatch
  43. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 thanks Thank you! Questions? @avallbona
  44. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 resources of interest https://www.pythonforbeginners.com/basics/how-to-use-pip-and-pypi https://realpython.com/pipenv-guide/ https://www.kennethreitz.org/essays/announcing-pipenv https://nvie.com/posts/better-package-management/ https://nvie.com/posts/pin-your-packages/ https://medium.com/@jimjh/managing-dependencies-in-python-applications-b9c93dda98c2
  45. Pipenv: Python Dev Workflow for Humans Andreu Vallbona - Pycones

    - October 2018 resources of interest https://www.promptworks.com/blog/pin-all-dependencies https://www.well-typed.com/blog/2008/04/the-dreaded-diamond-dependency-problem/ https://medium.com/@DJetelina/pipenv-review-after-using-in-production-a05e7176f3f0 https://chriswarrick.com/blog/2018/07/17/pipenv-promises-a-lot-delivers-very-little/ https://np.reddit.com/r/Python/comments/8jd6aq/why_is_pipenv_the_recommended_packaging_tool_by/ http://journal.kennethreitz.org/entry/r-python