Install & Compatibility
Where this runs
tested against v2.1 · 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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.098s · 18.7MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.088s · 19MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Shell
✓ from click_shell import Shell
✗ from click_shell.shell import Shell
Direct import from click_shell is correct, not from submodule
click_shell
✓ import click_shell
✗ import click.shell
click-shell is a separate package, not part of click
Create a Click shell with custom prompt and intro message.
import click
from click_shell import Shell
@click.group(cls=Shell, prompt='myapp> ', intro='Welcome to myapp shell')
def cli():
pass
@cli.command()
def hello():
click.echo('Hello, world!')
if __name__ == '__main__':
cli()
click-shell --version
Debug
Known issues
gotchaclick-shell does not support Click 8+ fully; may cause import errors with newer Click versions.fixPin Click to 7.x or use a fork like click-shell2.
affects: >=2.1, all versions
deprecatedLibrary is in maintenance mode; no active development since 2019.fixConsider migrating to alternative like click-shell2 or prompt_toolkit-based solutions.
affects: all
gotchaThe Shell class requires a click.Group subclass; using a simple click.group() decorator will not work.fixAlways pass cls=Shell to @click.group.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'Shell' from 'click_shell'
Incorrect import path or missing package installation.
fixRun 'pip install click-shell' and use 'from click_shell import Shell'.
TypeError: 'Shell' object is not callable
Using @click.group() without cls=Shell, or calling Shell() directly instead of decorating a function.
fixUse @click.group(cls=Shell) on a function, do not instantiate Shell directly.
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment.
Python locale misconfiguration; common on minimal Docker images.
fixSet environment variable 'LC_ALL=C.UTF-8' or 'LANG=C.UTF-8'.
Upgrade
Version history
2.1latest on PyPI · released Jun 27, 2021
Audit
Dependencies
clickrequiredRequired dependency