SlideShare a Scribd company logo
Python Dependency
Management
Patrick Muehlbauer (@tmuxbee)
2018-10-24
• Predicting bananas
• ...with Python
Blue Yonder
Python Dependency Management
banana_predictions.py
How to provide this to others?
$ python setup.py sdist
banana-predictions-1.0.0.tar.gz
$ python setup.py bdist_wheel
banana_predictions-1.0.0-py3-none-any.whl
How to upload to PyPI?
$ python setup.py upload
but no HTTPS
twine
How to specify dependencies?
setuptools’ install_requires
How to install other uploaded packages?
pip
Different versions of ‘banana_predictions’ in
different projects?
virtualenv
$ virtualenv –p python3.7 venv
Reproducible environments? (I)
$ pip freeze > requirements.txt
$ pip install –r requirements.txt
• multiple tools for the whole workflow
• no real dependency resolution in pip
• multiple files needed for reproducible environments
(requirements.txt, dev-requirements.txt, …)
Reproducible environments? (II)
Pipfile and Pipfile.lock
https://github.com/pypa/pipfile
distutils/setuptools limitations
pyproject.toml
PEP 517 -- A build-system independent format for source trees
PEP 518 -- Specifying Minimum Build System Requirements for Python Projects
Python Dependency Managers
pip-tools
Pipenv
poetry hatch
condaflit
Bento
Pants / pex
pip-tools
Pipenv
poetry hatch
pip-tools
• set of command line tools: pip-compile and pip-sync
• pip-compile for dependency resolution: generates requirements.txt
from setup.py or a requirements.in
• pip-sync for dependency synchronization
setup.py
pip-compile
requirements.txt
$ pip-compile --generate-hashes
$ pip-compile --upgrade
pip-tools brings dependency resolution and a
nicer pinning workflow
Pipenv
• wrapper around pip and virtual environments
• lots of convenience features (e.g. automatic virtualenv creation,
python installation)
• uses Pipfile and Pipfile.lock in addtion to setup.py
• main focus on applications rather than libraries
Pipfile
• separate sections for dev and
main dependencies instead of
requirements.txt and dev-
requirements.txt
• optional section to define
required Python version
Pipfile.lock
$ pipenv install scipy
$ pipenv uninstall scipy
update Pipfile and Pipfile.lock
Poetry
• tool to manage dependencies, build and publish packages
• automatic virtualenv creation
• single config file for everything: pyproject.toml, poetry.lock for
reproduciblity
• reliable dependency resolution
• project scaffolding
$ poetry new my-project
$ poetry add scipy
$ poetry version
$ poetry build
sdist and .whl
$ poetry publish
poetry.lock
hatch
• simplifies development workflow
• wraps multiple tools (pip, virtualenv, twine, pytest, coverage.py, …)
• setup.py + requirements.txt
$ hatch new my-project
$ hatch install
$ hatch test
$ hatch grow
$ hatch build
sdist and .whl
$ hatch release
So...which tool should I use?
Python Dependency Management - PyconDE 2018
It depends...
• building a library?
• or an application?
• does it fit my infrastructure?
Thanks
Python Dependency Management - PyconDE 2018

More Related Content

PDF
HDC2022:Track A - 脅威ハンティング
PPT
Same origin policy
PDF
Splunk Data Onboarding Overview - Splunk Data Collection Architecture
PDF
Meetup OpenTelemetry Intro
PDF
Jean-Baptiste Favre - How to Monitor Bilions of Miles Shared by 20 Million Us...
PDF
Practical Federated Identity
PDF
Binary Authorization in Kubernetes
HDC2022:Track A - 脅威ハンティング
Same origin policy
Splunk Data Onboarding Overview - Splunk Data Collection Architecture
Meetup OpenTelemetry Intro
Jean-Baptiste Favre - How to Monitor Bilions of Miles Shared by 20 Million Us...
Practical Federated Identity
Binary Authorization in Kubernetes

What's hot (20)

PPTX
Chrome DevTools
PPT
Application Security
PDF
Real-time Web Application with Socket.IO, Node.js, and Redis
PPTX
Splunk Tutorial for Beginners - What is Splunk | Edureka
PDF
1182586869 Sr301 Kor
PDF
[MeetUp][2nd] 오리뎅이의_쿠버네티스_네트워킹_v1.2
PDF
Introduction to Kubernetes Security
PDF
MITRE ATT&CKcon 2.0: Ready to ATT&CK? Bring Your Own Data (BYOD) and Validate...
PDF
OpenStack 인스턴스 간략 사용자_매뉴얼(liberty)_v1
PPTX
Adopting OpenTelemetry
PPTX
OSINT for Proactive Defense - RootConf 2019
PPTX
FIWARE Wednesday Webinars - How to Design DataModels
PPTX
From on premises monolith to cloud microservices
PDF
i4Trust IAM Components
PDF
Sticky bit suid sgid
PDF
Soc analyst course content v3
PPTX
Gatekeeper: API gateway
ODP
PPTX
Http caching basics
PDF
OSMC 2023 | Large-scale logging made easy by Alexandr Valialkin
Chrome DevTools
Application Security
Real-time Web Application with Socket.IO, Node.js, and Redis
Splunk Tutorial for Beginners - What is Splunk | Edureka
1182586869 Sr301 Kor
[MeetUp][2nd] 오리뎅이의_쿠버네티스_네트워킹_v1.2
Introduction to Kubernetes Security
MITRE ATT&CKcon 2.0: Ready to ATT&CK? Bring Your Own Data (BYOD) and Validate...
OpenStack 인스턴스 간략 사용자_매뉴얼(liberty)_v1
Adopting OpenTelemetry
OSINT for Proactive Defense - RootConf 2019
FIWARE Wednesday Webinars - How to Design DataModels
From on premises monolith to cloud microservices
i4Trust IAM Components
Sticky bit suid sgid
Soc analyst course content v3
Gatekeeper: API gateway
Http caching basics
OSMC 2023 | Large-scale logging made easy by Alexandr Valialkin
Ad

Similar to Python Dependency Management - PyconDE 2018 (20)

PDF
Python+gradle
ODP
Virtualenv
PPTX
First python project
PDF
Tools That Help You Write Better Code - 2025 Princeton Software Engineering S...
ODP
5 minute intro to virtualenv
PDF
Software development practices in python
KEY
Practical introduction to dev ops with chef
PDF
SciPy 2025 - Packaging a Scientific Python Project
PDF
Arbeiten mit distribute, pip und virtualenv
PDF
DevOps of Python applications using OpenShift (Italian version)
PPT
Python virtualenv & pip in 90 minutes
PDF
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
PDF
Welcome to the Cheese Shop: setuptools, virtualenv and PyPUG
PDF
Tools to help you write better code - Princeton Wintersession
PDF
Princeton RSE: Building Python Packages (+binary)
PDF
PySide
PDF
Software Quality Assurance Tooling - Wintersession 2024
PPTX
E D - Environmental Dependencies in Python
PPTX
Run Python on windows
PDF
Using the "pip" package manager for Odoo/OpenERP - Opendays 2014
Python+gradle
Virtualenv
First python project
Tools That Help You Write Better Code - 2025 Princeton Software Engineering S...
5 minute intro to virtualenv
Software development practices in python
Practical introduction to dev ops with chef
SciPy 2025 - Packaging a Scientific Python Project
Arbeiten mit distribute, pip und virtualenv
DevOps of Python applications using OpenShift (Italian version)
Python virtualenv & pip in 90 minutes
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Welcome to the Cheese Shop: setuptools, virtualenv and PyPUG
Tools to help you write better code - Princeton Wintersession
Princeton RSE: Building Python Packages (+binary)
PySide
Software Quality Assurance Tooling - Wintersession 2024
E D - Environmental Dependencies in Python
Run Python on windows
Using the "pip" package manager for Odoo/OpenERP - Opendays 2014
Ad

Recently uploaded (20)

PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
web development for engineering and engineering
PDF
Well-logging-methods_new................
PDF
composite construction of structures.pdf
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Digital Logic Computer Design lecture notes
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Sustainable Sites - Green Building Construction
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Construction Project Organization Group 2.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
web development for engineering and engineering
Well-logging-methods_new................
composite construction of structures.pdf
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Digital Logic Computer Design lecture notes
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Internet of Things (IOT) - A guide to understanding
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
bas. eng. economics group 4 presentation 1.pptx
Sustainable Sites - Green Building Construction
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Lecture Notes Electrical Wiring System Components
Construction Project Organization Group 2.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...

Python Dependency Management - PyconDE 2018