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
340
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
医療業界に特化した音声認識モデル構築のためのアノテーションの実態
thickstem
0
360
現場で役立つAPIデザイン
nagix
1
120
実践Kafka Streams 〜イベント駆動型アーキテクチャを添えて〜
joker1007
3
810
2025advance01
minamizaki
0
140
OpenJDKエコシステムと開発中の機能を紹介 2025夏版
chiroito
1
1.1k
impressions-trying-lambda-web-adapter
junkishigaki
2
140
Oracle Cloud Infrastructure IaaS 新機能アップデート 2025/03 - 2025/05
oracle4engineer
PRO
1
110
20250612_GitHubを使いこなすためにソニーの開発現場が取り組んでいるプラクティス.pdf
osakiy8
0
210
ソフトウェアは捨てやすく作ろう/Let's make software easy to discard
sanogemaru
10
6.2k
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
2.6k
Redmineの意外と知らない便利機能 (Redmine 6.0対応版)
vividtone
0
1.4k
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
5
38k
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
2.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.5k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
52
2.8k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
760
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
The World Runs on Bad Software
bkeepers
PRO
68
11k
Designing Experiences People Love
moore
142
24k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
47
2.8k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
25
2.8k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
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