SlideShare a Scribd company logo
Current State of Python
Packaging
Clayton Parker

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
A History Lesson
Let's start off with a bit of history.

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
Genesis
2000
distutils is added to the standard library in Python 1.6
2003
PyPi is up and running
2004
Setuptools and eggs are unleashed upon the world

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
Second Wave
2006
Jim Fulton creates Buildout
2007
Ian Bicking creates virtualenv
2008
Ian Bicking creates pip as an alternative to easy_install

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
The Fork
2008
Tarek Ziadé creates distribute, a fork of setuptools aiming
to keep the project alive
2008-2012
Packaging life is painful...An effort to fix packaging
(distutils2 / packaging) was abandoned.

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
The Present
2013
The wheel format is created out of PEP425 and PEP427
2013
pip starts using distlib, out of the ashes of distutils2 and
packaging

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
The Present
2013
distribute merges back into setuptools. After almost 10
years, setuptools gets to 1.0!!! And then a 2.0 not long
after.

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
How to install?
Easiest way to install a package is with pip:
$ pip install requests

Then to upgrade:
$ pip install --upgrade requests

Pretty simple eh?

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
What about easy_install?
Predecessor to pip
Still usable, but discouraged

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
Advanced features of pip
Can do more than just install
Ability to install from a requirements.txt file
Search PyPi
Show metadata about the current environment

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
How to create a package?
A basic setup.py
import os
from setuptools import setup
setup(
name='mypackage',
version='1.0',
description='Short description of the package',
long_description='reStructured text documentation',
url='http://github.com/username/mypackage',
license='BSD',
author='Author Name',
author_email='name@example.com',
py_modules=['mypackage'],
include_package_data=True,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Programming Language :: Python',
],
)
Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
PyPi config
Setup your ~/.pypirc
[distutils]
index-servers=
pypi
[pypi]
repository = https://pypi.python.org/pypi
username = dave
password = 12345

Yes, that password is in clear text. So be careful!

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
PyPi Upload
Uploading a new package to PyPi:
$ python setup.py register
$ python setup.py sdist upload
$ python setup.py bdist_wheel upload

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
Install your package
Now you can install your package just like any other:
$ pip install mypackage

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
Project environments
Two common ways of handling your project
Virtualenv (Also venv in Python 3.3+)
Buildout

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
Virtualenv
Used to create isolated Python environments:
$ sudo pip install virtualenv
$ virtualenv myenv
$ cd myenv

Now activate and see what python is available:
$ source bin/activate
(myenv)$ which python
/Users/clayton/myenv/bin/python

Also check out virtualenvwrapper for more awesomeness!

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
Buildout
Used to create repeatable environments:
$
$
$
$

git clone https://example.com/git/my-buildout.git
cd my-buildout
python bootstrap.py
bin/buildout

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
Links
Python Packaging User Guide
Detailed information about packaging and the tools that can be
used
Sharing Your Labor of Love
Excellent blog post detailing getting your package on PyPi

Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14

More Related Content

PDF
Python packaging and dependency resolution
PDF
Arbeiten mit distribute, pip und virtualenv
PPTX
Webinar - Managing Files with Puppet
PDF
Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...
PDF
Arbeiten mit distribute, pip und virtualenv
PDF
PuppetCamp SEA 1 - Use of Puppet
PDF
Pipfile, pipenv, pip… what?!
PDF
Isolated development in python
Python packaging and dependency resolution
Arbeiten mit distribute, pip und virtualenv
Webinar - Managing Files with Puppet
Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...
Arbeiten mit distribute, pip und virtualenv
PuppetCamp SEA 1 - Use of Puppet
Pipfile, pipenv, pip… what?!
Isolated development in python

What's hot (20)

PDF
PuppetDB: New Adventures in Higher-Order Automation - PuppetConf 2013
PPTX
Linux
PPTX
Packaging and distributing python code to Pypi
PDF
Puppet modules for Fun and Profit
PPTX
2015 bioinformatics bio_python
PDF
Paver: the build tool you missed
PDF
Rust + python: lessons learnt from building a toy filesystem
PDF
Py conkr 20150829_docker-python
PDF
rake puppetexpert:create - Puppet Camp Silicon Valley 2014
PDF
Python on a chip
PDF
Julia 0.5 and TensorFlow
PPT
Happy porting x86 application to android
PDF
Writing Swift code with great testability
PPT
Empacotamento e backport de aplicações em debian
PDF
Anatomy of a reusable module
PDF
Using Python Packages - An Overview
PDF
An introduction to cgroups and cgroupspy
PDF
Puppet: From 0 to 100 in 30 minutes
PDF
Puppet @ Seat
PDF
PuppetCamp SEA 1 - Version Control with Puppet
PuppetDB: New Adventures in Higher-Order Automation - PuppetConf 2013
Linux
Packaging and distributing python code to Pypi
Puppet modules for Fun and Profit
2015 bioinformatics bio_python
Paver: the build tool you missed
Rust + python: lessons learnt from building a toy filesystem
Py conkr 20150829_docker-python
rake puppetexpert:create - Puppet Camp Silicon Valley 2014
Python on a chip
Julia 0.5 and TensorFlow
Happy porting x86 application to android
Writing Swift code with great testability
Empacotamento e backport de aplicações em debian
Anatomy of a reusable module
Using Python Packages - An Overview
An introduction to cgroups and cgroupspy
Puppet: From 0 to 100 in 30 minutes
Puppet @ Seat
PuppetCamp SEA 1 - Version Control with Puppet
Ad

Viewers also liked (20)

PDF
Bento lunch talk
PDF
We Buy Cheese in a Cheese Shop
PDF
How to Write a Popular Python Library by Accident
PPTX
Python, Development Environment for Windows
PDF
Python Recipes for django girls seoul
PDF
The Django Book Chapter 9 - Django Workshop - Taipei.py
PPT
Digesting jQuery
PPT
Django-Queryset
PDF
Website optimization
PDF
Django - The Web framework for perfectionists with deadlines
PPTX
Super Advanced Python –act1
KEY
Overview of Testing Talks at Pycon
PDF
The Django Book, Chapter 16: django.contrib
PDF
라이트닝 토크 2015 파이콘
PDF
Django - The Web framework for perfectionists with deadlines
PDF
2007 - 应用系统脆弱性概论
PDF
User-centered open source
PDF
NoSql Day - Apertura
PDF
Vim for Mere Mortals
PDF
EuroDjangoCon 2009 - Ein Rückblick
Bento lunch talk
We Buy Cheese in a Cheese Shop
How to Write a Popular Python Library by Accident
Python, Development Environment for Windows
Python Recipes for django girls seoul
The Django Book Chapter 9 - Django Workshop - Taipei.py
Digesting jQuery
Django-Queryset
Website optimization
Django - The Web framework for perfectionists with deadlines
Super Advanced Python –act1
Overview of Testing Talks at Pycon
The Django Book, Chapter 16: django.contrib
라이트닝 토크 2015 파이콘
Django - The Web framework for perfectionists with deadlines
2007 - 应用系统脆弱性概论
User-centered open source
NoSql Day - Apertura
Vim for Mere Mortals
EuroDjangoCon 2009 - Ein Rückblick
Ad

Similar to Current State of Python Packaging (20)

PDF
Python packaging: how did we get here, and where are we going?
ODP
Introduction to Pelican
PDF
SciPy 2022 Scikit-HEP
PDF
delivering applications with zc.buildout and a distributed model - Plone Conf...
ODP
Python-specific packaging
PDF
Docker for data science
PDF
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
PDF
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
PPTX
First python project
PPTX
Calling python from r
PDF
Effective Python Package Management [PyCon Canada 2017]
PDF
Harness the speed of the wheel
PDF
Virtualenv
PPTX
How to deliver a Python project
PDF
PyCon 2013 : Scripting to PyPi to GitHub and More
PPTX
Versioning in Pipeline Pilot - Pipeline Pilot Forum 2018
PDF
Python eggs, zc.buildout, zopeproject and zope3
PDF
Open erp on ubuntu
ODP
Releasing and deploying python tools
PDF
The State of Pillow
Python packaging: how did we get here, and where are we going?
Introduction to Pelican
SciPy 2022 Scikit-HEP
delivering applications with zc.buildout and a distributed model - Plone Conf...
Python-specific packaging
Docker for data science
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
First python project
Calling python from r
Effective Python Package Management [PyCon Canada 2017]
Harness the speed of the wheel
Virtualenv
How to deliver a Python project
PyCon 2013 : Scripting to PyPi to GitHub and More
Versioning in Pipeline Pilot - Pipeline Pilot Forum 2018
Python eggs, zc.buildout, zopeproject and zope3
Open erp on ubuntu
Releasing and deploying python tools
The State of Pillow

More from Clayton Parker (20)

PDF
Customizing Your Shell With Dotfiles
PDF
Fuzzy Feelings for Fuzzy Matching
PDF
Exploring Code with Pry!
PDF
Zen and the Art of Python
PDF
So you think you can pdb?
PDF
Managing Chaos: Merging 120 Sites into a single Plone Multisite Solution
PDF
Notre Dame Seamless Syndication with Lineage
PDF
Pioneer a Strategic Change in Content Organization with Plone
PDF
Using Buildout, GenericSetup and a Policy Package to Rule the World
PDF
Make Plone Search Act Like Google Using Solr
PDF
Migrating from drupal to plone with transmogrifier
PDF
Buildout for the Future
PDF
Buildout future
PDF
Laying Pipe with Transmogrifier
PDF
LDAP and Active Directory Authentication in Plone
PDF
Code with Style - PyOhio
PDF
Code with style
PDF
Using Buildout to Develop and Deploy Python Projects
PDF
Generic Setup De-Mystified
PDF
Buildout: Fostering Repeatability
Customizing Your Shell With Dotfiles
Fuzzy Feelings for Fuzzy Matching
Exploring Code with Pry!
Zen and the Art of Python
So you think you can pdb?
Managing Chaos: Merging 120 Sites into a single Plone Multisite Solution
Notre Dame Seamless Syndication with Lineage
Pioneer a Strategic Change in Content Organization with Plone
Using Buildout, GenericSetup and a Policy Package to Rule the World
Make Plone Search Act Like Google Using Solr
Migrating from drupal to plone with transmogrifier
Buildout for the Future
Buildout future
Laying Pipe with Transmogrifier
LDAP and Active Directory Authentication in Plone
Code with Style - PyOhio
Code with style
Using Buildout to Develop and Deploy Python Projects
Generic Setup De-Mystified
Buildout: Fostering Repeatability

Recently uploaded (20)

PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Spectroscopy.pptx food analysis technology
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
sap open course for s4hana steps from ECC to s4
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Chapter 3 Spatial Domain Image Processing.pdf
Spectroscopy.pptx food analysis technology
MYSQL Presentation for SQL database connectivity
Reach Out and Touch Someone: Haptics and Empathic Computing
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
20250228 LYD VKU AI Blended-Learning.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Encapsulation_ Review paper, used for researhc scholars
sap open course for s4hana steps from ECC to s4
NewMind AI Weekly Chronicles - August'25 Week I
Mobile App Security Testing_ A Comprehensive Guide.pdf
The AUB Centre for AI in Media Proposal.docx
“AI and Expert System Decision Support & Business Intelligence Systems”
Big Data Technologies - Introduction.pptx
Programs and apps: productivity, graphics, security and other tools
Advanced methodologies resolving dimensionality complications for autism neur...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Network Security Unit 5.pdf for BCA BBA.
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Build a system with the filesystem maintained by OSTree @ COSCUP 2025

Current State of Python Packaging

  • 1. Current State of Python Packaging Clayton Parker Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 2. A History Lesson Let's start off with a bit of history. Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 3. Genesis 2000 distutils is added to the standard library in Python 1.6 2003 PyPi is up and running 2004 Setuptools and eggs are unleashed upon the world Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 4. Second Wave 2006 Jim Fulton creates Buildout 2007 Ian Bicking creates virtualenv 2008 Ian Bicking creates pip as an alternative to easy_install Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 5. The Fork 2008 Tarek Ziadé creates distribute, a fork of setuptools aiming to keep the project alive 2008-2012 Packaging life is painful...An effort to fix packaging (distutils2 / packaging) was abandoned. Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 6. The Present 2013 The wheel format is created out of PEP425 and PEP427 2013 pip starts using distlib, out of the ashes of distutils2 and packaging Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 7. The Present 2013 distribute merges back into setuptools. After almost 10 years, setuptools gets to 1.0!!! And then a 2.0 not long after. Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 8. How to install? Easiest way to install a package is with pip: $ pip install requests Then to upgrade: $ pip install --upgrade requests Pretty simple eh? Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 9. What about easy_install? Predecessor to pip Still usable, but discouraged Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 10. Advanced features of pip Can do more than just install Ability to install from a requirements.txt file Search PyPi Show metadata about the current environment Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 11. How to create a package? A basic setup.py import os from setuptools import setup setup( name='mypackage', version='1.0', description='Short description of the package', long_description='reStructured text documentation', url='http://github.com/username/mypackage', license='BSD', author='Author Name', author_email='name@example.com', py_modules=['mypackage'], include_package_data=True, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Programming Language :: Python', ], ) Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 12. PyPi config Setup your ~/.pypirc [distutils] index-servers= pypi [pypi] repository = https://pypi.python.org/pypi username = dave password = 12345 Yes, that password is in clear text. So be careful! Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 13. PyPi Upload Uploading a new package to PyPi: $ python setup.py register $ python setup.py sdist upload $ python setup.py bdist_wheel upload Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 14. Install your package Now you can install your package just like any other: $ pip install mypackage Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 15. Project environments Two common ways of handling your project Virtualenv (Also venv in Python 3.3+) Buildout Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 16. Virtualenv Used to create isolated Python environments: $ sudo pip install virtualenv $ virtualenv myenv $ cd myenv Now activate and see what python is available: $ source bin/activate (myenv)$ which python /Users/clayton/myenv/bin/python Also check out virtualenvwrapper for more awesomeness! Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 17. Buildout Used to create repeatable environments: $ $ $ $ git clone https://example.com/git/my-buildout.git cd my-buildout python bootstrap.py bin/buildout Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14
  • 18. Links Python Packaging User Guide Detailed information about packaging and the tools that can be used Sharing Your Labor of Love Excellent blog post detailing getting your package on PyPi Current State of Python Packaging - Clayton Parker - IndyPy 02/11/14