SlideShare a Scribd company logo
Python Dependencies
The Right* Way
Bazel + Python @ Beeswax
Ron Rothman
* For us. YMMV.
● 30 engineers
● monorepo
● 100 applications
● 300 kLoPyC
1.Global requirements.txt
2.rules_python
3.pipenv
We have: We tried:
● bazel test
● bazel run
● deployments
We need deps for:
Bazel
pip-tools
Virtualenvs
Wheels
Beeve
lockfiles
# requirements.lock
boto3==1.10.2
botocore==1.13.2 # via boto3, s3transfer
certifi==2019.9.11 # via requests
chardet==3.0.4 # via requests
docutils==0.15.2 # via botocore
futures==3.3.0 # via s3transfer
idna==2.8 # via requests
jmespath==0.9.4 # via boto3, botocore
python-dateutil==2.8.0 # via botocore
requests==2.22.0
s3transfer==0.2.1 # via boto3
six==1.12.0 # via python-dateutil
urllib3==1.25.6 # via botocore,
requests
py_binary(
name = "my_app",
deps = ["lib_a"],
requires = ["requests>=2.21"],
)
py_library(
name = "lib_a",
deps = ["lib_b"],
requires = ["requests>=2.18"],
)
py_library(
name = "lib_b",
deps = ["lib_c"],
requires = ["boto3~=1.9"],
)
py_venv(
name = "my_app_env",
targets = [":my_app"],
)
# requirements.in
boto3~=1.9
requests>=2.18
requests>=2.21
Needs improvement:
● Dev/CI workflow more complicated than before
● Bazel cache misses
● Dependency changes are not propagated automatically
Working well:
● 100% correct (and minimal) dependencies!
● Monorepo-friendly
● History of dependency changes (lock files)
● Wheels are easy
Thank You 🙏🏻
ron {at} beeswax.com

More Related Content

What's hot (20)

KEY
skipfish
Christian Heinrich
 
PDF
Gitosis on Mac OS X Server
Yasuhiro Asaka
 
PDF
Spatial script for my JS.Everywhere 2012
Steven Pousty
 
PDF
Go破壊
Hattori Hideo
 
PPT
Openshift GeoSpatial Capabilities
Steven Pousty
 
PPTX
Spatial Mongo and Node.JS on Openshift JS.Everywhere 2012
Steven Pousty
 
PDF
Rustでパケットと戯れる
ShuyaMotouchi1
 
PDF
A curious case of broken DNS responses (Coloclue Presents - Nov 2019)
Babak Farrokhi
 
PPTX
Highload осень 2012 лекция 1
Technopark
 
PDF
3 rd animation
divyalakshmi77
 
PDF
Infrastructure coders logstash
David Lutz
 
PPT
Searching the Now
lucasjosh
 
PPTX
Spatial mongo for PHP and Zend
Steven Pousty
 
PDF
Lab report
Md Selim Hossain
 
PPT
Mongo sf spatialmongo
Steven Pousty
 
PDF
Is ruby logger thread(process)-safe? at RubyConf 2013
Naotoshi Seo
 
PDF
A curious case of broken dns responses - RIPE75
Babak Farrokhi
 
PDF
faastCrystal
Sachirou Inoue
 
PPTX
Comets notes
Ilija Dukovski
 
PDF
nouka inventry manager
Toshiaki Baba
 
Gitosis on Mac OS X Server
Yasuhiro Asaka
 
Spatial script for my JS.Everywhere 2012
Steven Pousty
 
Go破壊
Hattori Hideo
 
Openshift GeoSpatial Capabilities
Steven Pousty
 
Spatial Mongo and Node.JS on Openshift JS.Everywhere 2012
Steven Pousty
 
Rustでパケットと戯れる
ShuyaMotouchi1
 
A curious case of broken DNS responses (Coloclue Presents - Nov 2019)
Babak Farrokhi
 
Highload осень 2012 лекция 1
Technopark
 
3 rd animation
divyalakshmi77
 
Infrastructure coders logstash
David Lutz
 
Searching the Now
lucasjosh
 
Spatial mongo for PHP and Zend
Steven Pousty
 
Lab report
Md Selim Hossain
 
Mongo sf spatialmongo
Steven Pousty
 
Is ruby logger thread(process)-safe? at RubyConf 2013
Naotoshi Seo
 
A curious case of broken dns responses - RIPE75
Babak Farrokhi
 
faastCrystal
Sachirou Inoue
 
Comets notes
Ilija Dukovski
 
nouka inventry manager
Toshiaki Baba
 

Similar to Python Dependencies at Beeswax - BazelCon 2019 Lightning Talk - Ron Rothman (20)

PDF
Pycon taiwan 2018_claudiu_popa
Claudiu Popa
 
PDF
PyConUK 2018 - Journey from HTTP to gRPC
Tatiana Al-Chueyr
 
PDF
Python 2 is dead! Drag your old code into the modern age
Becky Smith
 
PPTX
Relational Database Access with Python ‘sans’ ORM
Mark Rees
 
PDF
Rustifying a Python package in 2025 with pyo3 and maturin
ArthurAndres2
 
PPTX
Introduction to robot framework
Chonlasith Jucksriporn
 
PDF
Python仮想環境構築の基礎と ツールの比較
cocodrips
 
PPTX
Python for IoT CoE.pptx KDOJWIHJNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
SalihaBathool
 
PDF
Time series denver an introduction to prometheus
Bob Cotton
 
PPTX
MongoDB Days UK: Using MongoDB and Python for Data Analysis Pipelines
MongoDB
 
KEY
Ladypy 01
Calvin Cheng
 
PDF
Rolling with the Times: Using wheels, pbr, and Twine for Distributing and Ins...
doughellmann
 
PPTX
SDOC-9384E354D357952A32C22C63F420335F-12-16-SI.pptx
manishneupan888
 
PPTX
Pipenv - Melbourne Python User Group (MPUG)
Rory Hart
 
PDF
2018 jPrime Deconstructing and Evolving REST Security
David Blevins
 
PDF
Zn task - defcon russia 20
DefconRussia
 
PPT
基于 Google protobuf 的 webgame 网络协议设计
勇浩 赖
 
PDF
Consul administration at scale
Pierre Souchay
 
PPTX
Relational Database Access with Python
Mark Rees
 
PDF
Python para equipos de ciberseguridad
Jose Manuel Ortega Candel
 
Pycon taiwan 2018_claudiu_popa
Claudiu Popa
 
PyConUK 2018 - Journey from HTTP to gRPC
Tatiana Al-Chueyr
 
Python 2 is dead! Drag your old code into the modern age
Becky Smith
 
Relational Database Access with Python ‘sans’ ORM
Mark Rees
 
Rustifying a Python package in 2025 with pyo3 and maturin
ArthurAndres2
 
Introduction to robot framework
Chonlasith Jucksriporn
 
Python仮想環境構築の基礎と ツールの比較
cocodrips
 
Python for IoT CoE.pptx KDOJWIHJNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
SalihaBathool
 
Time series denver an introduction to prometheus
Bob Cotton
 
MongoDB Days UK: Using MongoDB and Python for Data Analysis Pipelines
MongoDB
 
Ladypy 01
Calvin Cheng
 
Rolling with the Times: Using wheels, pbr, and Twine for Distributing and Ins...
doughellmann
 
SDOC-9384E354D357952A32C22C63F420335F-12-16-SI.pptx
manishneupan888
 
Pipenv - Melbourne Python User Group (MPUG)
Rory Hart
 
2018 jPrime Deconstructing and Evolving REST Security
David Blevins
 
Zn task - defcon russia 20
DefconRussia
 
基于 Google protobuf 的 webgame 网络协议设计
勇浩 赖
 
Consul administration at scale
Pierre Souchay
 
Relational Database Access with Python
Mark Rees
 
Python para equipos de ciberseguridad
Jose Manuel Ortega Candel
 
Ad

Recently uploaded (20)

PDF
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
PDF
Summary Of Odoo 18.1 to 18.4 : The Way For Odoo 19
CandidRoot Solutions Private Limited
 
PDF
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
PDF
Enhancing Security in VAST: Towards Static Vulnerability Scanning
ESUG
 
PDF
Step-by-Step Guide to Install SAP HANA Studio | Complete Installation Tutoria...
SAP Vista, an A L T Z E N Company
 
PDF
SAP GUI Installation Guide for Windows | Step-by-Step Setup for SAP Access
SAP Vista, an A L T Z E N Company
 
PDF
Balancing Resource Capacity and Workloads with OnePlan – Avoid Overloading Te...
OnePlan Solutions
 
PDF
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
PDF
Applitools Platform Pulse: What's New and What's Coming - July 2025
Applitools
 
PDF
Enhancing Healthcare RPM Platforms with Contextual AI Integration
Cadabra Studio
 
PPTX
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PDF
Infrastructure planning and resilience - Keith Hastings.pptx.pdf
Safe Software
 
PDF
Why Are More Businesses Choosing Partners Over Freelancers for Salesforce.pdf
Cymetrix Software
 
PDF
Adobe Illustrator Crack Full Download (Latest Version 2025) Pre-Activated
imang66g
 
PDF
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
PDF
MiniTool Power Data Recovery Crack New Pre Activated Version Latest 2025
imang66g
 
PPTX
Role Of Python In Programing Language.pptx
jaykoshti048
 
PDF
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
PPT
Activate_Methodology_Summary presentatio
annapureddyn
 
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
Summary Of Odoo 18.1 to 18.4 : The Way For Odoo 19
CandidRoot Solutions Private Limited
 
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
Enhancing Security in VAST: Towards Static Vulnerability Scanning
ESUG
 
Step-by-Step Guide to Install SAP HANA Studio | Complete Installation Tutoria...
SAP Vista, an A L T Z E N Company
 
SAP GUI Installation Guide for Windows | Step-by-Step Setup for SAP Access
SAP Vista, an A L T Z E N Company
 
Balancing Resource Capacity and Workloads with OnePlan – Avoid Overloading Te...
OnePlan Solutions
 
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
Applitools Platform Pulse: What's New and What's Coming - July 2025
Applitools
 
Enhancing Healthcare RPM Platforms with Contextual AI Integration
Cadabra Studio
 
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
Infrastructure planning and resilience - Keith Hastings.pptx.pdf
Safe Software
 
Why Are More Businesses Choosing Partners Over Freelancers for Salesforce.pdf
Cymetrix Software
 
Adobe Illustrator Crack Full Download (Latest Version 2025) Pre-Activated
imang66g
 
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
MiniTool Power Data Recovery Crack New Pre Activated Version Latest 2025
imang66g
 
Role Of Python In Programing Language.pptx
jaykoshti048
 
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
Activate_Methodology_Summary presentatio
annapureddyn
 
Ad

Python Dependencies at Beeswax - BazelCon 2019 Lightning Talk - Ron Rothman

  • 1. Python Dependencies The Right* Way Bazel + Python @ Beeswax Ron Rothman * For us. YMMV.
  • 2. ● 30 engineers ● monorepo ● 100 applications ● 300 kLoPyC 1.Global requirements.txt 2.rules_python 3.pipenv We have: We tried: ● bazel test ● bazel run ● deployments We need deps for:
  • 4. # requirements.lock boto3==1.10.2 botocore==1.13.2 # via boto3, s3transfer certifi==2019.9.11 # via requests chardet==3.0.4 # via requests docutils==0.15.2 # via botocore futures==3.3.0 # via s3transfer idna==2.8 # via requests jmespath==0.9.4 # via boto3, botocore python-dateutil==2.8.0 # via botocore requests==2.22.0 s3transfer==0.2.1 # via boto3 six==1.12.0 # via python-dateutil urllib3==1.25.6 # via botocore, requests py_binary( name = "my_app", deps = ["lib_a"], requires = ["requests>=2.21"], ) py_library( name = "lib_a", deps = ["lib_b"], requires = ["requests>=2.18"], ) py_library( name = "lib_b", deps = ["lib_c"], requires = ["boto3~=1.9"], ) py_venv( name = "my_app_env", targets = [":my_app"], ) # requirements.in boto3~=1.9 requests>=2.18 requests>=2.21
  • 5. Needs improvement: ● Dev/CI workflow more complicated than before ● Bazel cache misses ● Dependency changes are not propagated automatically Working well: ● 100% correct (and minimal) dependencies! ● Monorepo-friendly ● History of dependency changes (lock files) ● Wheels are easy
  • 6. Thank You 🙏🏻 ron {at} beeswax.com

Editor's Notes

  • #2: Hi everyone...
  • #3: We're 30 / monorepo / 100 / 300k The problem... how to manage our Py 3p deps By third-party... [C]When we bāzel-test or bāzel-run some target... also deps of every other target in its xtive clo same in prod [C]When had one or two apps, we solved... reqs.txt ...this didn't scale well once critical mass by multiple engs rules_python - can't guarantee import correct version pipenv Which led us to roll...
  • #4: Our solution, which we call Beeve... set of tools pip-tools is... composed of starlark macros/rules/aspects + command line tools [C]Beeve's output is... A lockfile is a set of 3p deps, each pinned an application's reqs.txt, but autogenerated as needed We leveraged: Bāzel's... walk the graph, collect 3pd; pip-tools's... resolve deps [C]We take each app's lockfile and use it...
  • #5: Here's an example. toy BUILD Note we've annotated each py rule... new attr requires... dep spec a dep spec is just a constraint on py_venv - tells Beeve we want lockfile for the... When run Bāzel on py_venv rule, our Starlark code... [C] requirements.in... union [C]then calls pip-compile to generate... the lockfile contains pinned versions of... as well as their transitive deps... ie it's the complete set of Py pkgs that our py_binary... not hermetic; nor reproducible; current state PyPI if you run... different lockfiles guaranteed that any resulting lockfile conforms to constraints... !!!
  • #6: one downside is... devs must now be aware of py envs, switch between them Bāzel-test error prone Bāzel caching less effective 3p dep changes are not propagated automatically to downstream... [C]on plus side... most important goal... reliably know precise set of 3p deps... contains everything/nothing monorepo-friendly... go without saying nice side benefit... track dep changes over time, since... can easily produce wheels for our Py apps, has made deployments...
  • #7: I'm happy to talk more about Beeve or Python dependencies ...email me with any questions or just find me at the conference. Thank you!