Context of this talk: https://speakerdeck.com/uranusjr/we-buy-cheese-in-a-cheese-shop
What Python Packaging went through in the past few years, how it is at year 2017, and looking ahead.
We Store Cheese in theWarehouse
View Slide
http://lucumr.pocoo.org/2012/6/22/hate-hate-hate-everywhere/
2012
Party Like It’s 2012• Setuptools• site and .pth files• Eggs
Setuptools• Package metadata• Dependency resolution!• easy_install
LIAR!!!1
.pth• Path configuration file• Placed in site-packages• Populate sys.path at runtime
A PIL Tutorial>>> import Image>>> im = Image.open("louie.jpg")>>> im.show()https://gist.github.com/bradmontgomery/3125124?
$ ls $LIB/python2.7/site-packagesPIL pkg_resourcesPIL.pth setuptoolseasy_install.py setuptools-36.5.0.dist-infoeasy_install.pyc wheelpip wheel-0.30.0.dist-infopip-9.0.1.dist-info
>>> import Image>>> print(Image.__file__)lib/python2.7/site-packages/PIL/Image.pyc>>> import sys>>> for path in sys.path:... print path...(more...)lib/python2.7/site-packages/PIL(more...)
$ ls $LIB/python2.7/site-packagesPIL pkg_resourcesPIL.pth setuptoolseasy_install.py setuptools-36.5.0.dist-infoeasy_install.pyc wheelpip wheel-0.30.0.dist-infopip-9.0.1.dist-infoThis
PTH FILESPTH FILES EVERYWHERE
2014
Now
PyPA’s Schedule• Merge back Distribute• New binary format (wheel)• Built-in Setuptools and Pip• Better Security
HTTPS support on PyPI
https://packaging.python.org
Next
PackageAuthorServerUser
https://pypi.org
https://github.com/pypa/warehouse
https://pipenv.org
Pipfile• “Requirements 2.0”• Eventual pip -p integration• https://github.com/pypa/pipfile
Pipfile• The “lock” concept• PEP 508 environment markers• Robust file format
SETUP.PY INSTALLMUST DIE
setup.py• Ad-hoc executable is always wrong• Don’t know what will happen until theyactually happen• Wrong assumptions on top of wrongassumptions
https://en.wikipedia.org/wiki/Catch-22_(logic)
pyproject.toml• Declarative data file• PEP 508 for requirement specification• Eventual support in Pip
Summary• Use Pipenv to manage projects• Use modern tools to distribute packages• Adopt PEP 508, prepare for PEP 518
Summary• A lot can happen in five years• PyPA rocks, please help them• Looking forward to the next five!