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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ask_shell-0.10.2.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ask_shell-0.10.2-py3-none-any.whl (40.9 kB view details)

Uploaded Python 3

File details

Details for the file ask_shell-0.10.2.tar.gz.

File metadata

  • Download URL: ask_shell-0.10.2.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ask_shell-0.10.2.tar.gz
Algorithm Hash digest
SHA256 5f33c515643296de391a2af85bde49bcceb1c2a9393ffc8f787d876d2292cbc9
MD5 ac5fa01e888a9f3b95c2059400d4f7da
BLAKE2b-256 43aea35c3b51423e3685f72631fdb6585dd6aca8e4bc7b99a0ea885964b8d8c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ask_shell-0.10.2.tar.gz:

Publisher: release.yaml on EspenAlbert/ask-shell

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ask_shell-0.10.2-py3-none-any.whl.

File metadata

  • Download URL: ask_shell-0.10.2-py3-none-any.whl
  • Upload date:
  • Size: 40.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ask_shell-0.10.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b57d7e67710005c39cbcacb003f825f336ef15916f3c43d4e550b385bc882b03
MD5 32634a4fe547112c092d87c04777621a
BLAKE2b-256 f35702c60d96a93dbc1f9aa7e44257e7b4e1b98615ed2c8a796a290b3e407d8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ask_shell-0.10.2-py3-none-any.whl:

Publisher: release.yaml on EspenAlbert/ask-shell

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.10.2 This release

2 files

0.10.1

2 files

0.10.0

2 files

0.9.1

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page