SlideShare ist ein Scribd-Unternehmen logo
1 von 55
Downloaden Sie, um offline zu lesen
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?
It depends...
• building a library?
• or an application?
• does it fit my infrastructure?
Thanks
Python Dependency Management - PyconDE 2018

Weitere ähnliche Inhalte

Was ist angesagt?

SF Gradle Meetup - Netflix OSS
SF Gradle Meetup - Netflix OSSSF Gradle Meetup - Netflix OSS
SF Gradle Meetup - Netflix OSS
Justin Ryan
 

Was ist angesagt? (20)

Heroku pycon
Heroku pyconHeroku pycon
Heroku pycon
 
Python + STIX = Awesome
Python + STIX = AwesomePython + STIX = Awesome
Python + STIX = Awesome
 
Docker to the Rescue of an Ops Team
Docker to the Rescue of an Ops TeamDocker to the Rescue of an Ops Team
Docker to the Rescue of an Ops Team
 
Greach - The Groovy Ecosystem
Greach - The Groovy EcosystemGreach - The Groovy Ecosystem
Greach - The Groovy Ecosystem
 
Jenkins vs GitLab CI
Jenkins vs GitLab CIJenkins vs GitLab CI
Jenkins vs GitLab CI
 
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
 
SF Gradle Meetup - Netflix OSS
SF Gradle Meetup - Netflix OSSSF Gradle Meetup - Netflix OSS
SF Gradle Meetup - Netflix OSS
 
How we scaled git lab for a 30k employee company
How we scaled git lab for a 30k employee companyHow we scaled git lab for a 30k employee company
How we scaled git lab for a 30k employee company
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
リバースプロキシで webサーバを集約 ついでにdocker化しよう
リバースプロキシでwebサーバを集約ついでにdocker化しようリバースプロキシでwebサーバを集約ついでにdocker化しよう
リバースプロキシで webサーバを集約 ついでにdocker化しよう
 
Log monitoring with Logstash and Icinga
Log monitoring with Logstash and IcingaLog monitoring with Logstash and Icinga
Log monitoring with Logstash and Icinga
 
CI with Gitlab & Docker
CI with Gitlab & DockerCI with Gitlab & Docker
CI with Gitlab & Docker
 
Devops Porto - CI/CD at Gitlab
Devops Porto - CI/CD at GitlabDevops Porto - CI/CD at Gitlab
Devops Porto - CI/CD at Gitlab
 
GitHub Actions - Melbourne UG
GitHub Actions - Melbourne UGGitHub Actions - Melbourne UG
GitHub Actions - Melbourne UG
 
Workflows using Git GitHub | Edureka
Workflows using Git GitHub | EdurekaWorkflows using Git GitHub | Edureka
Workflows using Git GitHub | Edureka
 
Teaching a Designer to Use GitHub
Teaching a Designer to Use GitHubTeaching a Designer to Use GitHub
Teaching a Designer to Use GitHub
 
Netflix Nebula - Gradle Summit 2014
Netflix Nebula - Gradle Summit 2014Netflix Nebula - Gradle Summit 2014
Netflix Nebula - Gradle Summit 2014
 
Introduction to Version Control with GIT
Introduction to Version Control with GITIntroduction to Version Control with GIT
Introduction to Version Control with GIT
 
DevOps with GitHub Actions
DevOps with GitHub ActionsDevOps with GitHub Actions
DevOps with GitHub Actions
 
Collaboration With Git and GitHub
Collaboration With Git and GitHubCollaboration With Git and GitHub
Collaboration With Git and GitHub
 

Ähnlich wie Python Dependency Management - PyconDE 2018

5 minute intro to virtualenv
5 minute intro to virtualenv5 minute intro to virtualenv
5 minute intro to virtualenv
amenasse
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
LeanDog
 
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
Odoo
 

Ähnlich wie Python Dependency Management - PyconDE 2018 (20)

Python+gradle
Python+gradlePython+gradle
Python+gradle
 
Virtualenv
VirtualenvVirtualenv
Virtualenv
 
First python project
First python projectFirst python project
First python project
 
5 minute intro to virtualenv
5 minute intro to virtualenv5 minute intro to virtualenv
5 minute intro to virtualenv
 
Software development practices in python
Software development practices in pythonSoftware development practices in python
Software development practices in python
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
 
The devops approach to monitoring, Open Source and Infrastructure as Code Style
The devops approach to monitoring, Open Source and Infrastructure as Code StyleThe devops approach to monitoring, Open Source and Infrastructure as Code Style
The devops approach to monitoring, Open Source and Infrastructure as Code Style
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenv
 
DevOps of Python applications using OpenShift (Italian version)
DevOps of Python applications using OpenShift (Italian version)DevOps of Python applications using OpenShift (Italian version)
DevOps of Python applications using OpenShift (Italian version)
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutes
 
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
 
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
 
PySide
PySidePySide
PySide
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
 
E D - Environmental Dependencies in Python
E D - Environmental Dependencies in PythonE D - Environmental Dependencies in Python
E D - Environmental Dependencies in Python
 
Run Python on windows
Run Python on windowsRun Python on windows
Run Python on windows
 
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
 
ASP.NET 5 on the Raspberry PI 2
ASP.NET 5 on the Raspberry PI 2ASP.NET 5 on the Raspberry PI 2
ASP.NET 5 on the Raspberry PI 2
 
Australian Bioinformatics Conference (ABiC) 2014 Talk - Doing bioinformatics ...
Australian Bioinformatics Conference (ABiC) 2014 Talk - Doing bioinformatics ...Australian Bioinformatics Conference (ABiC) 2014 Talk - Doing bioinformatics ...
Australian Bioinformatics Conference (ABiC) 2014 Talk - Doing bioinformatics ...
 

Kürzlich hochgeladen

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Kürzlich hochgeladen (20)

Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 

Python Dependency Management - PyconDE 2018