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

Twisted History of Python Packaging

Mahdi Yusuf
November 07, 2012

Twisted History of Python Packaging

Python Packaging has had a more than less than ideal evolution. This talk aims to clarify this evolution so we can build a better future.

Mahdi Yusuf

November 07, 2012
Tweet

More Decks by Mahdi Yusuf

Other Decks in Programming

Transcript

  1. Twisted history of
    Python Packaging

    View Slide

  2. Mahdi Yusuf
    @myusuf3
    Pycoder’s Weekly

    View Slide

  3. FOCUS UP.
    This journey is a story of growth
    which is often extremely convoluted.

    View Slide

  4. setup.py
    developers
    pypi
    metadata
    end user

    View Slide

  5. View Slide

  6. import os
    import sys
    try:
    from setuptools import setup
    except ImportError:
    from distutils.core import setup
    sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
    from octogit import __version__
    def publish():
    os.system("python setup.py sdist upload")
    if sys.argv[-1] == "publish":
    publish()
    sys.exit()
    dependencies = ['clint2','requests']
    setup(
    name='octogit',
    version=".".join(str(x) for x in __version__),
    description='giving git tentacles to work better with github',
    url='https://github.com/myusuf3/octogit',
    author='Mahdi Yusuf',
    author_email='[email protected]',
    install_requires=dependencies,
    tests_require=['tox==1.3'],
    packages=['octogit', ],
    license='MIT License',
    long_description=open('README.rst').read(),
    entry_points={
    'console_scripts': [
    'octogit = octogit.cli:begin',
    ],
    },
    classifiers=(
    'Development Status :: 4 - Beta',
    'Intended Audience :: Developers',
    'Natural Language :: English',
    'License :: OSI Approved :: MIT License',
    'Programming Language :: Python',
    'Programming Language :: Python :: 2.6',
    'Programming Language :: Python :: 2.7',
    ))

    View Slide

  7. distribute distutils2
    setuptools
    distutils

    View Slide

  8. distutils
    from distutils.core import setup
    setup(name='sadness', version='11.0', py_modules=['sadistic.py'])
    $ python setup.py sdist
    $ python setup.py install

    View Slide

  9. distutils
    No dependency management.

    View Slide

  10. distutils
    No consistent way to reproduce an installation.

    View Slide

  11. distutils
    Not all metadata is handled.

    View Slide

  12. distribute distutils2
    setuptools
    distutils

    View Slide

  13. setuptools
    built on distutils.

    View Slide

  14. setuptools
    no way to uninstall installed packages.

    View Slide

  15. setuptools
    provides dependency management.

    View Slide

  16. setuptools
    introduces easy_install.

    View Slide

  17. setuptools
    eggs.

    View Slide

  18. setuptools
    misunderstood.

    View Slide

  19. distribute distutils2
    setuptools
    distutils

    View Slide

  20. distribute
    fork of setuptools.

    View Slide

  21. distribute distutils2
    setuptools
    distutils

    View Slide

  22. versioning.
    distutils2

    View Slide

  23. 1.1 “Return of the Mac”
    Musky Monkey
    demo5.unreleased
    5 6 42
    Public API Changes Features, Deprecations Bug Fixes

    View Slide

  24. setup.cfg
    distutils2

    View Slide

  25. distutils2
    [metadata]
    name = sadness
    version = 11.0
    author = Mahdi Yusuf
    author-email = [email protected]
    summary = sending you sadness
    description-file = README.rst
    project-url: http://www.twitter.com/myusuf3
    [files]
    packages = sadness
    extra_files = setup.py README
    resources = etc/pytz.timezones

    View Slide

  26. distutils2
    pysetup.

    View Slide

  27. defined requirements based on environment.
    distutils2

    View Slide

  28. discontinued?
    distutils2

    View Slide

  29. Attack of the PEPS

    View Slide

  30. PEP 386 -- Changing the version comparison modules
    PEP 376 -- Database of Installed Python Distributions
    PEP 345 -- Metadata for Python Software Packages 1.2

    View Slide

  31. setuptools easy_install
    distribute pip
    old busted
    new hawtness

    View Slide

  32. fin.
    twitter.com/myusuf3

    View Slide