Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Using Python Packages - An Overview

3,234 views

Published on

A short overview over the Python packaging ecosystem.

Published in: Technology
  • Be the first to comment

Using Python Packages - An Overview

  1. 1. Using Python Packages An Overview Daniel Hepper <daniel.hepper@epicco.de> @danielhepper PyCologne – 12.01.2011
  2. 2. Using Python Packages An Overview ● distutils A lot of names, ● Setuptools a lot of confusion. ● easy_install Distribute ??? ● ● pip ● virtualenv ● virtualenvwrapper12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 2
  3. 3. distutils $ python setup.py install ● allows building and installing modules ● part of standard library since Python 1.6 ● no uninstalling or listing of packages ● no dependency handling12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 3
  4. 4. setuptools $ easy_install MyPackage ● created by Phillip J. Eby ● enhancements to distutils ● handles dependencies ● introduces egg files ● download packages from PyPI ● no uninstalling of packages ● currently unmaintained12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 4
  5. 5. Distribute ● created by the The fellowship of the packaging ● fork of setuptools ● drop-in replacement ● actively maintained ● support for Python 312.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 5
  6. 6. Pip ● written by Ian Bicking ● stands for Pip Installs Python ● replacement for easy_install ● uninstallation of packages ● requirements files ● native support for other VCS ● no eggs!12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 6
  7. 7. Pip Commands ● install: Install packages ● uninstall: Uninstall packages ● freeze: Output all currently installed packages ● search: Search PyPI ● bundle: Create pybundles ● help: Show available commands ● unzip: Unzip individual packages ● zip: Zip individual packages12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 7
  8. 8. Searching$ pip search djangodjango­gencal             ­ django­gencal is a resuable Djanemencia.django.downloader ­ Downloader app like dl.free.fr idjango­voting             ­ Generic voting application for Ddjango­composition        ­ `django­composition` provides thdjango­invitation         ­ Built on top of django­registrat…django­cnotes             ­ Django cnotes provides a simple django_messages_framework ­ Backport of django (dev)s messablogango                  ­ A django based blogdjango­fancy­autocomplete ­ A simple AJAX autocomplete helpe12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 8
  9. 9. Freezing & Requirements files$ pip freezeBrlapi==0.5.5CouchDB==0.6Couchapp==0.7.2GnuPGInterface==0.3.2GoldenRatio==1.0.0Jinja2==2.5.5Mako==0.3.4MarkupSafe==0.9.2PAM==0.4.2PIL==1.1.7...12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 9
  10. 10. Freezing & Requirements files$ pip freeze > requirements.txt$ pip ­r requirements.txt12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 10
  11. 11. Virtualenv ● written by Ian Bicking ● creates isolated Python environments $ virtualenv ENV ● creates ENV/lib/pythonX.Y/site­packages ● install interpreter in ENV/bin/python ● installs Setuptools, ­­distribute installs Distribute ● no site packages with ­­no­site­packages ● activate with . bin/activate12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 11
  12. 12. virtualenvwrapper ● written by Doug Hellmann ● set of extensions to virtualenv ● puts environments in one place ● easy switching between environments ● hook scripts12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 12
  13. 13. Summary enhanced by replaced by distutils Setuptools Distribute provides provides easy_install replaced by supports pip virtualenv extended with virtualenvwrapper12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 13
  14. 14. References ● distutils documentation http://docs.python.org/library/distutils.html ● setuptools on Python Package Index http://pypi.python.org/pypi/setuptools ● Distribute documentation http://packages.python.org/distribute/ ● Pip documentation http://pip.openplans.org/12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 14
  15. 15. References (cont.) ● virtualenv documentation http://virtualenv.openplans.org/ ● virtualenvwrapper homepage http://www.doughellmann.com/projects/virtualenvwrapper/ ● “Der Eierkocher”, talk by Chris Arndt (German) http://chrisarndt.de/talks/cooking-eggs/cooking-eggs-vortrag.html12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 15

×