Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Building Data Pipelines in Python
Search
Marco Bonzanini
April 16, 2016
Programming
2
580
Building Data Pipelines in Python
Slides of my talk at PyCon7 in Florence (April 2016)
Marco Bonzanini
April 16, 2016
Tweet
Share
More Decks by Marco Bonzanini
See All by Marco Bonzanini
Pitfalls in Data Science Projects (and how to avoid them)
marcobonzanini
0
55
Is Your Open-source LLM Really Open?
marcobonzanini
0
65
Perambulations in Football Analytics
marcobonzanini
0
46
Natural Language Processing Expert Briefing @ PyData Global 2022
marcobonzanini
0
96
Natural Language Processing Expert Briefing @ PyData Global 2021
marcobonzanini
0
120
Getting into Data Science @ HisarCS 2021
marcobonzanini
0
270
Mining topics in documents with topic modelling and Python @ London Python meetup
marcobonzanini
1
210
Topic Modelling workshop @ PyCon UK 2019
marcobonzanini
2
120
Lies, Damned Lies, and Statistics @ PyCon UK 2019
marcobonzanini
0
140
Other Decks in Programming
See All in Programming
FluorTracer / RayTracingCamp11
kugimasa
0
230
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
380
DSPy Meetup Tokyo #1 - はじめてのDSPy
masahiro_nishimi
1
160
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
710
リリース時」テストから「デイリー実行」へ!開発マネージャが取り組んだ、レガシー自動テストのモダン化戦略
goataka
0
130
【CA.ai #3】ワークフローから見直すAIエージェント — 必要な場面と“選ばない”判断
satoaoaka
0
240
AIコーディングエージェント(skywork)
kondai24
0
160
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
160
sbt 2
xuwei_k
0
290
手が足りない!兼業データエンジニアに必要だったアーキテクチャと立ち回り
zinkosuke
0
660
俺流レスポンシブコーディング 2025
tak_dcxi
14
8.7k
生成AIを利用するだけでなく、投資できる組織へ
pospome
1
320
Featured
See All Featured
The Invisible Side of Design
smashingmag
302
51k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.2k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
Into the Great Unknown - MozCon
thekraken
40
2.2k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.3k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
1
100
Statistics for Hackers
jakevdp
799
230k
Six Lessons from altMBA
skipperchong
29
4.1k
Agile that works and the tools we love
rasmusluckow
331
21k
Site-Speed That Sticks
csswizardry
13
1k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.2k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
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