SlideShare a Scribd company logo
1 of 23
Download to read offline
Python packaging:
How did we get here,
and where are we going?
Thomas Kluyver
PyCon UK, Cardiff, 2019
History
1994: Python 1.0
2019: Python 3.8
2000: Python 2.0 & distutils
2004: Setuptools
2008: pip
2003: PyPI
2007: virtualenv
History – distutils
1994: Python 1.0
2019: Python 3.8
2000: Python 2.0 & distutils
2004: Setuptools
2008: pip
2003: PyPI
2007: virtualenv
setup.py install
from distutils.core import setup
setup(name = "foo",
version = "1.0",
packages = [
"package",
"package.subpackage"
])
History - PyPI
1994: Python 1.0
2019: Python 3.8
2000: Python 2.0 & distutils
2004: Setuptools
2008: pip
2003: PyPI
2007: virtualenv
History – setuptools
1994: Python 1.0
2019: Python 3.8
2000: Python 2.0 & distutils
2004: Setuptools
2008: pip
2003: PyPI
2007: virtualenv
● easy_install
●
.egg packages
●
Many other features...
History – pip & virtualenv
1994: Python 1.0
2019: Python 3.8
2000: Python 2.0 & distutils
2004: Setuptools
2008: pip
2003: PyPI
2007: virtualenv
●
Uninstall!
●
Backtracking on eggs
Problem
setup.py runs on target system
●
User tools can’t control installation
●
Can’t switch packaging tools
●
Slow
Solutions
1994: Python 1.0
2019: Python 3.8
2000: Python 2.0 & distutils
2004: Setuptools
2008: pip 2013: wheels
2016: manylinux1 wheels
2016: PEP 518
2017: PEP 517
2003: PyPI
2007: virtualenv
Solutions – wheels
1994: Python 1.0
2019: Python 3.8
2000: Python 2.0 & distutils
2004: Setuptools
2008: pip 2013: wheels
2016: manylinux1 wheels
2016: PEP 518
2017: PEP 517
2003: PyPI
2007: virtualenv
●
No script to run
●
Pre-built binaries
●
For Linux from 2016
●
Flit (2015)
●
All you need are wheels
Source
folder
setup.py install
Installed
sdist
(.tar.gz)
setup.py
sdist Before wheels
Source
folder
setup.py install
Installed
sdist
(.tar.gz)
wheel
(.whl)
setup.py
bdist_wheel
Before PEP 517
Solutions – PEP 518
1994: Python 1.0
2019: Python 3.8
2000: Python 2.0 & distutils
2004: Setuptools
2008: pip 2013: wheels
2016: manylinux1 wheels
2016: PEP 518
2017: PEP 517
2003: PyPI
2007: virtualenv
● Packages to install before setup.py
● pyproject.toml
[build-system]
requires = ["flit"]
Solutions – PEP 517
1994: Python 1.0
2019: Python 3.8
2000: Python 2.0 & distutils
2004: Setuptools
2008: pip 2013: wheels
2016: manylinux1 wheels
2016: PEP 518
2017: PEP 517
2003: PyPI
2007: virtualenv
●
How to make a wheel
[build-system]
requires = ["flit"]
build-backend = "flit.buildapi"
●
Took almost 2 years
●
>800 messages
●
Alternative: PEP 516
Source
folder
setup.py install
Installed
sdist
(.tar.gz)
wheel
(.whl)
setup.py
bdist_wheel
Today
PEP 517
Source
folder
Installed
sdist
(.tar.gz)
wheel
(.whl)
Future
PEP 517
PEP 517
●
Frontend – e.g. pip
●
Backend – e.g. setuptools, flit
●
5 hook functions, like:
– get_requires_for_build_wheel()
– build_wheel()
Flit
●
Declarative metadata
●
Pyproject.toml
●
Simple packages only
[tool.flit.metadata]
module = "h5glance"
author = "European XFEL Gm
author-email = "cas-suppor
maintainer = "Thomas Kluyv
home-page = "https://githu
Poetry
Enscons
●
Scons build
system
●
Good for
compiled
code
extension = env.SharedLibrary(
target=ext_filename,
source=[
"crypt_blowfish-1.2/crypt
"crypt_blowfish-1.2/crypt
"crypt_blowfish-1.2/wrapp
"cryptacular/bcrypt/_bcry
],
LIBPREFIX="",
SHLIBSUFFIX=SHLIBSUFFIX,
CPPPATH=["crypt_blowfish-1.2"
CPPFLAGS=["-D__SKIP_GNU"],
Make your own backend
●
4 key functions
– build_sdist / _wheel
– get_requires_for_build_sdist / _wheel
●
Can extend another backend, e.g. flit,
setuptools
Make your own frontend
Use the pep517 library!
Why?
●
Repackaging, e.g. rpm, installers, Spack
●
Build packages in docker containers
●
Reproducible builds?
Thank-you
Thomas Kluyver
thomas@kluyver.me.uk – takluyver (GitHub/GitLab)
Thanks to:
Nathaniel Smith, Robert Collins, Nick Coghlan, Daniel
Holth, Donald Stufft, Paul Moore
& many other people

More Related Content

Similar to Python packaging: how did we get here, and where are we going?

Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017Codemotion
 
Python 2 is dead! Drag your old code into the modern age
Python 2 is dead! Drag your old code into the modern agePython 2 is dead! Drag your old code into the modern age
Python 2 is dead! Drag your old code into the modern ageBecky Smith
 
Current State of Python Packaging
Current State of Python PackagingCurrent State of Python Packaging
Current State of Python PackagingClayton Parker
 
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 PyPUGdwvisser
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesLarry Cai
 
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...Henry Schreiner
 
Python packaging and dependency resolution
Python packaging and dependency resolutionPython packaging and dependency resolution
Python packaging and dependency resolutionTatiana Al-Chueyr
 
Harness the speed of the wheel
Harness the speed of the wheelHarness the speed of the wheel
Harness the speed of the wheelxavfernandez
 
First python project
First python projectFirst python project
First python projectNeetu Jain
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvMarkus Zapke-Gründemann
 
PyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 TutorialPyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 TutorialJustin Lin
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingHenry Schreiner
 
Using the pip package manager for Odoo
Using the pip package manager for OdooUsing the pip package manager for Odoo
Using the pip package manager for OdooOdoo
 
Using the "pip" package manager for Odoo/OpenERP - Opendays 2014
Using the "pip" package manager for Odoo/OpenERP - Opendays 2014Using the "pip" package manager for Odoo/OpenERP - Opendays 2014
Using the "pip" package manager for Odoo/OpenERP - Opendays 2014Daniel Reis
 
Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!Ivan Chernoff
 
Time travel: Let’s learn from the history of Python packaging!
Time travel: Let’s learn from the history of Python packaging!Time travel: Let’s learn from the history of Python packaging!
Time travel: Let’s learn from the history of Python packaging!Kir Chou
 
Scientist meets web dev: how Python became the language of data
Scientist meets web dev: how Python became the language of dataScientist meets web dev: how Python became the language of data
Scientist meets web dev: how Python became the language of dataGael Varoquaux
 

Similar to Python packaging: how did we get here, and where are we going? (20)

Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
 
Python 2 is dead! Drag your old code into the modern age
Python 2 is dead! Drag your old code into the modern agePython 2 is dead! Drag your old code into the modern age
Python 2 is dead! Drag your old code into the modern age
 
Current State of Python Packaging
Current State of Python PackagingCurrent State of Python Packaging
Current State of Python Packaging
 
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
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutes
 
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
 
Python packaging and dependency resolution
Python packaging and dependency resolutionPython packaging and dependency resolution
Python packaging and dependency resolution
 
Python+gradle
Python+gradlePython+gradle
Python+gradle
 
Harness the speed of the wheel
Harness the speed of the wheelHarness the speed of the wheel
Harness the speed of the wheel
 
First python project
First python projectFirst python project
First python project
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenv
 
PyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 TutorialPyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 Tutorial
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance Tooling
 
Python on pi
Python on piPython on pi
Python on pi
 
Using the pip package manager for Odoo
Using the pip package manager for OdooUsing the pip package manager for Odoo
Using the pip package manager for Odoo
 
Using the "pip" package manager for Odoo/OpenERP - Opendays 2014
Using the "pip" package manager for Odoo/OpenERP - Opendays 2014Using the "pip" package manager for Odoo/OpenERP - Opendays 2014
Using the "pip" package manager for Odoo/OpenERP - Opendays 2014
 
Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!
 
Rina sim workshop
Rina sim workshopRina sim workshop
Rina sim workshop
 
Time travel: Let’s learn from the history of Python packaging!
Time travel: Let’s learn from the history of Python packaging!Time travel: Let’s learn from the history of Python packaging!
Time travel: Let’s learn from the history of Python packaging!
 
Scientist meets web dev: how Python became the language of data
Scientist meets web dev: how Python became the language of dataScientist meets web dev: how Python became the language of data
Scientist meets web dev: how Python became the language of data
 

Recently uploaded

Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 

Recently uploaded (20)

Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 

Python packaging: how did we get here, and where are we going?