Skip to main content

sprezzature-cli-gui

License Python

logo

Turn any Python command-line tool into a clickable form, automatically. A command-line tool takes typed text ("do this, with these options") instead of buttons and fields; this package reads the tool's own definition of its commands and options and builds a web page with a button and a field for each one, so a person who has never opened a terminal can still use it.

Point this tool at a parser: the object inside a Python CLI that reads and validates the typed command. argparse (in Python's standard library), Click, and Typer are the three common ways to build one; all three are supported. Given that parser, this package emits a single self-contained page written in plain JavaScript and styled with Tailwind (a CSS framework, meaning it ships pre-made style classes instead of hand- written CSS). Every sub-command becomes a section, every flag a field. The page never runs the command itself: it assembles the exact command line as text, in the visitor's own browser, ready to copy and paste, to hand to a desktop app through a Tauri invoke call (Tauri wraps a web page as a native desktop app; invoke is how that wrapper lets the page call back into it), or to send to a FastAPI endpoint (a small Python web server) that runs it for real.

For example: a CLI with a --verbose flag and a convert INPUT OUTPUT sub-command becomes a page with a checkbox for --verbose and two text fields for INPUT and OUTPUT; filling them in and pressing "Build command" prints the exact line mytool convert in.csv out.json --verbose for the visitor to copy.

No framework, no build step: the emitted page is one static HTML file. It does load Tailwind's "Play" build from a CDN (cdn.tailwindcss.com) to turn the utility classes into real CSS in the visitor's browser, so opening the file needs an internet connection the first time; the form fields themselves still work, unstyled, without one.

Install

pip install sprezzature-cli-gui           # core (argparse)
pip install "sprezzature-cli-gui[click]"  # add Click support
pip install "sprezzature-cli-gui[typer]"  # add Typer support

Use

# From a parser factory in an importable module
sprezzature-cli-gui my_pkg.my_cli:build_parser > gui.html

# From a script path
sprezzature-cli-gui ./my_cli.py:make_parser > gui.html

When the parser cannot be imported, the tool falls back to parsing the tool's --help output, so it works even against a CLI it cannot introspect directly, including one that is not written in Python at all.

How it works

cli_to_gui.py is a thin wrapper that re-exports the real implementation, which lives in the sprezzature_cli_gui package:

  • adapters/: read (introspect, meaning: examine the parser object's own fields directly, rather than guess from printed text) an argparse or Click parser; or, when no parser object is reachable, fall back to parsing the tool's --help text instead.
  • schema.py: the one normalized command/flag description every adapter produces, so the renderer never needs to know which of the three frameworks it came from.
  • renderer.py: turns that description into the self-contained HTML + Tailwind + plain-JavaScript page.
  • loader.py: resolves a module:factory or path.py:factory spec (a string naming where the parser-building function lives) down to the actual parser object.

License

BSD-3-Clause © Warith HARCHAOUI. Part of the sprezzature toolkit.

Metadata

Release files for sprezzature-cli-gui 1.1.0

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

Source distribution (sdist)

Source distribution for sprezzature-cli-gui 1.1.0
File Size Uploaded Provenance Actions
sprezzature_cli_gui-1.1.0.tar.gz 46.8 kB Without provenance Details for sprezzature_cli_gui-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sprezzature-cli-gui 1.1.0
File Interpreter ABI Platform Actions
sprezzature_cli_gui-1.1.0-py3-none-any.whl Python 3 none any Details for sprezzature_cli_gui-1.1.0-py3-none-any.whl

Total release size: 84.9 kB

Release files / sprezzature_cli_gui-1.1.0.tar.gz

Download URL sprezzature_cli_gui-1.1.0.tar.gz
Size 46.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0afbf0301797628302c84e10854b4a63edf3e4e6a48ac5e3d04dfd24211ba235
BLAKE2b-256 checksum
How to use checksums
f5aaabe66aaafafc547d0eee0d5c95e142873b4a2ca9887a11a6c5dd38adfa9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / sprezzature_cli_gui-1.1.0-py3-none-any.whl

Download URL sprezzature_cli_gui-1.1.0-py3-none-any.whl
Size 38.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bdb5144fd762af07e283f3163c9932c08c4575d0d09126a4f2ecb38c0e8d4542
BLAKE2b-256 checksum
How to use checksums
3f4230b05d84b5ba8bae6f5981c2a3d8de8304010be28c883313c08abddd1195
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Security for sprezzature-cli-gui 1.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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