Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Building Data Pipelines in Python
Search
Marco Bonzanini
April 16, 2016
Programming
610
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Building Data Pipelines in Python
Slides of my talk at PyCon7 in Florence (April 2016)
Marco Bonzanini
April 16, 2016
More Decks by Marco Bonzanini
See All by Marco Bonzanini
Pitfalls in Data Science Projects (and how to avoid them)
marcobonzanini
0
120
Is Your Open-source LLM Really Open?
marcobonzanini
0
140
Perambulations in Football Analytics
marcobonzanini
0
95
Natural Language Processing Expert Briefing @ PyData Global 2022
marcobonzanini
0
140
Natural Language Processing Expert Briefing @ PyData Global 2021
marcobonzanini
0
170
Getting into Data Science @ HisarCS 2021
marcobonzanini
0
350
Mining topics in documents with topic modelling and Python @ London Python meetup
marcobonzanini
1
270
Topic Modelling workshop @ PyCon UK 2019
marcobonzanini
2
150
Lies, Damned Lies, and Statistics @ PyCon UK 2019
marcobonzanini
0
180
Other Decks in Programming
See All in Programming
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
7.1k
8年前のNode.jsを動かして分かった、npm installの裏側
keisukeikeda
0
120
Performance Optimization With LLMs
xleitix
0
230
Seven New Principles of Software Engineering
yegor256
0
420
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
820
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
1.3k
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
4
1.4k
No More NoSuchMethodError
exoego
1
120
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
540
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
270
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
1.8k
AI-Powered Domain-Driven Design
ziobrando
0
370
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Being A Developer After 40
akosma
PRO
92
590k
The Language of Interfaces
destraynor
162
27k
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.2k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
470
sira's awesome portfolio website redesign presentation
elsirapls
0
490
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
560
Heart Work Chapter 1 - Part 1
lfama
PRO
10
37k
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
Transcript
Building Data Pipelines in Python Marco Bonzanini ! PyCon Italia
- Florence 2016
Nice to meet you • @MarcoBonzanini • “Type B” Data
Scientist • PhD in Information Retrieval • Book with PacktPub (July 2016) • Usually at PyData London
R&D ≠ Engineering R&D results in production = high value
None
Big Data Problems vs Big Data Problems
Data Pipelines Data ETL Analytics • Many components in a
data pipeline: • Extract, Clean, Augment, Join data
Good Data Pipelines Easy to reproduce Easy to productise
Towards Good Pipelines • Transform your data, don’t overwrite •
Break it down into components • Different packages (e.g. setup.py) • Unit tests vs end-to-end tests Good = Replicable and Productisable
Anti-Patterns • Bunch of scripts • Single run-everything script •
Hacky homemade dependency control • Don’t reinvent the wheel
Intermezzo Let me rant about testing Icon by Freepik from
flaticon.com
(Unit) Testing • Unit tests in three easy steps: •
import unittest • Write your tests • Quit complaining about lack of time to write tests
Benefits of (unit) testing • Safety net for refactoring •
Safety net for lib upgrades • Validate your assumptions • Document code / communicate your intentions • You’re forced to think
Testing: not convinced yet?
Testing: not convinced yet?
Testing: not convinced yet? f1 = fscore(p, r) min_bound,
max_bound = sorted([p, r]) assert min_bound <= f1 <= max_bound
Testing: I’m almost done • Unit tests vs Defensive Programming
• Say no to tautologies • Say no to vanity tests • Know the ecosystem: py.test, nosetests, hypothesis, coverage.py, …
</rant>
Intro to Luigi GNU Make + Unix pipes + Steroids
• Workflow manager in Python, by Spotify • Dependency management • Error control, checkpoints, failure recovery • Minimal boilerplate • Dependency graph visualisation $ pip install luigi
Luigi Task: unit of execution class MyTask(luigi.Task): ! def requires(self):
pass # list of dependencies def output(self): pass # task output def run(self): pass # task logic
Luigi Target: output of a task class MyTarget(luigi.Target): ! def
exists(self): pass # return bool Off the shelf support for local file system, S3, Elasticsearch, RDBMS (also via luigi.contrib)
Not only Luigi • More Python-based workflow managers: • Airflow
by Airbnb • Mrjob by Yelp • Pinball by Pinterest
When things go wrong • import logging • Say no
to print() for debugging • Custom log format / extensive info • Different levels of severity • Easy to switch off or change level
Who reads the logs? You’re not going to read the
logs, unless… • E-mail notifications • built-in in Luigi • Slack notifications $ pip install luigi_slack # WIP
Summary • R&D is not Engineering: can we meet halfway?
• Prototypes vs. Products • Automation and replicability matter • You need a workflow manager • Good engineering principles help: • Testing, logging, packaging, …
Vanity Slide • speakerdeck.com/marcobonzanini • github.com/bonzanini • marcobonzanini.com • @MarcoBonzanini