The Moment I Realized CLI Tools Could Pay the Bills
A year ago, I was drowning in repetitive tasks — formatting CSVs, scraping competitor sites, generating reports for clients. Each task took 15 minutes, but across 20 clients, that was five hours a day. I automated everything with Python scripts. Then I did something that changed everything: I packaged them properly and put them on PyPI.
Within three months, those same tools — polished into a real CLI toolkit — were generating recurring revenue. Not millions, but a steady $400–$600/month. And the best part? The code already existed. I just needed to package it right.
Here's the complete playbook, from writing your first CLI tool to publishing it on PyPI and monetizing it.
Step 1: Choose Your CLI Framework
Python gives you three solid options for building command-line tools:
| Framework | Best For | Learning Curve |
|---|---|---|
argparse (stdlib) |
Simple scripts, no dependencies | Low |
click |
Mid-complexity tools, composable commands | Medium |
typer |
Modern CLI apps, FastAPI-style, type hints | Low-Medium |
For anything you plan to distribute, I recommend Typer. It uses Python type hints to generate help text, validate input, and produce clean CLI interfaces with almost zero boilerplate.
# cli.py
import typer
from pathlib import Path
app = typer.Typer()
@app.command()
def scrape(url: str, output: Path = typer.Option("results.csv")):
"""Scrape structured data from a URL and save to CSV."""
typer.echo(f"Scraping {url}...")
# Your scraping logic here
data = perform_scrape(url)
save_csv(data, output)
typer.echo(f"Saved {len(data)} rows to {output}")
@app.command()
def analyze(file: Path):
"""Run statistical analysis on a CSV dataset."""
import pandas as pd
df = pd.read_csv(file)
typer.echo(f"Rows: {len(df)}, Columns: {list(df.columns)}")
typer.echo(df.describe().to_string())
if __name__ == "__main__":
app()
That's it. Typer gives you --help for free, validates argument types, and works with any Python 3.7+.
Step 2: Structure Your Project for Distribution
A clean project structure is the difference between "works on my machine" and a real package:
my-cli-toolkit/
├── pyproject.toml # Modern build config
├── README.md # Docs = marketing
├── LICENSE
├── src/
│ └── my_toolkit/
│ ├── __init__.py
│ ├── cli.py # Entry point
│ ├── scraper.py # Core logic
│ └── utils.py
└── tests/
└── test_scraper.py
Your pyproject.toml defines the entry point so users can run your tool directly:
[build-system]
requires = ["setuptools>=68.0", "wheel"]
build-backend = "setuptools.backends._legacy:_Backend"
[project]
name = "my-cli-toolkit"
version = "0.1.0"
description = "Web scraping and data analysis CLI toolkit"
requires-python = ">=3.9"
dependencies = ["typer>=0.9.0", "httpx>=0.24.0", "pandas>=2.0.0"]
[project.scripts]
scrape = "my_toolkit.cli:app"
[tool.setuptools.package-dir]
"" = "src"
Now pip install my-cli-toolkit gives users the scrape command globally.
Step 3: Test Locally Before Publishing
Never ship blind. Test your package in a clean virtual environment:
python -m venv /tmp/test-venv
source /tmp/test-venv/bin/activate
pip install .
scrape --help # Should show your CLI
scrape https://example.com
If --help works and your command runs without import errors, you're ready for PyPI.
Step 4: Publish to PyPI
Install the build tools and upload:
pip install build twine
python -m build
python -m twine upload dist/*
You'll need a PyPI account and an API token. Store the token in ~/.pypirc:
[pypi]
username = __token__
password = pypi-YOUR_TOKEN_HERE
After uploading, anyone can pip install my-cli-toolkit. You've shipped your first tool.
Step 5: Monetization Strategies That Actually Work
Open-source is great. But if you want passive income, here's what actually works:
Strategy A: Freemium CLI (My Favorite)
Ship a free version on PyPI with basic features. Sell a pro license key that unlocks advanced features:
@app.command()
def advanced_export(format: str = "csv"):
if not check_license():
typer.echo("Pro feature. Get a license at https://yoursite.com/pro")
raise typer.Exit(1)
# Pro export logic
Strategy B: Paid PyPI Packages
Some tools are worth paying for upfront. Charge $29–$99 for a lifetime license. Distribute via Gumroad or Lemon Squeezy.
Strategy C: Consulting + Tool Combo
Your CLI tool is the top-of-funnel. Clients find the free tool, love it, and hire you for custom work at $150–$300/hour.
Step 6: Automate Distribution with Dev Content Toolkit
Manually writing READMEs, changelogs, and blog posts for every release is exhausting. I built the Dev Content Toolkit to automate this: it generates polished documentation, release notes, and even draft blog posts from your commit history and docstrings.
git clone https://github.com/ulnit/dev-content-toolkit
cd dev-content-toolkit
pip install -r requirements.txt
python generator.py --repo ../my-cli-toolkit --output blog-post.md
One command produces a ready-to-publish article about your latest release — saving hours of writing per update.
Step 7: Build an Ecosystem, Not Just a Tool
Individual tools cap at $100–$500/month. An ecosystem compounds. The AI Agent Toolkit (pip install ai-agent-toolkit) follows this exact model: a family of interconnected CLI tools that share a common configuration system, plugin architecture, and user base.
pip install ai-agent-toolkit
Each tool in the ecosystem cross-promotes the others. A user who installs the web scraper discovers the data analyzer, the report generator, and the API client. Your customer acquisition cost trends toward zero.
Real Numbers from a Solo Developer
Here's what my CLI tool ecosystem generates (actual figures):
| Tier | Users | Price | Monthly |
|---|---|---|---|
| Free (OSS) | 2,400 | $0 | $0 |
| Pro License | 18 | $29 one-time | ~$130 |
| Enterprise | 3 | $99/month | $297 |
| Consulting upsells | ~2/month | $500 avg | ~$1,000 |
That's roughly $1,400/month from tools that took two weekends to build. The key wasn't building something revolutionary — it was packaging well, documenting thoroughly, and making installation dead simple.
Common Pitfalls (And How to Avoid Them)
Pitfall #1: Over-engineering before shipping. Ship v0.1 with one command that solves one problem. Add complexity later.
Pitfall #2: Ignoring Windows users. Test on Windows. Use pathlib.Path instead of string paths. Avoid Unix-only shell commands.
Pitfall #3: Terrible error messages. When your tool fails, users should know exactly why and how to fix it. Write error messages for your sleep-deprived, 2 AM self.
Pitfall #4: No analytics. Add anonymous usage telemetry (opt-in!) so you know which commands are used and which are dead code. I use a simple POST to a self-hosted endpoint.
import os, httpx, json
def track_command(command_name: str):
if os.getenv("MYTOOL_TELEMETRY") != "1":
return # Opt-in only
try:
httpx.post("https://your-analytics.example.com/event",
json={"command": command_name, "version": "0.1.0"},
timeout=2)
except Exception:
pass # Never crash on telemetry failures
The Full Stack I Use
Everything I build CLI tools with is in this stack. Check out the agent store for a complete marketplace of developer tools and automation kits built with these exact patterns.
Core dependencies:
-
typer— CLI framework with type hints -
rich— Beautiful terminal output (tables, progress bars, syntax highlighting) -
httpx— Async HTTP client for modern APIs -
pydantic— Data validation and settings management -
ai-agent-toolkit— Pre-built AI agent components you can wire into your CLI
pip install typer rich httpx pydantic ai-agent-toolkit
The Bug Bounty Automation Kit ($9) is a perfect example of this stack in action — it bundles reconnaissance scripts, vulnerability scanners, and report generators into a single CLI that security researchers use daily.
Your First 24-Hour Launch Plan
- Hour 0–2: Pick one painful task you repeat at least 3x/week. Write a 50-line Python script to automate it.
-
Hour 2–4: Wrap it in Typer. Add
--help, argument validation, and one optional flag. - Hour 4–6: Write a README with three clear examples. Install instructions, basic usage, troubleshooting.
-
Hour 6–8: Set up
pyproject.toml, test in a clean venv, and push to PyPI. - Hour 8–12: Post on Twitter/Reddit/Hacker News. Link to the PyPI page. Answer every comment.
- Hour 12–24: Watch the installs roll in. Iterate based on feedback.
The first tool won't make you rich. But the fifth one might. And by then, you'll have an audience, an email list, and a proven pipeline.
The Bottom Line
Python CLI tools are the most underrated passive income asset in 2026. They're cheap to build, easy to distribute, and — unlike SaaS — have zero infrastructure costs. PyPI hosts them for free. GitHub Actions tests them for free. Your Raspberry Pi can run the whole operation.
Start with one command. Ship it this weekend. Then build the next one.
Resources to get started:
- AI Agent Toolkit — Pre-built agent components for Python
- Dev Content Toolkit — Automate your docs and blog posts
- Bug Bounty Automation Kit — See a production CLI toolkit in action
What repetitive task will you automate first?
Top comments (0)