lib-cli-exit-tools
CLI exit handling helpers: clean signals, exit codes, and error printing
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has low install friction, carries no security vulnerabilities, and solves a real problem for CLI developers: portable signal handling and consistent exit codes across platforms. Use it whenever you wrap a Click command that needs to behave correctly in shell pipelines and CI/CD systems.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or newer.
- Low friction: pure Python wheel with a single runtime dependency (rich-click).
- Active maintenance with recent releases.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you may use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
last release 2026-07-29 (16 days) · last repo commit 2026-07-29
0 known vulnerabilities (OSV.dev, 2026-08-14) · 138,656 downloads/mo, #11,323 on PyPI
Alternatives
Verify before relying
pip install lib-cli-exit-tools
from lib_cli_exit_tools import run_cli
import rich_click as click
@click.command()
def hello():
click.echo("Hello")
if __name__ == "__main__":
raise SystemExit(run_cli(hello))- Whether the library's exit-code mappings (e.g., FileNotFoundError → 2, PermissionError → 13) match all target platforms' conventions.
- Performance impact of signal installation and exception handling in high-throughput CLI scenarios.
What it is and what it does
lib_cli_exit_tools wraps Click commands to handle platform-specific signal translation, exception-to-exit-code mapping, and error output formatting. It solves the problem of CLI applications behaving inconsistently across shells, CI/CD systems, and operating systems by automatically converting Python exceptions (FileNotFoundError, PermissionError, KeyboardInterrupt) into standard exit codes, translating SIGINT/SIGTERM/SIGBREAK into structured exceptions, and gracefully handling BrokenPipeError when output is piped to truncating tools.
The library is built on rich-click and provides two main entry points: run_cli() for wrapping a single command with signal handling and exit-code translation, and cli_session() as a context manager for centralised configuration and testing. It supports optional traceback display via --traceback, custom signal handlers, and subprocess stdout/stderr capture. Configuration is test-friendly and requires no boilerplate beyond wrapping your Click command.
Use it for
- Wrap a Click command to ensure it returns exit code 130 on Ctrl+C and 141 on broken pipe, matching shell conventions.
- Build a multi-command CLI that toggles full Rich-formatted tracebacks via --traceback without modifying command code.
- Handle SIGTERM gracefully in containerised applications by translating it to a deterministic exit code.
- Test error paths by raising exceptions and verifying the correct exit code is returned without manual bookkeeping.
- Pipe CLI output to head or other truncating tools without noisy tracebacks when BrokenPipeError occurs.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has low install friction, carries no security vulnerabilities, and solves a real problem for CLI developers: portable signal handling and consistent exit codes across platforms. Use it whenever you wrap a Click command that needs to behave correctly in shell pipelines and CI/CD systems.
Install
lib-cli-exit-tools on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (rich-click). Active maintenance with recent releases. Supports Python 3.10 through 3.14.
Requires Python 3.10 or newer.
License in practice
MIT license is permissive; you may use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install lib-cli-exit-tools
from lib_cli_exit_tools import run_cli
import rich_click as click
@click.command()
def hello():
click.echo("Hello")
if __name__ == "__main__":
raise SystemExit(run_cli(hello))
Verify before relying
- Whether the library's exit-code mappings (e.g., FileNotFoundError → 2, PermissionError → 13) match all target platforms' conventions.
- Performance impact of signal installation and exception handling in high-throughput CLI scenarios.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagerich-click |
| Maintenance | Actively maintained 16 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 138,656 / month, #11,323 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Environment :: ConsoleLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Typing :: Typed |
Evidence: lib_cli_exit_tools-2.3.4-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “cli exit code handling”
- lib-cli-exit-toolsProvides portable signal handling, exception-to-exit-code mapping,…
- cli-exit-toolsHandles proper exit procedures for CLI applications: prints traceback…
- exitstatusProvides portable, type-safe POSIX exit status code definitions as an…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also cli-exit-tools · pysigset · exitstatus · exit-codes · click · rich-click · better-exceptions · click-compose · kthread · cysignals