Skip to main content

An automatic, terminal based interactive interface for any Python 3 `argparse` command line with keyboard and mouse support.

Project description

ArgUI

ArgUI's Logo

An automatic, terminal based interactive interface for any Python 3 argparse command line with keyboard and mouse support.


See It in Action

Demo of the features in ArgUI

Get a feel for the features of ArgUI using the Demo.py code included in this project.

Usage

Install as a Dependency

  1. Clone this repo to the desired location.
  2. Access this directory with your desired environment.
  3. Install this repo as a package: pip install -e .

A PyPi release may come in the future.

Setup Your Argparse

ArgUI supports wrapping any implementation of the Python 3 argparse native library. This will all you to use both standard terminal and interface modes to interact with your program.

# Import
import argparse
import argui

# Setup your ArgumentParser normally
parser = argparse.ArgumentParser(prog="Demo")

# `add_argument`, `add_argument_group`, etc...

# Wrap your parser
interface = argui.Wrapper(parser)

# Get arguments
args: argparse.Namespace = interface.parseArgs()

# `args` is the same as if you had called `parser.parse_args()`

See Demo.py for more information.

Run Your Program

Your program can now be run in both CLI and GUI modes.

To run in CLI mode, simply use your script as normal like python foo.py -h.

To run in GUI mode, provide only the --gui (by default) argument like python foo.py --gui.

Navigation

Mouse navigation of the GUI is possible in most terminals.

There are known issues with the VSCode terminal on Windows 10 and some others. However, Mouse navigation does work in Powershell when opened on its own.

Keyboard navigation is always available using Tab, Arrow Keys, and Enter. But make note that if you are using a terminal within another program (like VSCode), that some more advanced keyboard commands (like CTRL+S) may be captured by the container program and not sent to the GUI.

Development Setup

  1. Clone this repo and enter the directory with a terminal.
  2. Setup a Python Env: python -m venv .venv --prompt "argUI"
  3. Enter the Python Env.
  4. Install requirements: pip install -r requirements.txt

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

Argparse_Interface-0.1.0-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file Argparse_Interface-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for Argparse_Interface-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 440439b3d273e0b83fd41029e444e12976ba8e6c4484267386276614dc2ddd48
MD5 b6f5d6c90f29e680760e760786e6dfa4
BLAKE2b-256 559ac1ce134b78c65d83a9178e485b5d356f6187daae8dd60f0a4b8210d49d4e

See more details on using hashes here.

Supported by

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