upload this on PyPI (Others cannot install it using pip or easy_install) • Has no package name • Doesn’t work at all if it contains any C extensions ◦ How is it built? ◦ No binary distributions • No metadata (Who made it? What does it for me?) • requirements.txt is not packaging but using packages
Can uninstall packages • Install packages w/ atomic transaction ◦ Install everything ◦ or nothing • Can freeze current site-packages ◦ Widely used pattern to generate requirements. txt • Very useful install -r option • No easy-install.pth or such
use pip on Windows • Or you need entire C build toolchain to install ordinary Python packages at least ◦ Visual Studio ◦ cygwin? mingw? • Discourage to declare package metadata using setup.py
since 2006 • setuptools doesn’t provide recent Python versions • Distribute is a fork of setuptools • Hence it provides the same namespace to setuptools >>> import setuptools >>> setuptools <module 'setuptools' from /.../site-packages/distribute- 0.6.30-py2.7.egg/setuptools/__init__.pyc'>
to Python standard library • Declarative packaging via setup.cfg • Eliminate imperative packaging (setup.py) • You can’t use it for your package right now • Though it would be possible soon :-)
means it’s Turing-complete • It gives powerful flexibility ◦ Sync long_description field with README file ◦ Conditional dependencies using sys.platform and if keyword ◦ Platform-aware building process by extending distutils
compiler in the script and generate Python files just-in-time • Nothing can be assumed with setup.py • Cannot be indexed • You need to execute the script to get metadata • Exactly, one of possible metadata variants • The root cause of why installing Python packages is so slow
check writing manifest file 'MANIFEST' creating Crazy-0.0.0 making hard links in Crazy-0.0.0... hard linking random_module_name_832.py -> Crazy-0.0.0 hard linking setup.py -> Crazy-0.0.0 creating dist Creating tar archive removing 'Crazy-0.0.0' (and everything under it)
• easy_install pip virtualenv • Use pip to install and uninstall • Use easy_install to install C extensions • Isolate site-packages per project using virtualenv
a.k.a. Distutils2 • Test your package on various Python VMs/versions (Python 2 and 3, CPython, PyPy…) • tox will help • Prefer pip over easy_install • Don’t make your setup.py dynamic • It will be your future headache