Successfully reported this slideshow.

Using Python Packages - An Overview

2

Share

Loading in …3
×
1 of 15
1 of 15

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

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 ● virtualenvwrapper 12.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 handling 12.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 unmaintained 12.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 3 12.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 packages 12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 7
  8. 8. Searching $ pip search django django­gencal             ­ django­gencal is a resuable Djan emencia.django.downloader ­ Downloader app like dl.free.fr i django­voting             ­ Generic voting application for D django­composition        ­ `django­composition` provides th django­invitation         ­ Built on top of django­registrat … django­cnotes             ­ Django cnotes provides a simple  django_messages_framework ­ Backport of django (dev)'s messa blogango                  ­ A django based blog django­fancy­autocomplete ­ A simple AJAX autocomplete helpe 12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 8
  9. 9. Freezing & Requirements files $ pip freeze Brlapi==0.5.5 CouchDB==0.6 Couchapp==0.7.2 GnuPGInterface==0.3.2 GoldenRatio==1.0.0 Jinja2==2.5.5 Mako==0.3.4 MarkupSafe==0.9.2 PAM==0.4.2 PIL==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.txt 12.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/activate 12.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 scripts 12.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 virtualenvwrapper 12.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.html 12.01.2011 Daniel Hepper <daniel.hepper@epicco.de> 15

×