Skip to main content

ask-shell

PyPI GitHub codecov Docs

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-shell or pip 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, and run_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.1

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

Source distribution (sdist)

Source distribution for ask-shell 0.11.1
File Size Uploaded
ask_shell-0.11.1.tar.gz 40.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ask-shell 0.11.1
File Interpreter ABI Platform
ask_shell-0.11.1-py3-none-any.whl Python 3 none any Details

Total release size: 86.8 kB

Release files / ask_shell-0.11.1.tar.gz

Download URL ask_shell-0.11.1.tar.gz
Size 40.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3e7b284794d6f0142409951cadd7f008cd2d5fd3e7db4908d4cac401b51e4107
BLAKE2b-256 checksum
How to use checksums
0b70811b44504f596533fb6baec5a9be228475b9d39bf0b93ded01cbf29eff71
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 5, 2026.

Transparency log

Release files / ask_shell-0.11.1-py3-none-any.whl

Download URL ask_shell-0.11.1-py3-none-any.whl
Size 46.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a9c31788f0e16b5e19f1fedc4e9dca643e1fcc2aafdb50ec1ca57f918c513ad
BLAKE2b-256 checksum
How to use checksums
1e5ef4081ee64fbfd9d96a583ef1f6d9a9ad70e86dd48e702eff2b1a88e49876
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 5, 2026.

Transparency log

Release history Release notifications | RSS feed

0.11.5

2 release files

0.11.4

2 release files

0.11.3

2 release files

This release

0.11.1 This release

2 release files

0.10.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

1 release file

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