Skip to main content

TUI wrapper for CLI arguments

Project description

1. One line description

A library to present all the arguments your script accepts in a TUI (terminal user interface, using ncurses, that can be navigated with the arrow keys), so that users can easily figure out what all of them are and do.

2. Information for users

2.1. Installation

You don't want to use this repository directly. Instead you should "install" the latest released version by running this command:

$ python -m pip install tuiargs

2.2. User guide

Check this file for the full guide.

You can also access this same information from python itself:

import tuiargs

help(tuiargs)

All public classes and functions are fully documented:

import tuiargs

help(tuiargs.Build)
...

3. Information for developers

3.1. Development environment

Make sure you have all python modules listed in "dependencies" section found inside the pyproject.toml file already installed, if not, use your distro package manager to install them:

$ cat pyproject.toml | awk '/dependencies/,/]/' 
$ pacman -S ...

NOTE: This (installing dependencies through the global package manager) is
preferred to creating a virtual environment and using "python -m pip
install" inside of it because it makes it simpler to run the examples.
If you insist on using a virtual environment, this is what you need to do:

    $ python -m venv .venv
    $ source .venv/bin/activate
    $ python -m pip install -r <(cat pyproject.toml | awk '/dependencies/,/]/' | grep -oP '(?<=")[^"]*(?=")')

Next, update the value of PYTHONPATH to make sure it searches for "tuiargs" in the current folder (where the source code is) instead of in system paths (in case you had already "pip install"ed it in the past):

$ export PYTHONPATH=`pwd`:$PYTHONPATH

You can now run the different demos like this:

$ python examples/hello_world.py
$ python examples/git_wrapper.py

3.2. Running built-in tests

You can run a full suite of pre-built test cases:

$ ./tests/run.py

Note you must make sure this command returns "OK" after making any change to the source code!

If one test fail you can obtain a detailed log of what is going on by re-running it in isolation like this:

$ ./tests/run.py --test=7  # (or 4, or 3, ... depending on the test number)

3.3. Running the code linter

Before merging new changes you must also check that the following command returns an empty list of warnings:

$ ruff check .

NOTE: You might need to install "ruff" first. If so, use your distro's package manager.

3.4. Distribution

The source code in this repository is meant to be distributed as a python package that can be "pip install"ed.

Once you are ready to make a release:

  1. Increase the "version" number in file "pyproject.toml"

  2. Run the next command:

    $ python -m pip install --upgrade build $ python -m build

  3. Publish the contents of the "dist" folder to a remote package repository such as PyPi (see here)

  4. Tell your users that a new version is available and that they can install it by running this command:

    $ python -m pip install tuiargs

NOTE: If "python -m build" returns an error, you probably have to install the "python-build" package first, either using your package manager (preferred) or inside a virtual environment. If you choose the latter, make sure you use the "--copies" flag when creating the virtual environment or else you will later get errors about symbolic links when creating the package:

$ python -m venv --copies .my_venv 

Project details


Download files

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

Source Distribution

tuiargs-0.0.1.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

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

tuiargs-0.0.1-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file tuiargs-0.0.1.tar.gz.

File metadata

  • Download URL: tuiargs-0.0.1.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for tuiargs-0.0.1.tar.gz
Algorithm Hash digest
SHA256 00383e666109c944b2288046e0007bdbd9e39c436fde60b5fe88ee2c5ae54408
MD5 0c7ad3117a0b500cb7189bc7b906ccfc
BLAKE2b-256 86d3998349ae9bd225a018efaf94aca44b89493817e01f8b8a0ff1b02767da39

See more details on using hashes here.

File details

Details for the file tuiargs-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tuiargs-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 23.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for tuiargs-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 744cc06d43c597eeb442ed88801edd9a81008ac3ade4257ddab70d07652273bb
MD5 ca3c20adb117685749be886c691744d4
BLAKE2b-256 427100f03064bc7847f3ed88fb80a73e19839cc5447280efbff1c6edd765f131

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