Registry / web-framework / click-compose

click-compose

JSON →
library2025.10.27.3pypiunverified

Click-compose is a Python library that provides composable utilities for enhancing Click callback functions, enabling the construction of flexible and modular command-line interface (CLI) applications. It extends the core functionality of the Click framework by offering tools to easily chain and combine command logic. The library is actively maintained, with its current version being 2025.10.27.3, and follows a frequent release cadence.

pip install click-compose
INSTALL
IMPORT
SIG · CLICK-COMPOSE
C
click-compose
web-frameworkenv2025.10.27.3
Install
2.1s avg
Import
—
Disk
26MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2025.10.27.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 2.35s
py 3.11
✓ —
✓ 2.15s
py 3.12
✓ —
✓ 1.9s
py 3.13
✓ —
✓ 1.9s
py 3.9
✕ build_error
✕ build_error
26MB installed
● package 26MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

callback_group
✓ from click_compose import callback_group
Assumed primary import for composing groups of callbacks.
composed_option
✓ from click_compose import composed_option
Assumed utility for defining composable Click options.

This quickstart demonstrates a basic Click CLI application using `click-compose` to create a `callback_group` and a `composed_option`. The `cli` command acts as a group, and `shout` is a subcommand that uses a composed option to conditionally output an uppercase greeting. This illustrates how to extend Click's decorator-based approach with additional composition logic.

import click from click_compose import callback_group, composed_option @callback_group() @click.command() @click.option('--name', default='World', help='The name to greet.') def cli(name): """A simple CLI greeting utility.""" click.echo(f'Hello, {name}!') @cli.command() @composed_option('--caps', is_flag=True, help='Say hello in uppercase.') def shout(caps, name): """Greets in an excited manner.""" message = f'HEY {name.upper()}!' if caps else f'Hey {name}!' click.echo(message) if __name__ == '__main__': cli()
Debug
Known issues
breakingMajor version updates of the underlying 'click' library may introduce incompatibilities that require 'click-compose' to release a new version or for users to adjust their code.
fix
Check the 'click-compose' release notes for compatibility with your 'click' version. Pin 'click' to a known compatible version if issues arise.
affects: <2025.10.x.x
gotchaIncorrect order of decorators (e.g., Click's @command before @callback_group or @composed_option) can lead to unexpected behavior or errors, as Click's decorators often wrap the function directly.
fix
Always place 'click-compose' decorators above standard 'click' decorators, or consult the documentation for specific decorator stacking order. Generally, more 'inner' decorators (affecting the immediate function) should be closer to the function definition.
affects: All
Errors
Common errors & fixes
TypeError: 'Command' object is not callable
Attempting to call a Click command directly that has been modified by a 'click-compose' decorator in a way that changes its callable interface without proper invocation via Click's `Context.invoke` or `CliRunner`.
fix
Ensure that `click` commands modified by `click-compose` are always invoked correctly within the Click ecosystem, typically through a parent `click.group` or `cli()` entry point, not as standalone Python functions.
ModuleNotFoundError: No module named 'click_compose'
The 'click-compose' package is not installed in the current Python environment.
fix
Run `pip install click-compose` to install the library.
Upgrade
Version history
2025.10.27.3latest on PyPI · released Oct 27, 2025
Audit
Dependencies
clickrequiredCore dependency for building command-line interfaces, as 'click-compose' provides utilities for Click callbacks.
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources

No resource links recorded.

click-compose — pip install click-compose · libregistry