Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
CLI apps with Typer - Python type annotations a...
Search
Sebastián Ramírez
October 10, 2022
Technology
0
350
CLI apps with Typer - Python type annotations and shell completion
Sebastián Ramírez
October 10, 2022
Tweet
Share
More Decks by Sebastián Ramírez
See All by Sebastián Ramírez
Modern Python through FastAPI and friends - PyCon Sweden
tiangolo
0
48
Await for it: mixing async and blocking code - PyCon MEA - Dubai
tiangolo
0
27
Intro to FastAPI: Tips and Tricks for ML
tiangolo
1
330
Modern Python through FastAPI and friends - PyCon MEA - Dubai
tiangolo
0
880
Software de Colombia para el mundo
tiangolo
1
1.7k
Modern Python through FastAPI and friends - PyCon Indonesia
tiangolo
0
500
Modern Python through FastAPI and friends - Dubai - AI Everything - Gitex
tiangolo
0
100
Modern Python through FastAPI and friends - PyCon India
tiangolo
1
330
Haz un servicio de ML fácilmente con FastAPI
tiangolo
0
460
Other Decks in Technology
See All in Technology
Cross Data Platforms Meetup LT 20250422
tarotaro0129
1
840
地味にいろいろあった! 2025春のAmazon Bedrockアップデートおさらい
minorun365
PRO
2
530
白金鉱業Meetup_Vol.18_AIエージェント時代のUI/UX設計
brainpadpr
1
250
AI 코딩 에이전트 더 똑똑하게 쓰기
nacyot
0
400
白金鉱業Meetup_Vol.18_生成AIはデータサイエンティストを代替するのか?
brainpadpr
3
200
ガバクラのAWS長期継続割引 ~次の4/1に慌てないために~
hamijay_cloud
1
540
営業向け誰でも話せるOCIセールストーク
oracle4engineer
PRO
2
130
より良い開発者体験を実現するために~開発初心者が感じた生成AIの可能性~
masakiokuda
0
220
Twelve-Factor-Appから学ぶECS設計プラクティス/ECS practice for Twelve-Factor-App
ozawa
3
140
Mastraに入門してみた ~AWS CDKを添えて~
tsukuboshi
0
360
持続可能なドキュメント運用のリアル: 1年間の成果とこれから
akitok_
1
250
意思決定を支える検索体験を目指してやってきたこと
hinatades
PRO
0
350
Featured
See All Featured
Being A Developer After 40
akosma
91
590k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Music & Morning Musume
bryan
47
6.5k
Building Adaptive Systems
keathley
41
2.5k
How GitHub (no longer) Works
holman
314
140k
StorybookのUI Testing Handbookを読んだ
zakiyama
29
5.7k
A designer walks into a library…
pauljervisheath
205
24k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
5
580
Build The Right Thing And Hit Your Dates
maggiecrowley
35
2.7k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Done Done
chrislema
184
16k
Unsuck your backbone
ammeep
670
57k
Transcript
CLI apps with type annotations and shell completion
Who am I? Sebastián Ramírez github.com/tiangolo linkedin.com/in/tiangolo twitter.com/tiangolo tiangolo.com Berlin,
Germany Senior Staff Software Engineer at I created: ➕ External Consultant for other teams
About Typer • 8K+ GitHub stars • FastAPI's little sibling
• Powered by Click @tiangolo
Command Line Interfaces (CLI) or Terminals @tiangolo • Text based
• You send program and parameters • Computer goes beep boop • Maybe output • Examples of CLI apps: git, ssh, pip
Simple function with type annotations @tiangolo
Simple function with type annotations @tiangolo
Why type annotations - error checks @tiangolo
Why type annotations - completion @tiangolo
Simple function with type annotations - recap @tiangolo
Simple scripts with Typer @tiangolo
Simple scripts - required arguments @tiangolo
Simple scripts with Typer - main block @tiangolo
Simple scripts - required arguments missing @tiangolo
Simple scripts with --help @tiangolo
Simple scripts - options @tiangolo
Simple scripts - invalid data @tiangolo
Simple scripts - more help @tiangolo
Simple scripts - more help in the terminal @tiangolo
Simple scripts - help for parameters @tiangolo
Simple scripts - help for parameters in the terminal @tiangolo
A Typer app @tiangolo
A Typer app - app object @tiangolo
A Typer app - decorator @tiangolo
A Typer app - call the app @tiangolo
A Typer app - supergreet @tiangolo
Install completion @tiangolo ✨ Works for everything: • Zsh •
Bash • Fish • PowerShell
Use completion @tiangolo
Use completion @tiangolo
Use completion @tiangolo
Use completion @tiangolo
Use completion @tiangolo
Completion @tiangolo 🧙 Works by default and can be used
for: • Deeply nested commands • CLI Options and CLI Arguments • Custom data (e.g. remote, from an API) • etc.
Commands @tiangolo
Commands - hi @tiangolo
Commands - bye @tiangolo
Help with commands @tiangolo
Commands - hi again @tiangolo
Commands --help for hi @tiangolo
Command hi in terminal @tiangolo
Commands - bye @tiangolo
Commands --help for bye @tiangolo
More Typer features @tiangolo • 🥅 Boolean flags • ❓
Prompts • 🔒 Ask passwords • 🚀 Launch apps (e.g. a browser) • ✅ Easy testing • ✨ More…
Thank you! Sebastián Ramírez tiangolo.com typer.tiangolo.com github.com/tiangolo linkedin.com/in/tiangolo twitter.com/tiangolo