ask-shell
Python library for CLIs that use interactive prompts, subprocess runs with Rich output, and test helpers so the same flows run in tests without a TTY.
- Install:
uv add ask-shellorpip install ask-shell(Python 3.13+) - Docs: GitHub Pages
What it provides
- ask: Prompts (confirm, text, select list/dict, single and multiple choice) built on questionary, with Rich styling
- shell: Run shell commands via
run,run_and_wait, andrun_pool; prefixed live output, optional log dirs, retries, and interrupt handling - console: Rich console and progress utilities;
configure_logging(app)wires a Typer app to Rich logging (handler, command decorator, optional secret hiding) - shell_events: Callbacks for run lifecycle (before/after, stdout/stderr) for custom handling
- AskShellSettings: Paths and options (e.g. run log directory); plug into your config or env
Quick example
from ask_shell import ask, shell
if ask.confirm("Run the script?", default=True):
name = ask.text("Name:", default="world")
shell.run_and_wait(f"echo Hello, {name}")
Testing
Use question_patcher to feed fixed responses to prompts, or raise_on_question to fail fast when a prompt is hit. Both are context managers; see the ask API docs for details.
from ask_shell import ask
from ask_shell.ask import question_patcher
with question_patcher(responses=["y", "myname"]):
assert ask.confirm("Run?")
assert ask.text("Name:") == "myname"
License
MIT. See LICENSE.
Metadata
Release files for ask-shell 0.11.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ask_shell-0.11.5.tar.gz | 41.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ask_shell-0.11.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 89.5 kB
Release files / ask_shell-0.11.5.tar.gz
| Download URL | ask_shell-0.11.5.tar.gz |
|---|---|
| Size | 41.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b15e46086f033daa7ccffbf703a58869b66a427f432145c721fb5c9356bb361a
|
|
BLAKE2b-256 checksum How to use checksums |
e5bc897078478b605ce53445c432a461bb8d6de430e049305a7af7a3360b2bc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 22, 2026.
Transparency logRelease files / ask_shell-0.11.5-py3-none-any.whl
| Download URL | ask_shell-0.11.5-py3-none-any.whl |
|---|---|
| Size | 48.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b3a7fee9cedcbed0b89f938c557f9297c9ffb3a80ae3dd5bcacd4a1acdfa524
|
|
BLAKE2b-256 checksum How to use checksums |
a7a2c6337b0364e957a420607fbd23b42048fad7150a7357c26e9d107882f171
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 22, 2026.
Transparency log