Registry / devops / auto-click-auto

auto-click-auto

JSON →
library0.1.5pypypi✓ verified 85d ago

auto-click-auto is a small Python library (current version 0.1.5) that automatically enables tab shell completion for Bash (version 4.4 and up), Zsh, and Fish in Click CLI applications. It aims to simplify the setup of shell completion compared to Click's native methods by offering a seamless, automatic configuration. The project has a low-to-moderate release cadence, with the latest update on June 26, 2024.

pip install auto-click-auto
INSTALL
IMPORT
SIG · AUTO-CLICK-AUTO
A
auto-click-auto
devopspythonv0.1.5
Install
1.6s avg
Import
69ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.5 · 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
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.073s · 18.7MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.6s · import 0.065s · 19MB
17MB installed
● package 17MB
Code
Verified usage

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

enable_click_shell_completion
from auto_click_auto import enable_click_shell_completion
Used for general, automatic enabling of shell completion within your Click application.
enable_click_shell_completion_option
from auto_click_auto import enable_click_shell_completion_option
Intended to be used as a decorator on a Click command for enabling shell completion.
ShellType
from auto_click_auto.constants import ShellType
Enum representing supported shell types (Bash, Zsh, Fish) for configuration.

This quickstart demonstrates integrating `auto-click-auto` into a basic Click CLI. The `enable_click_shell_completion` function is called at the end of the main CLI function, providing the program's executable name and a set of `ShellType` enums for which to enable completion.

import click from auto_click_auto import enable_click_shell_completion from auto_click_auto.constants import ShellType import os # Only for example program_name, not strictly for auto-click-auto @click.command() @click.option('--count', default=1, help='Number of greetings.') @click.option('--name', prompt='Your name', help='The person to greet.') def hello(count, name): """Simple program that greets NAME for a total of COUNT times.""" for x in range(count): click.echo(f"Hello {name}!") # Automatically enable shell completion for specified shells # Replace 'my-cli-app' with the actual executable name of your CLI # For testing, you might use 'python -m my_cli_module' as the program_name enable_click_shell_completion( program_name=os.path.basename(__file__).replace('.py', ''), # Derives name from script, adjust for packaged CLIs shells={ShellType.BASH, ShellType.ZSH, ShellType.FISH}, # For debugging, add debug=True ) if __name__ == '__main__': hello()
auto-click-auto --version
Debug
Known issues
gotchaClick versions 8.0.0 and above include native shell completion features. While `auto-click-auto` simplifies the automatic setup, users should be aware of Click's built-in capabilities, which might be sufficient for some use cases.
fix
Review Click's official documentation on shell completion to understand the native options before deciding on `auto-click-auto`. If your needs are simple and manual setup is acceptable, native Click completion might be preferred.
affects: Click >= 8.0.0
deprecatedThe project author has noted that `auto-click-auto` might be duplicating functionality now integrated into Click itself and "might need to be archived." This suggests potential long-term maintenance uncertainty or eventual deprecation if Click's native features fully encompass its purpose.
fix
Monitor the project's GitHub repository for updates regarding its status and any recommendations for migration to Click's native completion or alternative tools if it becomes archived. Consider this when choosing long-term dependencies.
affects: All versions
gotcha`auto-click-auto` explicitly supports Bash (version 4.4 and up), Zsh, and Fish. Autocompletion will not work out-of-the-box for other shell environments (e.g., PowerShell, older Bash versions).
fix
Verify that your target shell is one of the supported types and meets the minimum version requirements. For unsupported shells, you would need to implement custom completion logic or use another library like `click-completion` (though it's in maintenance mode for Click < 8.0).
affects: All versions
Errors
Common errors & fixes
Shell autocompletion is not working after installing and configuring 'auto-click-auto'.
This can happen if the `program_name` passed to `enable_click_shell_completion` does not match the actual executable name used to run your CLI, or if the shell's configuration (`~/.bashrc`, `~/.zshrc`, etc.) hasn't been reloaded or the necessary `eval` command hasn't been run after the initial setup. It might also be due to an unsupported shell version or type.
fix
Ensure `program_name` exactly matches how your CLI is invoked (e.g., if you run `my-app`, `program_name='my-app'`). After the first run of the CLI with `auto-click-auto` enabled, ensure you reload your shell (e.g., `source ~/.bashrc` or open a new terminal) or follow any specific instructions `auto-click-auto` prints to stdout. Double-check your shell version and type compatibility.
Error: 'ShellType.POWERSHELL' is not a valid ShellType, or autocompletion does not work in PowerShell.
`auto-click-auto` only supports Bash (4.4+), Zsh, and Fish. It does not provide built-in support for PowerShell or other shells.
fix
If you require PowerShell completion, `auto-click-auto` is not the right tool. You would need to explore Click's native methods for adding custom shell support (which is a more technical process) or look for other third-party Click extensions specifically designed for PowerShell completion, if available.
Upgrade
Version history
0.1.5latest on PyPI · released Jun 26, 2024
Audit
Dependencies
ClickrequiredCore dependency for building CLI applications that auto-click-auto extends for shell completion.
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
1
Resources
auto-click-auto — pip install auto-click-auto · libregistry