I build a lot of command-line tools in Python. It's become my favorite way of quickly turning a piece of code into something I can use myself and package up for other people to use too.

My biggest CLI projects are sqlite-utils, LLM, shot-scraper and Datasette — but I have dozens of others and I build new ones at the rate of at least one a month. A fun recent example is blip-caption, a tiny CLI wrapper around the Salesforce BLIP model that can generate usable captions for image files.

Here are some notes on what I've learned about designing and implementing CLI tools in Python so far.

continue reading on simonwillison.net

⚠️ This post links to an external website. ⚠️