← Back to all products
$29
Python CLI Framework
Build professional CLI tools with Click/Typer, auto-completion, config management, and plugin architecture.
PythonTOMLJSONMarkdown
📁 File Structure 16 files
python-cli-framework/
├── LICENSE
├── README.md
├── guides/
│ └── building-cli-apps.md
├── pyproject.toml
├── src/
│ └── cli/
│ ├── commands/
│ │ ├── config.py
│ │ ├── init.py
│ │ └── run.py
│ ├── config.py
│ ├── logging_setup.py
│ ├── main.py
│ ├── output.py
│ └── utils.py
├── templates/
│ ├── README.md.j2
│ └── pyproject.toml.j2
└── tests/
├── test_cli.py
└── test_config.py
📖 Documentation Preview README excerpt
Python CLI Framework
Build beautiful, professional command-line tools with Click, Rich, and TOML configuration — from first command to PyPI package.
[](https://www.python.org/downloads/)
[](https://click.palletsprojects.com)
[](LICENSE)
---
What You Get
- Click-based CLI — Group commands with
--verbose,--output-format, and--config - Rich output — Tables, JSON, YAML, and CSV formatters with color and progress bars
- TOML configuration — Read/write config files with environment variable fallback
- Project scaffolding —
initcommand generates new project structure from Jinja2 templates - Task runner —
runcommand with Rich progress bars and error handling - Structured logging — Rich console handler with optional file rotation
- Full test suite — Click CliRunner tests for every command
- Best practices guide — Building, testing, and distributing CLI apps
File Tree
python-cli-framework/
├── src/
│ └── cli/
│ ├── main.py # CLI entry point with Click group
│ ├── commands/
│ │ ├── init.py # Project scaffolding command
│ │ ├── run.py # Task runner command
│ │ └── config.py # Config management command
│ ├── config.py # TOML config read/write
│ ├── output.py # Table/JSON/YAML/CSV formatters
│ ├── logging_setup.py # Structured logging
│ └── utils.py # Utility functions
├── templates/
│ ├── pyproject.toml.j2 # Project template
│ └── README.md.j2 # README template
├── tests/
│ ├── test_cli.py # CLI command tests
│ └── test_config.py # Config tests
├── guides/
│ └── building-cli-apps.md # Best practices guide
└── pyproject.toml # Package configuration
Getting Started
1. Install
pip install -e ".[dev]"
2. Try the CLI
# Initialize a new project
mycli init my-project --template default
*... continues with setup instructions, usage examples, and more.*
📄 Code Sample .py preview
src/cli/config.py
"""
Configuration management — TOML-based config with environment fallback.
Reads and writes a TOML configuration file with support for
dotted key paths, default values, and environment variable
overrides using the CLI_ prefix convention.
"""
from __future__ import annotations
import logging
import os
import sys
from pathlib import Path
from typing import Any
if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib
import tomli_w
logger = logging.getLogger(__name__)
DEFAULT_CONFIG: dict[str, Any] = {
"project": {
"name": "my-project",
"version": "0.1.0",
"author": "Developer",
},
"output": {
"color": True,
"format": "table",
},
"logging": {
"level": "INFO",
"file": None,
},
}
class ConfigManager:
"""Manage TOML configuration with environment variable overrides."""
ENV_PREFIX = "CLI_"
def __init__(self, path: Path) -> None:
self.path = path
self._data: dict[str, Any] = {}
# ... 100 more lines ...