Skip to main content

Action Completer (Fourteen Fork)

Supported Versions Test Status Code Style: Black

A fairly simple method for registering callables as prompt-toolkit completions.

Note: This is a fork of stephen-bunn/prompt-toolkit-action-completer maintained by Fourteen-IP with additional features and improvements.

This package provides the basic features to easily construct a custom completer using decorators to reduce the amount of boilerplate needed to build basic tooling through prompt-toolkit. A quick example is provided below, but if you are interested in the available features and patterns you should read through the documentation.

This is a project that I originally created for myself several times when building personal utilities with prompt-toolkit, and figured it might be useful for other people to eventually use or extend. As a side-effect of this being a personal utility, the provided functionality may not exactly fit what you are looking for and the provided tests do not check all edge cases properly yet.

from pathlib import Path

from action_completer import ActionCompleter
from prompt_toolkit.shortcuts import prompt
from prompt_toolkit.completion import PathCompleter
from prompt_toolkit.validation import Validator

completer = ActionCompleter()


@completer.action("cat")
@completer.param(
  PathCompleter(),
  cast=Path,
  validators=[
      Validator.from_callable(
        lambda p: Path(p).is_file(),
        error_message="Path is not an existing file"
      )
  ]
)
def _cat_action(filepath: Path):
  with filepath.open("r") as file_handle:
      print(file_handle.read())


prompt_result = prompt(
  ">>> ",
  completer=completer,
  validator=completer.get_validator()
)
completer.run_action(prompt_result)

Example Recording

Metadata

Release files for fourteen-prompt-toolkit-action-completer 1.2.2

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

Source distribution (sdist)

Source distribution for fourteen-prompt-toolkit-action-completer 1.2.2
File Size Uploaded
fourteen_prompt_toolkit_action_completer-1.2.2.tar.gz 25.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fourteen-prompt-toolkit-action-completer 1.2.2
File Interpreter ABI Platform
fourteen_prompt_toolkit_action_completer-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 56.6 kB

Release files / fourteen_prompt_toolkit_action_completer-1.2.2.tar.gz

Download URL fourteen_prompt_toolkit_action_completer-1.2.2.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c6706bb3f5d10c290699723f26941a0ffb013e367f02c4fdb8a85cdcaa5a6280
BLAKE2b-256 checksum
How to use checksums
1310b3928d432c613ee3f4d1d318a2d05c82d02c2d3a4187ddebbcec57352f49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 10, 2025.

Transparency log

Release files / fourteen_prompt_toolkit_action_completer-1.2.2-py3-none-any.whl

Download URL fourteen_prompt_toolkit_action_completer-1.2.2-py3-none-any.whl
Size 31.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
871013dfed752b4288e4a6e1b6a60af4b1097d7fd4136cf77286619b482b4eec
BLAKE2b-256 checksum
How to use checksums
e146316a37a07b61751b7bed9a03381d29bc05fad332cdedd94fc803b9f90cf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 10, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.2 This release

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