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

Pipenv - Melbourne Python User Group (MPUG)

Pipenv - Melbourne Python User Group (MPUG)

August 2018 presentation introducing the Pipenv dependency management tool.

Rory Hart

August 06, 2018
Tweet

More Decks by Rory Hart

Other Decks in Technology

Transcript

  1. Acknowledgement This talk liberally borrows from Kenneth Reitz’s PyCon talk

    of the same name. Follow @kennethreitz - creator of Requests: HTTP for Humans
  2. A lot of tooling for newbies • pip • requirements.txt

    • requirements_dev.txt • requirements_*.txt • virtualenv • + virtualenvwrapper • pyenv • + pyenv-virtualenv • + a bunch more plugins … • anaconda
  3. Why do we need this? $ pip install requests Collecting

    requests Collecting urllib3<1.24,>=1.21.1 (from requests) Collecting certifi>=2017.4.17 (from requests) Collecting idna<2.8,>=2.5 (from requests) Collecting chardet<3.1.0,>=3.0.2 (from requests) Installing collected packages: urllib3, certifi, idna, chardet, requests Successfully installed certifi-2018.4.16 chardet-3.0.4 idna-2.6 requests-2.19.1 urllib3-1.23 $ pip install requests Collecting requests Collecting urllib3<1.24,>=1.21.1 (from requests) Collecting certifi>=2017.4.17 (from requests) Collecting idna<2.8,>=2.5 (from requests) Collecting chardet<3.1.0,>=3.0.2 (from requests) Installing collected packages: urllib3, certifi, idna, chardet, requests Successfully installed certifi-2018.4.16 chardet-3.0.4 idna-2.7 requests-2.19.1 urllib3-1.23
  4. But pip has this feature right? Sort of . .

    . $ pip freeze > requirements.txt $ cat requirements.txt certifi==2018.4.16 chardet==3.0.4 idna==2.7 requests==2.19.1 urllib3==1.23 But this mixes “what I want installed” with ”what I need installed”.
  5. So we have two problems in Python 1. Managing application

    dependencies is complex for newbies. 2. Dependency management could be better.
  6. What do other languages do? Nodejs: yarn & npm (lockfile)

    PHP: Composer (lockfile) Rust: Cargo (lockfile) Ruby: Bundler (lockfile)
  7. $ cat Pipfile [[source]] url = "https://pypi.org/simple" verify_ssl = true

    name = "pypi" [packages] requests = "*” [dev-packages] [requires] python_version = "3.6" A new standard that will eventually be supported by pip. https://github.com/pypa/pipfile Pipfile
  8. Already usable with pipenv Officially recommended tool on python.org. Automates

    virtualenv. Simplifies different python versions (with pyenv). Ensures deterministic builds!