SlideShare a Scribd company logo
Python Packaging
and how to improve dependency
resolution
Tatiana Al-Chueyr Martins
@tati_alchueyr
PythonDay Pernambuco - 28th September 2013, Recife
tati_alchueyr.__doc__
● computer engineer by
UNICAMP
● senior software engineer
at Globo.com
● open source enthusiastic
● pythonist since 2003
#opensource #python #android #arduino
Packaging overview
Code Package Package
Server
Code
# life.py
def cleanup_house(address):
# ....
def walk_dog(dog_name):
# …
class Man(object):
__doc__ = “”
Package
# world.py
from life import Man
Package Server
https://pypi.python.org/
Packaging overview
Code Package Package
Server
Packaging creation
pack upload
Packaging creation
pack
# setup.py
(...)
$ python setup.py sdist
Packaging creation upload
# ~/.pypirc
[company]
username: Andreia
password: pwd
repository: http://pypi.company.com
$ python setup.py sdist upload -r company
Packaging usage
search &
download
use
Packaging usage search &
download
use
$ easy_install life
# something.py
from life import Man
Package
way to make the code available so developers
can use it
Package
setup.py
- contains lots of
metadata
- dependencies
- paths
Packages server: Cheese Shop
place where
developers can:
● find packages
● download packages
● upload packages
Brief on Python packaging history
● distutils
○ no dependecy management
○ problems between cross-platforms
○ no consistent way to reproduce an installation
○ not all metadata was handled
● setuptools: built on top of distutils
○ introduces easy_install
○ no way to uninstall installed packages
○ provides dependencies management
○ introduced eggs (similar to zip files)
● distribute: fork of setuptools
○ fork of setuptools
● distutils2 (discontinued?)
○ standard versioning (major.minor.micro)
○ setup.cfg: pulls metadata from setup.py file, without needing to run setup.py
○ which operating system requires which dependecy
pysetup: their interations easyinstall and setuptools with disutils- extract stuff from setup.
py
Distutils
● Started by Distutils SIG (Greg Ward)
● Added to stand lib in Python 1.6 (2000)
● solves
○ issues a variety of commands through setup.py
(crete tarball, install your project, compiling C
extensions of your python code)
● problems
○ no dependency management
○ problems between OS
○ no consistent way to reproduce an installation
○ not all metadata was handled
Brief on Python packaging history
PEP 386: changing the version comparison
modules
PEP 376: database of installed python
distributions
PEP 345: metadata for python software
packages 1.2
Chronology of Packaging by Ziade
http://ziade.org/2012/11/17/chronology-of-packaging/
Chronology of Packaging by Ziade
http://ziade.org/2012/11/17/chronology-of-packaging/
Brief on Python packaging history
old busted new hawtness
setuptools -> distribute
easy_install -> pip
system python -> virtual-env
Virtualenv
“virtualenv is a tool to create isolated Python
environments.”
https://pypi.python.org/pypi/virtualenv
VirtualenvWrapper
“virtualenvwrapper is a set of extensions to Ian
Bicking's virtualenv tool” -- Doug Hellmann
https://pypi.python.org/pypi/virtualenvwrapper
$ mkvirtualenv <name>
--python=
--no-site-packages=
--system-site-packages=
$ rmvirtualenv
$VIRTUALENVWRAPPER_HOOK_DIR/initialize
Pip
A tool for installing and managing Python
packages.
http://www.pip-installer.org/en/latest/index.html
$ pip search numpy
$ pip help
$ pip install flask
$ pip uninstall django
$ pip freeze
--no-deps
--extra-index-url --index-url
--download-cache --proxy --no-install
git / egg / ...
pip install -r requirements.txt
Pip
(...)
“This allows users to be in control of
specifying an environment of packages that are
known to work together.”
(...)
http://www.pip-installer.org/en/latest/cookbook.html
How Pip deals with dependency
inconsistencies?
Pip install -r requirements.txt
B
A
# requirements.txt
B
C
# B/setup.py
A==1.0.0
# C/setup.py
A>=2.0.0 C
what version of A is
installed?
$ pip install -r
requirements.txt
Pip install -r requirements.txt
# requirements.txt
B
C
# B/setup.py
A==1.0.0
# C/setup.py
A>=2.0.0
$ pip freeze
A==1.0.0
B==1.0.0
C==1.00.
B
A
C
Pip install -r requirements.txt
# requirements.txt
C
B
# B/setup.py
A==1.0.0
# C/setup.py
A>=2.0.0
what happens? error?
$ pip install -r
requirements.txt
B
A
C
Pip install -r requirements.txt
# requirements.txt
C
B
# B/setup.py
A==1.0.0
# C/setup.py
A>=2.0.0
$ pip freeze
A==2.0.0
B==1.0.0
C==1.00.
B
A
C
Pip install -r requirements.txt
# requirements.txt
C
B
A==1.5.0
# B/setup.py
A==1.0.0
# C/setup.py
A>=2.0.0
what happens? error?
$ pip install -r
requirements.txt
B
A
C
Pip install -r requirements.txt
# requirements.txt
C
B
A==1.5.0
# B/setup.py
A==1.0.0
# C/setup.py
A>=2.0.0
$ pip freeze
A==1.5.0
B==1.0.0
C==1.00.
B
A
C
Explanation
Considering pip 1.5.4:
● pip doesn’t identify conflicts of interest
between dependency packages
● why?
○ pip solves dependencies analyzing them in a list
○ it only concerns in solving the dependencies of the
package being analyzed at that moment
○ the last package dependencies prevail
provided a package at pypi, how do I
know its dependencies?
provided a package at pypi, how do I
know its dependencies?
manually looking to them
dependencies of a package
if you install a package, you can use:
$ pip show C
To show dependencies, but they don’t contain
versions - only packages names
use pipdeptree
$ pip freeze
A==1.0.0
B==1.0.0
C==1.0.0
$ pipdeptree
Warning!!! Possible confusing dependencies found:
* B==1.0.0 -> A [required: ==1.0.0, installed: 1.0.0]
C==1.0.0 -> A [required: >=2.0.0, installed: 1.0.0]
------------------------------------------------------------------------
wsgiref==0.1.2
B==1.0.0
- A [required: ==1.0.0, installed: 1.0.0]
C==1.0.0
- A [required: >=2.0.0, installed: 1.0.0]
Does the requirements.txt assure
your environment will be reproduced
always the same?
Does the requirements.txt assure
your environment will be reproduced
always the same?
not necessarily
requirements.txt
if you want to assert the same behavior in all
installations:
● don’t use >=, <=, >, <
● pin all dependencies (even deps of deps)
● pin exactly (==)
some extra notes
Have your own pypi / proxy
old versions might be removed from remote
repositories
the repository might be down during a deploy,
and can crash your application
Have your own pypi / proxy
Have your own pypi / proxy
host a PyPI mirror (bandersnatch, pep381client)
host a PyPI cache (devp)
PyPI server implementations:
● resilient (devpi)
● AWS S3 PyPI server (pypicloud)
● minimalistic PyPI (pypiserver)
● PyPI written in Django (chishop, djangopypi)
Many others..!
At globo.com we have both a PyPI server and a PyPI cache
proxy.
dumb ways to manage your
dependencies….
1. understand the tools you use to
manage dependencies
2. keep your dependencies up to date,
but take care with >= / >
3. take care of your cheese-shop
use pipdeptree package!
thanks!
slideshare: @alchueyr
questions?
Tatiana Al-Chueyr Martins
@tati_alchueyr
last note
http://pypi-ranking.info/author

More Related Content

What's hot

Isolated development in python
Isolated development in pythonIsolated development in python
Isolated development in python
Andrés J. Díaz
 
Puppet modules for Fun and Profit
Puppet modules for Fun and ProfitPuppet modules for Fun and Profit
Puppet modules for Fun and Profit
Alessandro Franceschi
 
Paver: the build tool you missed
Paver: the build tool you missedPaver: the build tool you missed
Paver: the build tool you missedalmadcz
 
2015 bioinformatics bio_python
2015 bioinformatics bio_python2015 bioinformatics bio_python
2015 bioinformatics bio_python
Prof. Wim Van Criekinge
 
Py conkr 20150829_docker-python
Py conkr 20150829_docker-pythonPy conkr 20150829_docker-python
Py conkr 20150829_docker-python
Eric Ahn
 
Packaging and distributing python code to Pypi
Packaging and distributing python code to PypiPackaging and distributing python code to Pypi
Packaging and distributing python code to Pypi
MicroPyramid .
 
rake puppetexpert:create - Puppet Camp Silicon Valley 2014
rake puppetexpert:create - Puppet Camp Silicon Valley 2014rake puppetexpert:create - Puppet Camp Silicon Valley 2014
rake puppetexpert:create - Puppet Camp Silicon Valley 2014
nvpuppet
 
Julia 0.5 and TensorFlow
Julia 0.5 and TensorFlowJulia 0.5 and TensorFlow
Julia 0.5 and TensorFlow
Dataya Nolja
 
Rust + python: lessons learnt from building a toy filesystem
Rust + python: lessons learnt from building a toy filesystemRust + python: lessons learnt from building a toy filesystem
Rust + python: lessons learnt from building a toy filesystem
ChengHui Weng
 
Empacotamento e backport de aplicações em debian
Empacotamento e backport de aplicações em debianEmpacotamento e backport de aplicações em debian
Empacotamento e backport de aplicações em debianAndre Ferraz
 
Happy porting x86 application to android
Happy porting x86 application to androidHappy porting x86 application to android
Happy porting x86 application to android
Owen Hsu
 
Puppet: From 0 to 100 in 30 minutes
Puppet: From 0 to 100 in 30 minutesPuppet: From 0 to 100 in 30 minutes
Puppet: From 0 to 100 in 30 minutes
Alessandro Franceschi
 
Writing Swift code with great testability
Writing Swift code with great testabilityWriting Swift code with great testability
Writing Swift code with great testability
John Sundell
 
Anatomy of a reusable module
Anatomy of a reusable moduleAnatomy of a reusable module
Anatomy of a reusable module
Alessandro Franceschi
 
Using Python Packages - An Overview
Using Python Packages - An OverviewUsing Python Packages - An Overview
Using Python Packages - An Overview
Daniel Hepper
 
Python on a chip
Python on a chipPython on a chip
Python on a chip
stoggi
 
An introduction to cgroups and cgroupspy
An introduction to cgroups and cgroupspyAn introduction to cgroups and cgroupspy
An introduction to cgroups and cgroupspy
vpetersson
 
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with Puppet
Walter Heck
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of Puppet
Walter Heck
 

What's hot (20)

Isolated development in python
Isolated development in pythonIsolated development in python
Isolated development in python
 
Puppet modules for Fun and Profit
Puppet modules for Fun and ProfitPuppet modules for Fun and Profit
Puppet modules for Fun and Profit
 
Linux
LinuxLinux
Linux
 
Paver: the build tool you missed
Paver: the build tool you missedPaver: the build tool you missed
Paver: the build tool you missed
 
2015 bioinformatics bio_python
2015 bioinformatics bio_python2015 bioinformatics bio_python
2015 bioinformatics bio_python
 
Py conkr 20150829_docker-python
Py conkr 20150829_docker-pythonPy conkr 20150829_docker-python
Py conkr 20150829_docker-python
 
Packaging and distributing python code to Pypi
Packaging and distributing python code to PypiPackaging and distributing python code to Pypi
Packaging and distributing python code to Pypi
 
rake puppetexpert:create - Puppet Camp Silicon Valley 2014
rake puppetexpert:create - Puppet Camp Silicon Valley 2014rake puppetexpert:create - Puppet Camp Silicon Valley 2014
rake puppetexpert:create - Puppet Camp Silicon Valley 2014
 
Julia 0.5 and TensorFlow
Julia 0.5 and TensorFlowJulia 0.5 and TensorFlow
Julia 0.5 and TensorFlow
 
Rust + python: lessons learnt from building a toy filesystem
Rust + python: lessons learnt from building a toy filesystemRust + python: lessons learnt from building a toy filesystem
Rust + python: lessons learnt from building a toy filesystem
 
Empacotamento e backport de aplicações em debian
Empacotamento e backport de aplicações em debianEmpacotamento e backport de aplicações em debian
Empacotamento e backport de aplicações em debian
 
Happy porting x86 application to android
Happy porting x86 application to androidHappy porting x86 application to android
Happy porting x86 application to android
 
Puppet: From 0 to 100 in 30 minutes
Puppet: From 0 to 100 in 30 minutesPuppet: From 0 to 100 in 30 minutes
Puppet: From 0 to 100 in 30 minutes
 
Writing Swift code with great testability
Writing Swift code with great testabilityWriting Swift code with great testability
Writing Swift code with great testability
 
Anatomy of a reusable module
Anatomy of a reusable moduleAnatomy of a reusable module
Anatomy of a reusable module
 
Using Python Packages - An Overview
Using Python Packages - An OverviewUsing Python Packages - An Overview
Using Python Packages - An Overview
 
Python on a chip
Python on a chipPython on a chip
Python on a chip
 
An introduction to cgroups and cgroupspy
An introduction to cgroups and cgroupspyAn introduction to cgroups and cgroupspy
An introduction to cgroups and cgroupspy
 
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with Puppet
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of Puppet
 

Viewers also liked

Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and Semantics
Tatiana Al-Chueyr
 
Automatic English text correction
Automatic English text correctionAutomatic English text correction
Automatic English text correction
Tatiana Al-Chueyr
 
We Buy Cheese in a Cheese Shop
We Buy Cheese in a Cheese ShopWe Buy Cheese in a Cheese Shop
We Buy Cheese in a Cheese Shop
Tzu-ping Chung
 
How to Write a Popular Python Library by Accident
How to Write a Popular Python Library by AccidentHow to Write a Popular Python Library by Accident
How to Write a Popular Python Library by Accident
Daniel Greenfeld
 
Python, Development Environment for Windows
Python, Development Environment for WindowsPython, Development Environment for Windows
Python, Development Environment for Windows
Kwangyoun Jung
 
Python Recipes for django girls seoul
Python Recipes for django girls seoulPython Recipes for django girls seoul
Python Recipes for django girls seoul
Joeun Park
 
PythonBrasil[8] closing
PythonBrasil[8] closingPythonBrasil[8] closing
PythonBrasil[8] closing
Tatiana Al-Chueyr
 
Django - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlinesDjango - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlines
Markus Zapke-Gründemann
 
Overview of Testing Talks at Pycon
Overview of Testing Talks at PyconOverview of Testing Talks at Pycon
Overview of Testing Talks at Pycon
Jacqueline Kazil
 
2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to python2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to python
Jiho Lee
 
Django - The Web framework for perfectionists with deadlines
Django - The Web framework  for perfectionists with deadlinesDjango - The Web framework  for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlines
Markus Zapke-Gründemann
 
Digesting jQuery
Digesting jQueryDigesting jQuery
Digesting jQuery
Mindfire Solutions
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1
Ke Wei Louis
 
Rabbitmq & Postgresql
Rabbitmq & PostgresqlRabbitmq & Postgresql
Rabbitmq & Postgresql
Lucio Grenzi
 
Django mongodb -djangoday_
Django mongodb -djangoday_Django mongodb -djangoday_
Django mongodb -djangoday_WEBdeBS
 
Django e il Rap Elia Contini
Django e il Rap Elia ContiniDjango e il Rap Elia Contini
Django e il Rap Elia ContiniWEBdeBS
 
PyClab.__init__(self)
PyClab.__init__(self)PyClab.__init__(self)
PyClab.__init__(self)
Tzu-ping Chung
 
2 × 3 = 6
2 × 3 = 62 × 3 = 6
2 × 3 = 6
Tzu-ping Chung
 

Viewers also liked (20)

Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and Semantics
 
Automatic English text correction
Automatic English text correctionAutomatic English text correction
Automatic English text correction
 
Bento lunch talk
Bento   lunch talkBento   lunch talk
Bento lunch talk
 
We Buy Cheese in a Cheese Shop
We Buy Cheese in a Cheese ShopWe Buy Cheese in a Cheese Shop
We Buy Cheese in a Cheese Shop
 
How to Write a Popular Python Library by Accident
How to Write a Popular Python Library by AccidentHow to Write a Popular Python Library by Accident
How to Write a Popular Python Library by Accident
 
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
 
PythonBrasil[8] closing
PythonBrasil[8] closingPythonBrasil[8] closing
PythonBrasil[8] closing
 
Django - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlinesDjango - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlines
 
Overview of Testing Talks at Pycon
Overview of Testing Talks at PyconOverview of Testing Talks at Pycon
Overview of Testing Talks at Pycon
 
EuroDjangoCon 2009 - Ein Rückblick
EuroDjangoCon 2009 - Ein RückblickEuroDjangoCon 2009 - Ein Rückblick
EuroDjangoCon 2009 - Ein Rückblick
 
2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to python2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to python
 
Django - The Web framework for perfectionists with deadlines
Django - The Web framework  for perfectionists with deadlinesDjango - The Web framework  for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlines
 
Digesting jQuery
Digesting jQueryDigesting jQuery
Digesting jQuery
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1
 
Rabbitmq & Postgresql
Rabbitmq & PostgresqlRabbitmq & Postgresql
Rabbitmq & Postgresql
 
Django mongodb -djangoday_
Django mongodb -djangoday_Django mongodb -djangoday_
Django mongodb -djangoday_
 
Django e il Rap Elia Contini
Django e il Rap Elia ContiniDjango e il Rap Elia Contini
Django e il Rap Elia Contini
 
PyClab.__init__(self)
PyClab.__init__(self)PyClab.__init__(self)
PyClab.__init__(self)
 
2 × 3 = 6
2 × 3 = 62 × 3 = 6
2 × 3 = 6
 

Similar to Python packaging and dependency resolution

Virtualenv
VirtualenvVirtualenv
Virtualenv
WEBdeBS
 
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
Codemotion
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutes
Larry Cai
 
First python project
First python projectFirst python project
First python project
Neetu Jain
 
Python+gradle
Python+gradlePython+gradle
Python+gradle
Stephen Holsapple
 
5 minute intro to virtualenv
5 minute intro to virtualenv5 minute intro to virtualenv
5 minute intro to virtualenvamenasse
 
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
Jacqueline Kazil
 
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to ProductionRuby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Fabio Kung
 
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
dwvisser
 
Docker for data science
Docker for data scienceDocker for data science
Docker for data science
Calvin Giles
 
Python environments
Python environmentsPython environments
Python environments
Glen Zangirolami
 
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)Aaron Meurer
 
Packaging in packaging: dh-virtualenv
Packaging in packaging: dh-virtualenvPackaging in packaging: dh-virtualenv
Packaging in packaging: dh-virtualenv
Jyrki Pulliainen
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MoreMatt Harrison
 
Virtualenv
VirtualenvVirtualenv
Virtualenv
Jon Nials
 
Python Dependency Management - PyconDE 2018
Python Dependency Management - PyconDE 2018Python Dependency Management - PyconDE 2018
Python Dependency Management - PyconDE 2018
Patrick Muehlbauer
 
OpenStack for Centos
OpenStack for CentosOpenStack for Centos
OpenStack for Centos
Chandan Kumar
 
Open erp on ubuntu
Open erp on ubuntuOpen erp on ubuntu
Open erp on ubuntuIker Coranti
 
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
Daniel Reis
 
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
 

Similar to Python packaging and dependency resolution (20)

Virtualenv
VirtualenvVirtualenv
Virtualenv
 
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 virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutes
 
First python project
First python projectFirst python project
First python project
 
Python+gradle
Python+gradlePython+gradle
Python+gradle
 
5 minute intro to virtualenv
5 minute intro to virtualenv5 minute intro to virtualenv
5 minute intro to virtualenv
 
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
 
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to ProductionRuby and Rails Packaging to Production
Ruby and Rails Packaging to Production
 
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
 
Docker for data science
Docker for data scienceDocker for data science
Docker for data science
 
Python environments
Python environmentsPython environments
Python environments
 
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
 
Packaging in packaging: dh-virtualenv
Packaging in packaging: dh-virtualenvPackaging in packaging: dh-virtualenv
Packaging in packaging: dh-virtualenv
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and More
 
Virtualenv
VirtualenvVirtualenv
Virtualenv
 
Python Dependency Management - PyconDE 2018
Python Dependency Management - PyconDE 2018Python Dependency Management - PyconDE 2018
Python Dependency Management - PyconDE 2018
 
OpenStack for Centos
OpenStack for CentosOpenStack for Centos
OpenStack for Centos
 
Open erp on ubuntu
Open erp on ubuntuOpen erp on ubuntu
Open erp on ubuntu
 
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
 
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
 

More from Tatiana Al-Chueyr

Integrating ChatGPT with Apache Airflow
Integrating ChatGPT with Apache AirflowIntegrating ChatGPT with Apache Airflow
Integrating ChatGPT with Apache Airflow
Tatiana Al-Chueyr
 
Contributing to Apache Airflow
Contributing to Apache AirflowContributing to Apache Airflow
Contributing to Apache Airflow
Tatiana Al-Chueyr
 
From an idea to production: building a recommender for BBC Sounds
From an idea to production: building a recommender for BBC SoundsFrom an idea to production: building a recommender for BBC Sounds
From an idea to production: building a recommender for BBC Sounds
Tatiana Al-Chueyr
 
Precomputing recommendations with Apache Beam
Precomputing recommendations with Apache BeamPrecomputing recommendations with Apache Beam
Precomputing recommendations with Apache Beam
Tatiana Al-Chueyr
 
Scaling machine learning to millions of users with Apache Beam
Scaling machine learning to millions of users with Apache BeamScaling machine learning to millions of users with Apache Beam
Scaling machine learning to millions of users with Apache Beam
Tatiana Al-Chueyr
 
Clearing Airflow Obstructions
Clearing Airflow ObstructionsClearing Airflow Obstructions
Clearing Airflow Obstructions
Tatiana Al-Chueyr
 
Scaling machine learning workflows with Apache Beam
Scaling machine learning workflows with Apache BeamScaling machine learning workflows with Apache Beam
Scaling machine learning workflows with Apache Beam
Tatiana Al-Chueyr
 
Responsible machine learning at the BBC
Responsible machine learning at the BBCResponsible machine learning at the BBC
Responsible machine learning at the BBC
Tatiana Al-Chueyr
 
Powering machine learning workflows with Apache Airflow and Python
Powering machine learning workflows with Apache Airflow and PythonPowering machine learning workflows with Apache Airflow and Python
Powering machine learning workflows with Apache Airflow and Python
Tatiana Al-Chueyr
 
Responsible Machine Learning at the BBC
Responsible Machine Learning at the BBCResponsible Machine Learning at the BBC
Responsible Machine Learning at the BBC
Tatiana Al-Chueyr
 
PyConUK 2018 - Journey from HTTP to gRPC
PyConUK 2018 - Journey from HTTP to gRPCPyConUK 2018 - Journey from HTTP to gRPC
PyConUK 2018 - Journey from HTTP to gRPC
Tatiana Al-Chueyr
 
Sprint cPython at Globo.com
Sprint cPython at Globo.comSprint cPython at Globo.com
Sprint cPython at Globo.com
Tatiana Al-Chueyr
 
PythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummiesPythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummies
Tatiana Al-Chueyr
 
QCon SP - recommended for you
QCon SP - recommended for youQCon SP - recommended for you
QCon SP - recommended for you
Tatiana Al-Chueyr
 
Crafting APIs
Crafting APIsCrafting APIs
Crafting APIs
Tatiana Al-Chueyr
 
PyConUK 2016 - Writing English Right
PyConUK 2016  - Writing English RightPyConUK 2016  - Writing English Right
PyConUK 2016 - Writing English Right
Tatiana Al-Chueyr
 
InVesalius: 3D medical imaging software
InVesalius: 3D medical imaging softwareInVesalius: 3D medical imaging software
InVesalius: 3D medical imaging software
Tatiana Al-Chueyr
 
Rio info 2013 - Linked Data at Globo.com
Rio info 2013 - Linked Data at Globo.comRio info 2013 - Linked Data at Globo.com
Rio info 2013 - Linked Data at Globo.com
Tatiana Al-Chueyr
 
Desarollando aplicaciones web en python con pruebas
Desarollando aplicaciones web en python con pruebasDesarollando aplicaciones web en python con pruebas
Desarollando aplicaciones web en python con pruebasTatiana Al-Chueyr
 
Desarollando aplicaciones móviles con Python y Android
Desarollando aplicaciones móviles con Python y AndroidDesarollando aplicaciones móviles con Python y Android
Desarollando aplicaciones móviles con Python y Android
Tatiana Al-Chueyr
 

More from Tatiana Al-Chueyr (20)

Integrating ChatGPT with Apache Airflow
Integrating ChatGPT with Apache AirflowIntegrating ChatGPT with Apache Airflow
Integrating ChatGPT with Apache Airflow
 
Contributing to Apache Airflow
Contributing to Apache AirflowContributing to Apache Airflow
Contributing to Apache Airflow
 
From an idea to production: building a recommender for BBC Sounds
From an idea to production: building a recommender for BBC SoundsFrom an idea to production: building a recommender for BBC Sounds
From an idea to production: building a recommender for BBC Sounds
 
Precomputing recommendations with Apache Beam
Precomputing recommendations with Apache BeamPrecomputing recommendations with Apache Beam
Precomputing recommendations with Apache Beam
 
Scaling machine learning to millions of users with Apache Beam
Scaling machine learning to millions of users with Apache BeamScaling machine learning to millions of users with Apache Beam
Scaling machine learning to millions of users with Apache Beam
 
Clearing Airflow Obstructions
Clearing Airflow ObstructionsClearing Airflow Obstructions
Clearing Airflow Obstructions
 
Scaling machine learning workflows with Apache Beam
Scaling machine learning workflows with Apache BeamScaling machine learning workflows with Apache Beam
Scaling machine learning workflows with Apache Beam
 
Responsible machine learning at the BBC
Responsible machine learning at the BBCResponsible machine learning at the BBC
Responsible machine learning at the BBC
 
Powering machine learning workflows with Apache Airflow and Python
Powering machine learning workflows with Apache Airflow and PythonPowering machine learning workflows with Apache Airflow and Python
Powering machine learning workflows with Apache Airflow and Python
 
Responsible Machine Learning at the BBC
Responsible Machine Learning at the BBCResponsible Machine Learning at the BBC
Responsible Machine Learning at the BBC
 
PyConUK 2018 - Journey from HTTP to gRPC
PyConUK 2018 - Journey from HTTP to gRPCPyConUK 2018 - Journey from HTTP to gRPC
PyConUK 2018 - Journey from HTTP to gRPC
 
Sprint cPython at Globo.com
Sprint cPython at Globo.comSprint cPython at Globo.com
Sprint cPython at Globo.com
 
PythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummiesPythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummies
 
QCon SP - recommended for you
QCon SP - recommended for youQCon SP - recommended for you
QCon SP - recommended for you
 
Crafting APIs
Crafting APIsCrafting APIs
Crafting APIs
 
PyConUK 2016 - Writing English Right
PyConUK 2016  - Writing English RightPyConUK 2016  - Writing English Right
PyConUK 2016 - Writing English Right
 
InVesalius: 3D medical imaging software
InVesalius: 3D medical imaging softwareInVesalius: 3D medical imaging software
InVesalius: 3D medical imaging software
 
Rio info 2013 - Linked Data at Globo.com
Rio info 2013 - Linked Data at Globo.comRio info 2013 - Linked Data at Globo.com
Rio info 2013 - Linked Data at Globo.com
 
Desarollando aplicaciones web en python con pruebas
Desarollando aplicaciones web en python con pruebasDesarollando aplicaciones web en python con pruebas
Desarollando aplicaciones web en python con pruebas
 
Desarollando aplicaciones móviles con Python y Android
Desarollando aplicaciones móviles con Python y AndroidDesarollando aplicaciones móviles con Python y Android
Desarollando aplicaciones móviles con Python y Android
 

Recently uploaded

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 

Recently uploaded (20)

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 

Python packaging and dependency resolution

  • 1. Python Packaging and how to improve dependency resolution Tatiana Al-Chueyr Martins @tati_alchueyr PythonDay Pernambuco - 28th September 2013, Recife
  • 2. tati_alchueyr.__doc__ ● computer engineer by UNICAMP ● senior software engineer at Globo.com ● open source enthusiastic ● pythonist since 2003 #opensource #python #android #arduino
  • 4. Code # life.py def cleanup_house(address): # .... def walk_dog(dog_name): # … class Man(object): __doc__ = “”
  • 10. Packaging creation upload # ~/.pypirc [company] username: Andreia password: pwd repository: http://pypi.company.com $ python setup.py sdist upload -r company
  • 12. Packaging usage search & download use $ easy_install life # something.py from life import Man
  • 13. Package way to make the code available so developers can use it
  • 14. Package setup.py - contains lots of metadata - dependencies - paths
  • 15. Packages server: Cheese Shop place where developers can: ● find packages ● download packages ● upload packages
  • 16. Brief on Python packaging history ● distutils ○ no dependecy management ○ problems between cross-platforms ○ no consistent way to reproduce an installation ○ not all metadata was handled ● setuptools: built on top of distutils ○ introduces easy_install ○ no way to uninstall installed packages ○ provides dependencies management ○ introduced eggs (similar to zip files) ● distribute: fork of setuptools ○ fork of setuptools ● distutils2 (discontinued?) ○ standard versioning (major.minor.micro) ○ setup.cfg: pulls metadata from setup.py file, without needing to run setup.py ○ which operating system requires which dependecy pysetup: their interations easyinstall and setuptools with disutils- extract stuff from setup. py
  • 17. Distutils ● Started by Distutils SIG (Greg Ward) ● Added to stand lib in Python 1.6 (2000) ● solves ○ issues a variety of commands through setup.py (crete tarball, install your project, compiling C extensions of your python code) ● problems ○ no dependency management ○ problems between OS ○ no consistent way to reproduce an installation ○ not all metadata was handled
  • 18. Brief on Python packaging history PEP 386: changing the version comparison modules PEP 376: database of installed python distributions PEP 345: metadata for python software packages 1.2
  • 19. Chronology of Packaging by Ziade http://ziade.org/2012/11/17/chronology-of-packaging/
  • 20. Chronology of Packaging by Ziade http://ziade.org/2012/11/17/chronology-of-packaging/
  • 21. Brief on Python packaging history old busted new hawtness setuptools -> distribute easy_install -> pip system python -> virtual-env
  • 22. Virtualenv “virtualenv is a tool to create isolated Python environments.” https://pypi.python.org/pypi/virtualenv
  • 23. VirtualenvWrapper “virtualenvwrapper is a set of extensions to Ian Bicking's virtualenv tool” -- Doug Hellmann https://pypi.python.org/pypi/virtualenvwrapper $ mkvirtualenv <name> --python= --no-site-packages= --system-site-packages= $ rmvirtualenv $VIRTUALENVWRAPPER_HOOK_DIR/initialize
  • 24. Pip A tool for installing and managing Python packages. http://www.pip-installer.org/en/latest/index.html $ pip search numpy $ pip help $ pip install flask $ pip uninstall django $ pip freeze --no-deps --extra-index-url --index-url --download-cache --proxy --no-install git / egg / ... pip install -r requirements.txt
  • 25. Pip (...) “This allows users to be in control of specifying an environment of packages that are known to work together.” (...) http://www.pip-installer.org/en/latest/cookbook.html
  • 26. How Pip deals with dependency inconsistencies?
  • 27. Pip install -r requirements.txt B A # requirements.txt B C # B/setup.py A==1.0.0 # C/setup.py A>=2.0.0 C what version of A is installed? $ pip install -r requirements.txt
  • 28. Pip install -r requirements.txt # requirements.txt B C # B/setup.py A==1.0.0 # C/setup.py A>=2.0.0 $ pip freeze A==1.0.0 B==1.0.0 C==1.00. B A C
  • 29. Pip install -r requirements.txt # requirements.txt C B # B/setup.py A==1.0.0 # C/setup.py A>=2.0.0 what happens? error? $ pip install -r requirements.txt B A C
  • 30. Pip install -r requirements.txt # requirements.txt C B # B/setup.py A==1.0.0 # C/setup.py A>=2.0.0 $ pip freeze A==2.0.0 B==1.0.0 C==1.00. B A C
  • 31. Pip install -r requirements.txt # requirements.txt C B A==1.5.0 # B/setup.py A==1.0.0 # C/setup.py A>=2.0.0 what happens? error? $ pip install -r requirements.txt B A C
  • 32. Pip install -r requirements.txt # requirements.txt C B A==1.5.0 # B/setup.py A==1.0.0 # C/setup.py A>=2.0.0 $ pip freeze A==1.5.0 B==1.0.0 C==1.00. B A C
  • 33. Explanation Considering pip 1.5.4: ● pip doesn’t identify conflicts of interest between dependency packages ● why? ○ pip solves dependencies analyzing them in a list ○ it only concerns in solving the dependencies of the package being analyzed at that moment ○ the last package dependencies prevail
  • 34. provided a package at pypi, how do I know its dependencies?
  • 35. provided a package at pypi, how do I know its dependencies? manually looking to them
  • 36. dependencies of a package if you install a package, you can use: $ pip show C To show dependencies, but they don’t contain versions - only packages names
  • 37. use pipdeptree $ pip freeze A==1.0.0 B==1.0.0 C==1.0.0 $ pipdeptree Warning!!! Possible confusing dependencies found: * B==1.0.0 -> A [required: ==1.0.0, installed: 1.0.0] C==1.0.0 -> A [required: >=2.0.0, installed: 1.0.0] ------------------------------------------------------------------------ wsgiref==0.1.2 B==1.0.0 - A [required: ==1.0.0, installed: 1.0.0] C==1.0.0 - A [required: >=2.0.0, installed: 1.0.0]
  • 38. Does the requirements.txt assure your environment will be reproduced always the same?
  • 39. Does the requirements.txt assure your environment will be reproduced always the same? not necessarily
  • 40. requirements.txt if you want to assert the same behavior in all installations: ● don’t use >=, <=, >, < ● pin all dependencies (even deps of deps) ● pin exactly (==)
  • 42. Have your own pypi / proxy old versions might be removed from remote repositories the repository might be down during a deploy, and can crash your application
  • 43. Have your own pypi / proxy
  • 44. Have your own pypi / proxy host a PyPI mirror (bandersnatch, pep381client) host a PyPI cache (devp) PyPI server implementations: ● resilient (devpi) ● AWS S3 PyPI server (pypicloud) ● minimalistic PyPI (pypiserver) ● PyPI written in Django (chishop, djangopypi) Many others..! At globo.com we have both a PyPI server and a PyPI cache proxy.
  • 45. dumb ways to manage your dependencies….
  • 46.
  • 47. 1. understand the tools you use to manage dependencies 2. keep your dependencies up to date, but take care with >= / > 3. take care of your cheese-shop