Skip to main content

puissant

validated user input over command line the easy way

puissant is a collection of Python functions to implement validated user input from command line

Dependencies

  • Python version required: 3.7+

  • If documentation is to be generated sphinx and sphinx_rtd_theme packages are required:

pip install sphinx sphinx_rtd_theme

Installation

Simply type

pip install puissant

Documentation

Documentation can be found @ readthedocs

Examples

  • yes/no question

>>> from  puissant import *
>>> yes_no(prompt = "Are you happy")
Are you happy [y/n]?maybe
 input must be one of y, n, yes, no.
Are you happy [y/n]?yes
True
  • yes/no question with default value

>>> yes_no(prompt = "Are you happy", default = 'y')
Are you happy [y/n]?(default:y) True
  • Single option menu:

>>> menu(prompt = 'what next?', options = ['restart', 'continue', 'quit'])
what next?
 1 - restart
 2 - continue
 3 - quit
select an item [range: 1..3]: 4
input must be in range 1..3.
select an item [range: 1..3]: quit
input must be of type int.
select an item [range: 1..3]: 1
'restart'
  • Tickbox (multiple selection) menu:

>>> tickbox_menu('add extras', ['mayo', 'ketchup', 'garlic', 'tabasco'])
add extras
1  [ ] - mayo
2  [ ] - ketchup
3  [ ] - garlic
4  [ ] - tabasco

- type a number to tick the option.
- "a" selects all.
- "n" de-selects all.
- "d" selection done.

Option? : 1
add extras
1  [x] - mayo
2  [ ] - ketchup
3  [ ] - garlic
4  [ ] - tabasco

- type a number to tick the option.
- "a" selects all.
- "n" de-selects all.
- "d" selection done.

Option? : 3
add extras
1  [x] - mayo
2  [ ] - ketchup
3  [x] - garlic
4  [ ] - tabasco

- type a number to tick the option.
- "a" selects all.
- "n" de-selects all.
- "d" selection done.

Option? : d
[(0, 'mayo'), (2, 'garlic')]

Metadata

Release files for puissant 0.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 puissant 0.1.0
File Size Uploaded Provenance Actions
puissant-0.1.0.tar.gz 7.6 kB Without provenance Details for puissant-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for puissant 0.1.0
File Interpreter ABI Platform Actions
puissant-0.1.0-py3-none-any.whl Python 3 none any Details for puissant-0.1.0-py3-none-any.whl

Total release size: 14.6 kB

Release files / puissant-0.1.0.tar.gz

Download URL puissant-0.1.0.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
57651666866167e84bfc150a65a5b14d0b884ba7cb0424c4d0796296a2abdd77
BLAKE2b-256 checksum
How to use checksums
0b3426efb8b035dee5d008a48baa96e7f181f1f0004092ecc823557686de0a35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / puissant-0.1.0-py3-none-any.whl

Download URL puissant-0.1.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e48007cb81464771f08d84053753cb53d6c67f06b6bfb48e00ce243a23ab4fc6
BLAKE2b-256 checksum
How to use checksums
0b82368d8052086dd0b774a86fba5dd451b9882a546a7007c01430546843e919
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Security for puissant 0.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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