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
380
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
PyCon Taiwan Keynote - Behind the scenes of FastAPI and friends for developers and builders
tiangolo
0
120
Modern Python through FastAPI and friends - PyCon Sweden
tiangolo
0
58
Await for it: mixing async and blocking code - PyCon MEA - Dubai
tiangolo
0
31
Intro to FastAPI: Tips and Tricks for ML
tiangolo
1
360
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
510
Modern Python through FastAPI and friends - Dubai - AI Everything - Gitex
tiangolo
0
110
Modern Python through FastAPI and friends - PyCon India
tiangolo
1
340
Other Decks in Technology
See All in Technology
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
2.8k
Dify on AWS 環境構築手順
yosse95ai
0
120
会社を支える Pythonという言語戦略 ~なぜPythonを主要言語にしているのか?~
curekoshimizu
3
630
Okta Identity Governanceで実現する最小権限の原則 / Implementing the Principle of Least Privilege with Okta Identity Governance
tatsumin39
0
170
HonoとJSXを使って管理画面をサクッと型安全に作ろう
diggymo
0
170
NLPコロキウム20251022_超効率化への挑戦: LLM 1bit量子化のロードマップ
yumaichikawa
2
370
AIプロダクトのプロンプト実践テクニック / Practical Techniques for AI Product Prompts
saka2jp
0
100
GraphRAG グラフDBを使ったLLM生成(自作漫画DBを用いた具体例を用いて)
seaturt1e
1
120
QA業務を変える(!?)AIを併用した不具合分析の実践
ma2ri
0
130
「最速」で Gemini CLI を使いこなそう! 〜Cloud Shell/Cloud Run の活用〜 / The Fastest Way to Master the Gemini CLI — with Cloud Shell and Cloud Run
aoto
PRO
1
170
AI駆動で進める依存ライブラリ更新 ─ Vue プロジェクトの品質向上と開発スピード改善の実践録
sayn0
1
250
Copilot Studio ハンズオン - 生成オーケストレーションモード
tomoyasasakimskk
0
210
Featured
See All Featured
How to Ace a Technical Interview
jacobian
280
24k
Designing Experiences People Love
moore
142
24k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
190
55k
The Invisible Side of Design
smashingmag
302
51k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
130k
Raft: Consensus for Rubyists
vanstee
140
7.2k
Visualization
eitanlees
149
16k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3k
4 Signs Your Business is Dying
shpigford
185
22k
Making the Leap to Tech Lead
cromwellryan
135
9.6k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
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