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
Beyond the pip
Search
Daniela
February 23, 2019
Technology
84
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Beyond the pip
Making sense of the dependency jungle
Daniela
February 23, 2019
Transcript
38 slides
Beyond Beyond the pip the pip
Disclaimer: this is not about Disclaimer: this is not about
pip (in particular). pip (in particular).
None
[Introduction slide]
None
It's the year 2019 It's the year 2019 are we
supposed to write our are we supposed to write our own code now?? own code now??
NOPE. NOPE. BUT DOUBT. EVERYTHING. BUT DOUBT. EVERYTHING.
None
The good The good
The good The good Multitude of libraries
The good The good Multitude of libraries Ease of use
The good The good Multitude of libraries Ease of use
Open source software
The bad The bad
The bad The bad Poorly written & documented
The bad The bad Poorly written & documented Not optimized
The bad The bad Poorly written & documented Not optimized
Might go missing
The ugly The ugly
The ugly The ugly Security issues
The ugly The ugly Security issues Malicious activity (typosquatting happening)
The ugly The ugly Security issues Malicious activity (typosquatting happening)
Dependency hell
Review time! Review time!
Is the library... Is the library...
Is the library... Is the library... mature? mature?
Is the library... Is the library... mature? mature? used in
commercial products? used in commercial products?
Is the library... Is the library... mature? mature? used in
commercial products? used in commercial products? backed up by other organizations? backed up by other organizations?
Is the library... Is the library...
Is the library... Is the library... used all through your
project? used all through your project?
Is the library... Is the library... used all through your
project? used all through your project? heavily relying on other libraries? heavily relying on other libraries?
Improve the library Improve the library Contribute to open source!
Contribute to open source!
Use a pattern... Use a pattern... wrap it up! (the
code, that is) wrap it up! (the code, that is) from external_dependency import something class SomeExternalDependencyClient: def __init__(self, credentials, name): self.client = something.Client(credentials, name) def get_items(self, ids): self.client.get(ids) def send_items(self, item_list): self.client.batch_insert(item_list)
The standard library is The standard library is awesome! awesome!
Good resources Good resources Module of the Week by Doug Hellmann PyTricks by Dan Bader
You have You have ... ... magic methods magic methods
class Hasher(object): def __init__(self, algorithm): self.algorithm = algorithm def __call__(self, file): hash = self.algorithm() with open(file, 'rb') as f: for chunk in iter(lambda: f.read(4096), ''): hash.update(chunk) return hash.hexdigest() md5 = Hasher(hashlib.md5) sha1 = Hasher(hashlib.sha1) md5(somefile)
Awesome Awesome decorators decorators from functools import wraps def retry(count=5,
exc_type=Exception): def decorator(func): @wraps(func) def result(*args, **kwargs): last_exc = None for _ in range(count): try: return func(*args, **kwargs) except exc_type as e: last_exc = e raise last_exc return result return decorator @retry def might_fail(): # some code here pass
class Cache: def __init__(self): self.memo = {} def store(self, fn):
def wrapper(*args): if args not in self.memo: self.memo[args] = fn(*args) return self.memo[args] return wrapper def clear(self): self.memo.clear() cache = Cache() @cache.store def somefct(): return expensive_call() cache.clear()
Powerful Powerful containers containers >>> from collections import Counter >>>
colors = ['blue', 'red', 'blue', 'yellow', 'blue', 'red'] >>> counter = Counter(colors) Counter({'blue': 3, 'red': 2, 'yellow': 1}) >>> counter.most_common()[0][0] 'blue' >>> Point = collections.namedtuple('Point', 'x y') >>> p = Point(1, y=2) Point(x=1, y=2) >>> p.x 1 >>> getattr(p, 'y') 2 >>> p._fields ('x', 'y')
and so many MORE! and so many MORE! utilities utilities
powerful powerful speci c operations speci c operations dev tools: dev tools: , , , , date & time handling date & time handling regex regex os os pydoc pydoc unittest unittest pdb pdb
I still think libraries are cool, I still think libraries
are cool, okay? okay?
This is it. Thank you!
More Decks by Daniela
See All by Daniela
System for Continuous Health Monitoring
danielacraciun
0
70
ELK Stack
danielacraciun
0
120
DNS Tunneling
danielacraciun
0
120
Django ORM vs SqlAlchemy (an comparison)
danielacraciun
1
1.5k
Other Decks in Technology
See All in Technology
MCPでネットワーク障害調査を自動化する前に直すべき3つのこと
yama3133
1
630
信頼性を犠牲にせず、PR マージからデプロイまで人の介入を完全にゼロにするまでの道のり
knwoop
2
850
速くなるほど、深く考える AI時代のQAに学ぶ
kobayashiyorimitsu
0
270
変更差分を読むために環境を整備しよう
pipepasta
1
470
OpenTelemetryで変わった 新時代のCloudWatchメトリクス監視
tsukuboshi
0
460
gradle-best-practices 使ってみた
mikanichinose
0
170
コピーオンライト型ファイルシステムと ランダム書き込み
sat
PRO
2
130
共通基盤の実装に Kotlin - Quarkus を選定した理由と採用したアーキテクチャ
nealle
1
140
Agent Routerで作るマルチテナント 推論基盤 #CNDW2026 / Building Multi-Tenant Inference Platform with Agent Router #CNDW2026
everpeace
3
400
閉域網でのAPI公開の選択肢全部比較!
takano0131
4
570
E2E Test というハーネス — AI時代の自動テスト民主化
daishukojima
10
5.8k
Linuxネットワークスタック進化の軌跡: 過去10年の歩みと最新トレンド
orimanabu
4
760
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k
Site-Speed That Sticks
csswizardry
13
1.6k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
60k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
980
[SF Ruby Conf 2025] Rails X
palkan
3
1.5k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
360
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
550
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
760
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
680
KATA
mclloyd
PRO
35
16k