Skip to main content

A wrapper around the Click library for Python. PyCmds makes it easier to use Click’s command execution framework independently of the command line (i.e. executing Click Commands in an existing Python instance.)

To accompany this, PyCmds adds a CmdCompleter class which implements the Completer interface from the python-prompt-toolkit. Using this class, one may create a python-prompt-toolkit interface with intelligent (see below) autocompletion for Click Commands and Options.

Also, PyCmds adds an AliasGroup class to allow the assignment of aliases to Click Commands.

CmdCompleter Features

  • Only displays completion menu when the completer is certain of what options or subcommands are valid. (E.g. no naive option or subcommand suggestions when Click is expecting a value for a previous option.)

  • Considers click.Option.is_flag and click.Parameter.nargs to decide how many values a option should consume.

  • Considers click.Option.count and click.Option.multiple to decide if more than one instance of the same option should be permitted.

  • Smart autocompletion for grouped short flags with or without a value clustered on the end.

Important Notes About CmdCompleter

  • Designed primarily for POSIX-style options.

  • Only context settings specified on the root/top-level Command will be considered (by necessity).

  • Incompatible with click.Context.allow_interspersed_args.

  • Incompatible with click.Context.ignore_unknown_opts.

  • Incompatible with click.MultiCommand.chain.

  • The split character for parameters with nargs > 1 is expected to be a space.

Metadata

Release files for pycmds 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycmds 1.0.4
File Size Uploaded
pycmds-1.0.4.tar.gz 11.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pycmds 1.0.4
File Interpreter ABI Platform
pycmds-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 23.0 kB

Release files / pycmds-1.0.4.tar.gz

Download URL pycmds-1.0.4.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
356f2fc5713e5ac3e211e13b7735034aec07c9307f41715a2213d062ecac3abb
BLAKE2b-256 checksum
How to use checksums
0876867fa23d4d6668e599f365e9a197f1d53af6ce2d97d1ef51299888933e20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

Release files / pycmds-1.0.4-py3-none-any.whl

Download URL pycmds-1.0.4-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7d7b633fec2ce906115959966dae4a9f0e91ad9b13fdac5fbc040c18174be75
BLAKE2b-256 checksum
How to use checksums
1e432028a4800b8b8257449c9a28d0928443aa872aa37823019ef6e5b4bf9217
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page