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 CLIs that Click
Search
Jason Myers
May 29, 2015
Technology
0
47
Building CLIs that Click
PyNash presentation on building better CLIs
Jason Myers
May 29, 2015
Tweet
Share
More Decks by Jason Myers
See All by Jason Myers
Introduction to Pandas
jasonamyers
2
210
Generating Power with Yield
jasonamyers
1
180
Introduction to SQLAlchemy and Alembic
jasonamyers
4
1.1k
Data Networking for Developers
jasonamyers
0
140
Diabetes and Me
jasonamyers
0
71
UI Functional Testing
jasonamyers
1
110
Other Decks in Technology
See All in Technology
AWS re:Invent 2025~初参加の成果と学び~
kubomasataka
0
140
MySQLとPostgreSQLのコレーション / Collation of MySQL and PostgreSQL
tmtms
1
1k
Amazon Quick Suite で始める手軽な AI エージェント
shimy
0
550
AWS re:Invent 2025で見たGrafana最新機能の紹介
hamadakoji
0
430
re:Invent 2025 ~何をする者であり、どこへいくのか~
tetutetu214
0
230
AWS CLIの新しい認証情報設定方法aws loginコマンドの実態
wkm2
7
760
Database イノベーショントークを振り返る/reinvent-2025-database-innovation-talk-recap
emiki
0
240
打 造 A I 驅 動 的 G i t H u b ⾃ 動 化 ⼯ 作 流 程
appleboy
0
360
MLflowダイエット大作戦
lycorptech_jp
PRO
1
140
プロンプトやエージェントを自動的に作る方法
shibuiwilliam
13
13k
Python 3.14 Overview
lycorptech_jp
PRO
1
120
シニアソフトウェアエンジニアになるためには
kworkdev
PRO
3
190
Featured
See All Featured
Visualization
eitanlees
150
16k
What the history of the web can teach us about the future of AI
inesmontani
PRO
0
370
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
0
25
The Limits of Empathy - UXLibs8
cassininazir
1
180
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
1.9k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.3k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
0
2.2k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
What does AI have to do with Human Rights?
axbom
PRO
0
1.9k
Chasing Engaging Ingredients in Design
codingconduct
0
74
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.7k
Transcript
BUILDING CLIS THAT CLICK Created by / Jason A Myers
@jasonamyers
BUILDING GOOD COMMAND LINE APPLICATIONS IS HARD
IMPORTANT PARTS NAME ARGUMENT PARSING AND VALIDATION * HELP GENERATION
* COMMAND STRUCTURE * AUTOCOMPLETION NICE OUTPUT PACKAGING *
ARGUMENTS AND HELP
THREE DIFFERENT PARSERS IN THE STDLIB getopt optparse argparse
I MEAN ARGPARSE IS THE NEW HOTNESS???
SERIOUSLY WHO KNOWS HOW *!@%PARSE WORKS ANYWAY
NO REALLY HAVE YOU LOOKED AT THE DOCS...
None
SERIOUSLY BRAIN CELLS EXPLODE
HOW BAD IS IT? docopt Plac Cliff Clint
import sys if __name__ == "__main__": main(sys.argv)
None
DEMO
LOGGING
GOOD LOGGING MESSAGES Time Module Level Parseable Messages
2015-05-28 09:25:18,711 - complex.logger - DEBUG - Creating composit e:
cookies 2015-05-28 09:25:18,711 - complex.logger - DEBUG - Created composite : cookies
JAM'S LOGGING STYLE
import logging logger = logging.getLogger(__name__) logger.setLevel(logging.ERROR)
file_log_handler = logging.FileHandler('complex-cli.log') logger.addHandler(file_log_handler) stderr_log_handler = logging.StreamHandler() logger.addHandler(stderr_log_handler)
format_string = '%(asctime)s - %(name)s - ' \ '%(levelname)s -
%(message)s' formatter = logging.Formatter(format_string) file_log_handler.setFormatter(formatter) stderr_log_handler.setFormatter(formatter)
PACKAGING
FIND OUR MODULE from setuptools import setup, find_packages setup( name='complex',
version='0.1.2', packages=find_packages(), include_package_data=True,
install_requires=[ 'Click==3.3', ],
description='A description', classifiers=[ 'License :: OSI Approved :: BSD License',
'Programming Language :: Python', 'Programming Language :: Python :: 3', ],
entry_points=''' [console_scripts] complex=complex.command:cli ''' )
COMPLEX DEMO
None
QUESTIONS @JASONAMYERS