SlideShare ist ein Scribd-Unternehmen logo
1 von 100
Downloaden Sie, um offline zu lesen
We Buy Cheese in a
Cheese Shop
Cheese Shop
Cheese Shop Sketch	


http://en.wikipedia.org/wiki/Cheese_Shop_sketch
https://pypi.python.org/pypi
Click this!
“I buy my eggs at the cheese shop”

]
E
G
A
U
G

- Aaron Straup Cope

N
O
O
[M
DjangoCon 2008

N
A
L

59

Why I Hate Django by Cal Henderson at DjangoCon 2008
Me
• Call me TP
• Follow @uranusjr	

• RTFM	

• http://uranusjr.logdown.com/pages/about
Terminology
PyPI
Python Package Index
aka The Cheese Shop
PyPA
Python Packaging Authority

Nobody Expects the Python Packaging Authority	

by Nick Coghlan at PyCon Australia 2013
The Spanish Inquisition	


http://en.wikipedia.org/wiki/The_Spanish_Inquisition_(Monty_Python)
Egg
Eggs are to Pythons
as Jars are to Java
http://peak.telecommunity.com/DevCenter/PythonEggs
Wheel
Wheels as in
Cheese Shops
http://www.pythonwheels.com (retrieved on 2013-11-30)
http://www.python.org/dev/peps/pep-0427/
Wheel is…
• The replacement of egg	

• Standardized	

• Alternative Python implementation	

• API tag	

• Packaged with better structure and metadata	

• Performance	

• Security
But Why?
If It Ain’t Broke, Don’t Fix It
Because Eggs Are Broken
No pun intended
Where We Are Now
Server

Package
Author

You
Server

Package
Author

You
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
Container

What you
want to deploy

Full documentation: http://docs.python.org/library/distutils.html
The “Makefile”

Full documentation: http://docs.python.org/library/distutils.html
Extra rules on
non-module
information

Full documentation: http://docs.python.org/library/distutils.html
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='im@aweso.me'!
)
Documentation: http://docs.python.org/distutils/setupscript.html
MANIFEST.in
include README.rst!
recursive-exclude * __pycache__!
recursive-exclude * *.py[co]!
include docs!
prune docs/build

Documentation: http://docs.python.org/distutils/sourcedist.html
$ python setup.py sdist!
!

$ python setup.py bdist_wininst

Documentation: http://docs.python.org/distutils/sourcedist.html
from setuptools import setup!
!

setup(!
# ...!
)

$ python setup.py bdist_egg

Documentation: http://peak.telecommunity.com/DevCenter/PythonEggs
Source
distribution
Binary egg
Windows
installer
“I buy my eggs at the cheese shop”
- Aaron Straup Cope

DjangoCon 2008

58

Does this make sense now?
Package metadata	

(collected from setup)
The “zip safety” flag
Top level modules
Files in the package
Depended packages
Package information	

(as seen on PyPI)
Where to find packages
(aside from PyPI)
Server

Package
Author

You
$ python setup.py register!
!

$ python setup.py sdist bdist_egg upload

Documentation: http://docs.python.org/distutils/packageindex.html
Server

Package
Author

You
PyPI

Package
Author

You
PyPI

mirror
mirror
Package
Author

You
PyPI

Package
Author

Self-hosted
Server

You
[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
Actually they did not;
I just don’t want to talk about it.
Server

Package
Author

You
The Manual Way
1. Go to PyPI and search for a package	

2. Download	

3. Install	

• Extract	

• python setup.py install
With Setuptools
1. Install Setuptools	

2. Run easy_install <package>!
3. Profit!

Documentation: https://pypi.python.org/pypi/setuptools#installation-instructions
Problem?
LIAR!!!1
What is zip-safe,
anyway?
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
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
先別說

個了!

你聽過 distribute

?
Commit history of https://bitbucket.org/pypa/setuptools/
https://bitbucket.org/tarek/distribute/overview
distribute
• Intended to replace Setuptools	

• Shares the same module names (setuptools
and pkg_resources)	

• Active development

https://bitbucket.org/tarek/distribute/overview
http://xkcd.com/927/
We Need a New Standard!
http://ziade.org/2010/03/03/the-fate-of-distutils-pycon-summit-packaging-sprint-detailed-report/
http://www.python.org/dev/peps/pep-0376/
o
N

e
v
E
t

in
n

t
y
P

n
o
h

.4
3
This is what you get
when developers fight
with each other.
Panel: Directions for Packaging, PyCON US 2013
./setup.py install
must die!

Panel: Directions for Packaging, PyCON US 2013
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
https://github.com/pypa/pip/commit/b90fc1a
pip >= 1.4
setuptools >= 0.8

Upgrading notes: http://pythonhosted.org/setuptools/merge-faq.html
$ python setup.py bdist_wheel upload

$ pip install --use-wheel <package>

Documentation: docs.python.org/distutils/packageindex.html
MORE IS BETTER
Name

Python tag

Platform

Pillow-2.2.1-cp32-none-win32.whl
Version

ABI tag

I’m a wheel!
Replaces dashes	

with underscores

Platform independent

django_mosql-0.2-py27-none-any.whl
Implementation	

not relevant

Does not need	

ABI information
Description gets
its own file!
Other metadata	

(similar to PKG-INFO)
Unchanged
???
Metadata in JSON
Wheel format
specification
SHA256 for each
file in this directory
What Changed?
• The One True Cheese Shop	

• Forward compatibility	

• Machine-friendliness	

• Safety
Wrapping Up
• Python packaging is _____	

• How did we get into this mess?	

• distutils	

• setuptools	

• PyPI	

• A way out
Wheel is the future.
Adapt today!
We Buy Cheese in a Cheese Shop

Weitere ähnliche Inhalte

Was ist angesagt? (6)

Python x Django
Python x DjangoPython x Django
Python x Django
 
Diving Into Puppet Providers Development: The Puppet-Corosync Module
Diving Into Puppet Providers Development: The Puppet-Corosync ModuleDiving Into Puppet Providers Development: The Puppet-Corosync Module
Diving Into Puppet Providers Development: The Puppet-Corosync Module
 
Managing a R&D Lab with Foreman
Managing a R&D Lab with ForemanManaging a R&D Lab with Foreman
Managing a R&D Lab with Foreman
 
Managing a R&D Lab with Foreman
Managing a R&D Lab with ForemanManaging a R&D Lab with Foreman
Managing a R&D Lab with Foreman
 
Coworking with git
Coworking with gitCoworking with git
Coworking with git
 
A call to give back puppetlabs-corosync to the community
A call to give back puppetlabs-corosync to the communityA call to give back puppetlabs-corosync to the community
A call to give back puppetlabs-corosync to the community
 

Andere mochten auch

01.python.开发最佳实践
01.python.开发最佳实践01.python.开发最佳实践
01.python.开发最佳实践
Na Lee
 
Jenkins djangovillage
Jenkins djangovillageJenkins djangovillage
Jenkins djangovillage
Lucio Grenzi
 
Function calling convention
Function calling conventionFunction calling convention
Function calling convention
Yuk SeungChan
 

Andere mochten auch (20)

Python, Development Environment for Windows
Python, Development Environment for WindowsPython, Development Environment for Windows
Python, Development Environment for Windows
 
Python Recipes for django girls seoul
Python Recipes for django girls seoulPython Recipes for django girls seoul
Python Recipes for django girls seoul
 
Django Dev Environment Howto
Django Dev Environment HowtoDjango Dev Environment Howto
Django Dev Environment Howto
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenv
 
2014_07_28_Django環境安裝以及 Django Book Chapter 4: Templates
2014_07_28_Django環境安裝以及 Django Book Chapter 4: Templates2014_07_28_Django環境安裝以及 Django Book Chapter 4: Templates
2014_07_28_Django環境安裝以及 Django Book Chapter 4: Templates
 
01.python.开发最佳实践
01.python.开发最佳实践01.python.开发最佳实践
01.python.开发最佳实践
 
Django district pip, virtualenv, virtualenv wrapper & more
Django district  pip, virtualenv, virtualenv wrapper & moreDjango district  pip, virtualenv, virtualenv wrapper & more
Django district pip, virtualenv, virtualenv wrapper & more
 
Jenkins djangovillage
Jenkins djangovillageJenkins djangovillage
Jenkins djangovillage
 
Virtualenv
VirtualenvVirtualenv
Virtualenv
 
Pip + virtualenv
Pip + virtualenvPip + virtualenv
Pip + virtualenv
 
Current State of Python Packaging
Current State of Python PackagingCurrent State of Python Packaging
Current State of Python Packaging
 
Python packaging and dependency resolution
Python packaging and dependency resolutionPython packaging and dependency resolution
Python packaging and dependency resolution
 
Django Deployment-in-AWS
Django Deployment-in-AWSDjango Deployment-in-AWS
Django Deployment-in-AWS
 
Using Python Packages - An Overview
Using Python Packages - An OverviewUsing Python Packages - An Overview
Using Python Packages - An Overview
 
Stack frame
Stack frameStack frame
Stack frame
 
Function calling convention
Function calling conventionFunction calling convention
Function calling convention
 
Django sharing
Django sharingDjango sharing
Django sharing
 
Django in Production
Django in ProductionDjango in Production
Django in Production
 
Django와 flask
Django와 flaskDjango와 flask
Django와 flask
 
Django, 저는 이렇게 씁니다.
Django, 저는 이렇게 씁니다.Django, 저는 이렇게 씁니다.
Django, 저는 이렇게 씁니다.
 

Ähnlich wie We Buy Cheese in a Cheese Shop

Making Py Pi Sux Less Key
Making Py Pi Sux Less KeyMaking Py Pi Sux Less Key
Making Py Pi Sux Less Key
Andreas Jung
 
the complete python bootcamp + 100 real world application
the complete python bootcamp + 100 real world applicationthe complete python bootcamp + 100 real world application
the complete python bootcamp + 100 real world application
Neamatullah
 

Ähnlich wie We Buy Cheese in a Cheese Shop (20)

Welcome to the Cheese Shop: setuptools, virtualenv and PyPUG
Welcome to the Cheese Shop: setuptools, virtualenv and PyPUGWelcome to the Cheese Shop: setuptools, virtualenv and PyPUG
Welcome to the Cheese Shop: setuptools, virtualenv and PyPUG
 
SoC Python Discussion Group
SoC Python Discussion GroupSoC Python Discussion Group
SoC Python Discussion Group
 
Python environments
Python environmentsPython environments
Python environments
 
The quality of the python ecosystem - and how we can protect it!
The quality of the python ecosystem - and how we can protect it!The quality of the python ecosystem - and how we can protect it!
The quality of the python ecosystem - and how we can protect it!
 
讓程式展現樂趣-玩出實驗精神與創造力 - PythonEdition
讓程式展現樂趣-玩出實驗精神與創造力 - PythonEdition讓程式展現樂趣-玩出實驗精神與創造力 - PythonEdition
讓程式展現樂趣-玩出實驗精神與創造力 - PythonEdition
 
Making Py Pi Sux Less Key
Making Py Pi Sux Less KeyMaking Py Pi Sux Less Key
Making Py Pi Sux Less Key
 
Mmmm, chocolatey goodness!
Mmmm, chocolatey goodness!Mmmm, chocolatey goodness!
Mmmm, chocolatey goodness!
 
Nagios Conference 2014 - Sally Reich - From Newb to Nagios in 90 Days
Nagios Conference 2014 - Sally Reich - From Newb to Nagios in 90 DaysNagios Conference 2014 - Sally Reich - From Newb to Nagios in 90 Days
Nagios Conference 2014 - Sally Reich - From Newb to Nagios in 90 Days
 
Python eggs (RO)
Python eggs (RO)Python eggs (RO)
Python eggs (RO)
 
Introduction to python 3 2nd round
Introduction to python 3   2nd roundIntroduction to python 3   2nd round
Introduction to python 3 2nd round
 
Python Tricks That You Can't Live Without
Python Tricks That You Can't Live WithoutPython Tricks That You Can't Live Without
Python Tricks That You Can't Live Without
 
Introduction to python 3
Introduction to python 3Introduction to python 3
Introduction to python 3
 
Io t
Io tIo t
Io t
 
Crab - A Python Framework for Building Recommendation Systems
Crab - A Python Framework for Building Recommendation SystemsCrab - A Python Framework for Building Recommendation Systems
Crab - A Python Framework for Building Recommendation Systems
 
Pipenv - The Python Companion You Wish You Always Had
Pipenv - The Python Companion You Wish You Always HadPipenv - The Python Companion You Wish You Always Had
Pipenv - The Python Companion You Wish You Always Had
 
Cooking is ... skill for geeks
Cooking is ... skill for geeksCooking is ... skill for geeks
Cooking is ... skill for geeks
 
the complete python bootcamp + 100 real world application
the complete python bootcamp + 100 real world applicationthe complete python bootcamp + 100 real world application
the complete python bootcamp + 100 real world application
 
DIY Home Smart Lighting System with Micropython - PyCon MY 2018
DIY Home Smart Lighting System with Micropython - PyCon MY 2018DIY Home Smart Lighting System with Micropython - PyCon MY 2018
DIY Home Smart Lighting System with Micropython - PyCon MY 2018
 
Picademy #3 Python Picamera GPIO Workshop
Picademy #3 Python Picamera GPIO WorkshopPicademy #3 Python Picamera GPIO Workshop
Picademy #3 Python Picamera GPIO Workshop
 
Pimp my Plone
Pimp my PlonePimp my Plone
Pimp my Plone
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 

We Buy Cheese in a Cheese Shop