Table of Contents
About
useCli A powerful Python CLI framework for building beautiful, developer-friendly command-line tools. It gives you:
- Prefix matching — Type
heinstead ofhelp - Interactive mode — Searchable command picker
- Auto-generated help — Clean, styled output
- Command scaffolding —
make:commandgenerates boilerplate - UI components — Prompts, menus, styled console output
Quick Start
Install usecli with uv (recommended)
uv add usecli
Install with pip (alternative)
pip install usecli
Initialize
usecli init
init asks whether to install the generated usecli skill for coding agents.
The prompt defaults to yes; after confirming, choose the install scope and
agent targets. Pass --install-skill to skip the yes/no prompt, or
--no-install-skill to skip installation.
ASCII-art titles (optional)
uv add "usecli[figlet]"
# or: pip install "usecli[figlet]"
The extra installs pyfiglet. With it,
usecli init offers a figlet font picker and banners are rendered in the
chosen font. Without it, the picker is skipped and banners print as colored
text: title and version on one line, description below.
Create a command
usecli make:command hello
Your new command is ready in the commands directory:
class HelloCommand(BaseCommand):
def signature(self) -> str:
return "hello"
def description(self) -> str:
return "Say hello"
def handle(self, name: str = Argument(..., help="Your name")) -> None:
console.print(f"Hello, {name}!")
Run it:
usecli hello world
Usage
Prefix Matching
Type partial command names:
usecli he # help
usecli ma:co # make:command
Interactive Mode
usecli --interactive # Searchable picker for all commands
usecli -i hello # Run 'hello' command interactively
The picker opens in-place with vim-style keys: j/k or the arrow keys move,
/ starts search, and enter runs the highlighted command. esc leaves search
mode but keeps the filter active (normal-mode navigation still works); ctrl-u
clears the filter. Command names, descriptions, the title and the status bar use
your theme colors; the highlighted row switches to the theme's highlight style.
Command Groups
Colon-separated commands group automatically in help:
def signature(self) -> str:
return "db:migrate"
Displays as:
db:
migrate Run migrations
backup Backup database
Space-separated signatures create nested subcommands:
def signature(self) -> str:
return "spec show" # usecli spec show
JSON Output
Every command inherits --json; commands do not declare the option themselves. The flag works before or after a command name:
usecli --json about
usecli about --json
A successful invocation writes exactly one JSON document to stdout:
{"ok":true,"data":null}
A command can return any JSON-serializable value to populate data:
class StatusCommand(BaseCommand):
def signature(self) -> str:
return "status"
def description(self) -> str:
return "Show service status"
def handle(self):
return {"status": "ready", "workers": 3}
Failures preserve a non-zero exit status and use a stable error envelope:
{"ok":false,"error":{"type":"UsageError","message":"No such command","code":2}}
In JSON mode, stdout is reserved for that document. Human-facing output, including console.print() and ordinary print(), is routed to stderr. Prompts and confirmations resolve their declared defaults without reading stdin. A prompt without a default, menus, and --interactive fail immediately with a structured NonInteractiveError instead of blocking.
The existing fields ok, data, error, error.type, error.message, and error.code keep their names and types across compatible releases. New fields may be added.
UI Components
from usecli import Confirm, Menu, Prompt, console
console.print("[green]Done![/green]")
name = Prompt.ask("Enter name")
port = Prompt.ask("Port", type="int", default=8000)
ratio = Prompt.ask("Ratio", type="float", default=0.5)
token = Prompt.ask("API token", password=True)
masked = Prompt.ask("PIN", mask="*")
mode = Prompt.ask("Mode [a/b/c]", choices=["a", "b", "c"], single_key=True)
ok = Confirm.ask("Continue?", single_key=True)
choice = Menu.select(["A", "B", "C"])
Prompt.ask(type=...) parses "string" (default), "int", or "float".
password=True hides input entirely; mask="*" echoes one mask character per
keystroke (and wins if both are supplied) and falls back to hidden input
without a terminal. Single-key
Prompt.ask(..., single_key=True) answers single-character choices on the
first keypress; Confirm.ask(..., single_key=True) does the same for y/n.
Without the flag both keep Rich's line-based prompt, and non-terminal
stdin/stdout always falls back to line input. In JSON mode prompts return their
declared default or raise NonInteractiveError.
Rich renderables are re-exported, so commands never import rich directly:
from usecli import Markdown, Panel, Syntax, Table, Tree
console.print(Panel(Markdown("# Report")))
console.print(Syntax(source, "python"))
from usecli.rich import ... exposes the same set as an explicit namespace. All
Rich console, text, layout, progress, and prompt components are covered
(Table, Tree, Panel, Rule, Layout, Live, Progress, Pretty,
JSON, Traceback, and the rest); imports stay lazy, so import usecli does
not load Rich.
Progress Indicators
Use Spinner when the amount of work is unknown and ProgressBar when a total is known:
from usecli import ProgressBar, Spinner
with Spinner("Loading records") as spinner:
load_records()
spinner.update("Indexing records")
with ProgressBar(total=len(items), description="Processing") as progress:
for item in items:
process(item)
progress.advance()
Progress always renders to stderr, uses the active usecli theme, and is suppressed automatically in JSON mode, with quiet=True, or when stderr is not attached to a terminal. Calling commands do not need to detect these conditions.
Available Commands
about Show app info
help Show help
init Initialize usecli (usecli only)
inspire Random quote
upgrade Upgrade the application to the latest version
make:command Create new command (usecli only)
make:theme Create new theme (usecli only)
make:skill Create a bundled skill (usecli only)
make:bundle Build a standalone executable with PyInstaller (usecli only)
Root options live in [usecli.options]. Leave options your CLI does not need
unregistered by listing their long names:
[usecli.options]
hidden = ["interactive", "json", "install-skills"]
interactive and json apply to every command and command group; the other
names (version, install-skills, show-completion, install-completion)
only affect the root CLI. --help/-h can never be hidden, and the usecli
framework binary ignores options.hidden.
By default, --install-skills appears in the root options and runs the
interactive installer, but only when the CLI has bundled skills (the usecli
framework binary always has its generated skill). Set
[usecli.commands] skill_install = "command" to show skill:install under a
skill: section instead, or "none" to hide both the option and the command
so the project can provide its own installer. Override the help text with
[usecli.commands] skill_install_description:
[usecli.commands]
skill_install = "option"
skill_install_description = "Install the mycli skill for coding agents."
The default is "Install bundled skills for coding agents.".
Coding Agent Skills
Every usecli CLI can ship its own Agent Skills. A skill is a directory with a
SKILL.md under paths.skills (default skills beside
usecli.config.toml):
src/mycli/
skills/
deploy-checks/
SKILL.md
Scaffold one from the project with the usecli framework binary:
usecli make:skill deploy-checks --description "Check deployments"
make:skill is a framework scaffolding command, not a project-CLI command.
The generated skill belongs to the project CLI and is installed by the project
CLI. With the default config, the root option runs interactively:
mycli --install-skills
A project CLI exposes the installer only when it has at least one bundled
skill. It installs project skills only and does not install the generated
usecli skill. Set [usecli.commands] skill_install = "command" to use the
non-interactive command form:
mycli skill:install # project: .claude/, .agents/, .cursor/
mycli skill:install --global # user: ~/.claude/, ~/.agents/, ~/.cursor/
mycli skill:install --list # show bundled skills and targets
mycli skill:install --skill deploy-checks # one project skill
mycli skill:install --agent claude,codex # one or more agents
mycli skill:install --interactive # choose scope, skills, and agents
Set [usecli.commands] skill_install = "none" to hide --install-skills and
skill:install entirely. The built-in command is not registered, so a project
can ship its own installer without the framework surfaces competing with it.
The framework binary installs its own generated skill. The default option is interactive; the command form exposes the full flag set:
usecli --install-skills # prompt for scope and agents
usecli skill:install # install the usecli skill
usecli skill:install --global # user-level usecli skill
usecli skill:install --list # show the usecli skill and targets
The generated usecli skill is derived from the running app, so the installed
reference always lists the live commands, options, themes, JSON contract,
prompts, progress, configuration, and packaging.
Supported targets are claude, opencode, codex, pi, prime-agent,
omp, cursor, and agents; --agent all selects every target. Global
installs honor CLAUDE_CONFIG_DIR, OPENCODE_CONFIG_DIR, XDG_CONFIG_HOME,
CODEX_HOME, PI_CODING_AGENT_DIR, PRIME_AGENT_CODING_AGENT_DIR, and
OMP_AGENT_DIR.
Installation is idempotent. Managed files carry a <!-- usecli-skill: ... -->
hash marker: an exact re-run changes nothing, and a new release updates its own
files. Non-interactive installs preserve locally edited files unless --force
is passed. Interactive installs replace local edits, matching npx skills add.
The same machinery is available from Python:
from usecli.skills import Skill, install_skills
install_skills(
[
Skill(
name="deploy-checks",
description="Check deployments",
content="---\nname: deploy-checks\ndescription: Check deployments\n---\n",
)
],
agents=["claude"],
scope="project",
)
To run the same interactive installer from your own code, call
prompt_skill_install. It accepts a skill folder or explicit skill templates,
limits the agent choices, and lets you enable or skip each prompt:
from usecli import prompt_skill_install
prompt_skill_install(
skills_dir="src/mycli/skills", # or skills=[Skill(...)]
agents=["claude", "codex"], # agent choices shown in the menu
show_scope=True, # offer project vs. global
show_agents=True, # offer the agent menu
show_skills=True, # offer the skill menu when >1
)
app is optional: omit it to use the running CLI's Typer app. Pass
app=other_app only when installing another app's skills. Set scope="global"
to skip the scope prompt, or pass show_scope=False, show_agents=False,
show_skills=False, and print_results=False to disable individual steps and
output.
Scaffolding from Python
make:command, make:theme, and make:skill are also functions. They return
the path they wrote and honor the same configured paths and project templates
as the CLI:
from usecli import make_command, make_skill, make_theme
make_command("deploy")
make_theme("dusk")
make_skill("deploy-checks", description="Check deployments")
Pass commands_dir, themes_dir, skills_dir, templates_dir, or
project_root to write somewhere else. force=True overwrites an existing
command or skill, and an existing theme instead of adding a numeric suffix.
Invalid names and existing targets raise ScaffoldError from usecli.scaffold.
Use the prompt_make_* variants to ask for the missing values interactively:
from usecli import prompt_make_command, prompt_make_skill, prompt_make_theme
prompt_make_command()
prompt_make_theme()
prompt_make_skill()
Upgrades
Every CLI built on usecli ships upgrade, which detects how the running
package was installed and delegates to the same package manager — uv tool,
pipx, or pip — instead of creating a second installation:
mycli upgrade --check # show installed/latest versions and the source
mycli upgrade # confirm and install the latest release
mycli upgrade --force # skip the prompt and the up-to-date check
The source comes from packaging metadata: PyPI for index installs, and the
Git remote for PEP 610 direct_url.json installs. Override it in
usecli.config.toml when metadata is not enough (private mirrors, missing
direct_url.json, a package name that differs from the command name):
[usecli.upgrade]
enabled = true
source = "git" # "auto" (default) | "pypi" | "git"
package = "mycli" # optional
url = "https://github.com/owner/mycli.git" # required for "git" unless detected
ref = "main" # branch, tag, or commit
Frozen bundles, editable installs, and commit-pinned installs are reported as non-upgradeable with an explanation and manual next step.
Entry Points & Packaging
A usecli CLI can be exposed in several ways, depending on how you distribute and
run it. There are three common setups — none requires anything but the base
usecli install, and the optional bundler adds PyInstaller packaging on top.
1. Default — console script (no entry point)
The simplest setup. Declare a console script in your project's pyproject.toml:
[project.scripts]
mycli = "usecli:main"
usecli resolves your project's config automatically from the current directory
(config discovery), so no main.py is required. Install and run it:
uv add usecli
uv run mycli --help
This is the default — no entry point file of your own is needed.
2. Custom entry point — main.py
If you want your own entry point, use the public runtime API. It works in both
development and frozen bundles, and accepts an optional config path (the config
file is always named usecli.config.toml):
# main.py
from usecli import run
def main():
run("./cli/usecli.config.toml") # resolved from the cwd, then this module
# run() # auto-detect: walk up from the cwd, then from this module
if __name__ == "__main__":
main()
A relative config_path (a str or any os.PathLike) is tried against the
current working directory first, then against the directory of the file that
calls run(). So run("./cli/usecli.config.toml") works both from the project
root and from an installed console script started anywhere, provided the config
ships as package data at that relative path under the module's directory
(uv_build includes files under the module directory).
Run it in development (no PyInstaller required):
uv run python main.py --help
To expose the same entry point as a console script, point [project.scripts]
at the main function in your myapp package (the usual src/myapp layout):
[project.scripts]
myapp = "myapp:main"
The module named here must be the one that calls run(): point at myapp:main
when main lives in src/myapp/__init__.py, or at myapp.cli:main when it
lives in src/myapp/cli/__init__.py. Discovery is anchored to that module's
directory, not to the shell's cwd.
3. Bundler — standalone executable (optional, requires PyInstaller)
The bundler is an optional feature gated on PyInstaller being installed. Install it with:
uv add "usecli[pyinstaller]"
Once installed, a make:bundle command appears (usecli only) that builds your
project into a standalone executable. It asks which mode to use via an
interactive menu, and confirms before building (defaults to no unless -y):
uv run usecli make:bundle # menu: one file vs one folder + confirm
uv run usecli make:bundle --mode onefile # single-file executable
uv run usecli make:bundle --mode onedir # one-folder bundle
uv run usecli make:bundle -y # skip the confirmation
uv run usecli make:bundle --mode onedir -y # fully programmatic
uv run usecli make:bundle --mode onedir --zip -y # one-folder bundle + zip
When building a one-folder bundle, make:bundle asks whether to also zip
the folder into dist/<name>.zip (PyInstaller's recommended distribution
format for one-folder mode). Pass --zip / --no-zip to skip the prompt and
force a choice; with -y and no flag, zipping is skipped.
A usecli-bundle console script wraps the same build, and you can drive it from
Python too:
uv run usecli-bundle
uv run usecli-bundle --mode onedir
uv run usecli-bundle --mode onedir --zip
from usecli import pyinstaller
pyinstaller() # auto-detect config, single-file
pyinstaller(mode="onedir") # one-folder bundle
pyinstaller(mode="onedir", zip=True) # one-folder bundle + zip
pyinstaller("path/to/usecli.config.toml") # or point at a specific config
Output lands in dist/ — dist/mycli for onefile, or a dist/mycli/ folder
containing the executable (plus _internal/ with the bundled assets) for
onedir. With zip=True, a dist/mycli.zip archive is created alongside the
folder. make:bundle and usecli-bundle are only available when PyInstaller
is installed.
Development
See the Development Guide for setup, testing, and architecture details.
Contributing
Read the Contributing Guide.
Quick workflow:
- Fork and branch:
git checkout -b feature/name - Make changes
- Run checks:
uv run poe clean-full - Commit and push
- Open a Pull Request
License
MIT. See LICENSE.
Built by thememium
Metadata
Release files for usecli 0.2.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| usecli-0.2.13.tar.gz | 150.1 kB | Without provenance | Details for usecli-0.2.13.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| usecli-0.2.13-py3-none-any.whl | Python 3 | none | any | Details for usecli-0.2.13-py3-none-any.whl |
Total release size: 327.0 kB
Release files / usecli-0.2.13.tar.gz
| Download URL | usecli-0.2.13.tar.gz |
|---|---|
| Size | 150.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ab9dfbf7e78862297de09d6e948f6d5548eaafc23e1e4e3a315c012ca8ac203
|
|
BLAKE2b-256 checksum How to use checksums |
0fbfb697032e90ae54b19c6335257d558b4a41260029bcce0e4516881d255f82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / usecli-0.2.13-py3-none-any.whl
| Download URL | usecli-0.2.13-py3-none-any.whl |
|---|---|
| Size | 177.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5411b8adc4fcb4321c1831fca811d1a33013888b82f24519b3a942893882fac4
|
|
BLAKE2b-256 checksum How to use checksums |
9f4e9e6945fcf26ddded8edda214dd9aa4fe7385383bdd3ff3039c48a830e078
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for usecli 0.2.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.