We Buy Cheese in a Cheese Shop
-
Author
tzu-ping-chung -
Category
Technology
-
view
483 -
download
1
Embed Size (px)
description
Transcript of We Buy Cheese in a Cheese Shop
- 1.We Buy Cheese in a Cheese Shop
2. Cheese Shop 3. Cheese Shop Sketch http://en.wikipedia.org/wiki/Cheese_Shop_sketch 4. https://pypi.python.org/pypi 5. Click this! 6. I buy my eggs at the cheese shop] E G A U G- Aaron Straup CopeN O O [M DjangoCon 2008N A L59Why I Hate Django by Cal Henderson at DjangoCon 2008 7. Me Call me TP Follow @uranusjr RTFM http://uranusjr.logdown.com/pages/about 8. Terminology 9. PyPI 10. Python Package Index aka The Cheese Shop 11. PyPA 12. Python Packaging AuthorityNobody Expects the Python Packaging Authorityby Nick Coghlan at PyCon Australia 2013 13. The Spanish Inquisition http://en.wikipedia.org/wiki/The_Spanish_Inquisition_(Monty_Python) 14. Egg 15. Eggs are to Pythons as Jars are to Java http://peak.telecommunity.com/DevCenter/PythonEggs 16. Wheel 17. Wheels as in Cheese Shops 18. http://www.pythonwheels.com (retrieved on 2013-11-30) 19. http://www.python.org/dev/peps/pep-0427/ 20. Wheel is The replacement of egg Standardized Alternative Python implementation API tag Packaged with better structure and metadata Performance Security 21. But Why? If It Aint Broke, Dont Fix It 22. Because Eggs Are Broken No pun intended 23. Where We Are Now 24. ServerPackage AuthorYou 25. ServerPackage AuthorYou 26. 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 agoFull documentation: http://docs.python.org/library/distutils.html 27. ContainerWhat you want to deployFull documentation: http://docs.python.org/library/distutils.html 28. The MakeleFull documentation: http://docs.python.org/library/distutils.html 29. Extra rules on non-module informationFull documentation: http://docs.python.org/library/distutils.html 30. setup.py 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]'! ) Documentation: http://docs.python.org/distutils/setupscript.html 31. MANIFEST.in include README.rst! recursive-exclude * __pycache__! recursive-exclude * *.py[co]! include docs! prune docs/buildDocumentation: http://docs.python.org/distutils/sourcedist.html 32. $ python setup.py sdist! !$ python setup.py bdist_wininstDocumentation: http://docs.python.org/distutils/sourcedist.html 33. from setuptools import setup! !setup(! # ...! )$ python setup.py bdist_eggDocumentation: http://peak.telecommunity.com/DevCenter/PythonEggs 34. Source distribution 35. Binary egg 36. Windows installer 37. I buy my eggs at the cheese shop - Aaron Straup CopeDjangoCon 200858Does this make sense now? 38. Package metadata(collected from setup) 39. The zip safety ag 40. Top level modules 41. Files in the package 42. Depended packages 43. Package information(as seen on PyPI) 44. Where to nd packages (aside from PyPI) 45. ServerPackage AuthorYou 46. $ python setup.py register! !$ python setup.py sdist bdist_egg uploadDocumentation: http://docs.python.org/distutils/packageindex.html 47. ServerPackage AuthorYou 48. PyPIPackage AuthorYou 49. PyPImirror mirror Package AuthorYou 50. PyPIPackage AuthorSelf-hosted ServerYou 51. [Y]ou don't have to worry about it. They've gured it all out already. The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) by Joel Spolsky 52. Actually they did not; I just dont want to talk about it. 53. ServerPackage AuthorYou 54. The Manual Way 1. Go to PyPI and search for a package2. Download3. Install Extract python setup.py install 55. With Setuptools 1. Install Setuptools2. Run easy_install ! 3. Prot!Documentation: https://pypi.python.org/pypi/setuptools#installation-instructions 56. Problem? 57. LIAR!!!1 58. What is zip-safe, anyway? 59. Why PIP? All packages are downloaded before installation Flat installation by default Uninstallation Clean code PyPI with HTTPS by default http://www.pip-installer.org/en/latest/other-tools.html#easy-install 60. Why NOT PIP? Incompatible with certain legacy packages (rare) Cannot install from bdist packages (except eggs)http://www.pip-installer.org/en/latest/other-tools.html#easy-install 61. ! distribute 62. Commit history of https://bitbucket.org/pypa/setuptools/ 63. https://bitbucket.org/tarek/distribute/overview 64. distribute Intended to replace Setuptools Shares the same module names (setuptools and pkg_resources) Active developmenthttps://bitbucket.org/tarek/distribute/overview 65. http://xkcd.com/927/ 66. We Need a New Standard! 67. http://ziade.org/2010/03/03/the-fate-of-distutils-pycon-summit-packaging-sprint-detailed-report/ 68. http://www.python.org/dev/peps/pep-0376/ 69. o Ne v E tin nt y Pn o h.4 3 70. This is what you get when developers ght with each other. Panel: Directions for Packaging, PyCON US 2013 71. ./setup.py install must die!Panel: Directions for Packaging, PyCON US 2013 72. PyPAs 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 73. https://github.com/pypa/pip/commit/b90fc1a 74. pip >= 1.4 setuptools >= 0.8Upgrading notes: http://pythonhosted.org/setuptools/merge-faq.html 75. $ python setup.py bdist_wheel upload$ pip install --use-wheel Documentation: docs.python.org/distutils/packageindex.html 76. MORE IS BETTER 77. NamePython tagPlatformPillow-2.2.1-cp32-none-win32.whl VersionABI tagIm a wheel! 78. Replaces dasheswith underscoresPlatform independentdjango_mosql-0.2-py27-none-any.whl Implementationnot relevantDoes not needABI information 79. Description gets its own le! 80. Other metadata(similar to PKG-INFO) 81. Unchanged 82. ??? 83. Metadata in JSON 84. Wheel format specication 85. SHA256 for each le in this directory 86. What Changed? The One True Cheese Shop Forward compatibility Machine-friendliness Safety 87. Wrapping Up Python packaging is _____ How did we get into this mess? distutils setuptools PyPI A way out 88. Wheel is the future. Adapt today!