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

We Buy Cheese in a Cheese Shop

We Buy Cheese in a Cheese Shop

Python packaging is ______. But PyPA is trying to solve the problem. Let's take a look at how we got into this mess in the first place, and how did/will PyPA do to fix it.

Tzu-ping Chung

December 26, 2013
Tweet

More Decks by Tzu-ping Chung

Other Decks in Programming

Transcript

  1. Why I Hate Django by Cal Henderson at DjangoCon 2008

    DjangoCon 2008 59 “I buy my eggs at the cheese shop” - Aaron Straup Cope [MOON LANGUAGE]
  2. Me • Call me TP • Follow @uranusjr • RTFM

    • http://uranusjr.logdown.com/pages/about
  3. Egg

  4. Wheel is… • The replacement of egg • Standardized •

    Alternative Python implementation • API tag • Packaged with better structure and metadata • Performance • Security
  5. distutils • I am no expert on neither itself nor

    its history • Built-in since Python 1.6 (2000) • Nothing really changed since about 10 years ago Full documentation: http://docs.python.org/library/distutils.html
  6. from distutils.core import setup! ! setup(! name='mypackage',! version='1.0',! packages=['mymodule'],! description='My

    package',! url='http://myawesomepackage.com',! author='Me the Author',! author_email='[email protected]'! ) setup.py Documentation: http://docs.python.org/distutils/setupscript.html
  7. include README.rst! recursive-exclude * __pycache__! recursive-exclude * *.py[co]! include docs!

    prune docs/build MANIFEST.in Documentation: http://docs.python.org/distutils/sourcedist.html
  8. $ python setup.py sdist! ! $ python setup.py bdist_wininst Documentation:

    http://docs.python.org/distutils/sourcedist.html
  9. Does this make sense now? DjangoCon 2008 58 “I buy

    my eggs at the cheese shop” - Aaron Straup Cope
  10. $ python setup.py register! ! $ python setup.py sdist bdist_egg

    upload Documentation: http://docs.python.org/distutils/packageindex.html
  11. [Y]ou don't have to worry about it. They've figured it

    all out already. The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) by Joel Spolsky
  12. 1. Go to PyPI and search for a package 2.

    Download 3. Install • Extract • python setup.py install The Manual Way
  13. 1. Install Setuptools 2. Run easy_install <package>! 3. Profit! With

    Setuptools Documentation: https://pypi.python.org/pypi/setuptools#installation-instructions
  14. Why PIP? http://www.pip-installer.org/en/latest/other-tools.html#easy-install • All packages are downloaded before installation

    • Flat installation by default • Uninstallation • Clean code™ • PyPI with HTTPS by default
  15. distribute • Intended to replace Setuptools • Shares the same

    module names (setuptools and pkg_resources) • Active development https://bitbucket.org/tarek/distribute/overview
  16. This is what you get when developers fight with each

    other. Panel: Directions for Packaging, PyCON US 2013
  17. PyPA’s Schedule • Merge Distribute back to Setuptools (Done) •

    New binary distribution format (Done) • Built-in Setuptools and pip support in Python • Better security • …And more! The Future of Python Packaging, Python Packaging User Guide
  18. ???

  19. What Changed? • The One True Cheese Shop • Forward

    compatibility • Machine-friendliness • Safety
  20. Wrapping Up • Python packaging is _____ • How did

    we get into this mess? • distutils • setuptools • PyPI • A way out