Skip to main content

Optprompt

A prompting option parser

Example

import optprompt

parser = optprompt.OptionPrompter(config_files=['./example.toml'])
parser.add_argument('-n', '--name', prompt='What is your name')
parser.add_argument('-r', '--race', prompt='What is your race', default='elf')
parser.add_argument('-e', '--edition')
opts = parser.parse_args()
print(opts)

With the config file

[defaults]
edition = '3.5'

Will produce the following output

(venv) [dylan@voyager examples]$ PYTHONPATH=$(pwd)/.. python example.py
What is your name : Bob
What is your race [elf]:
Namespace(edition='3.5', name='Bob', race='elf')

Release files for optprompt 0.5.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 optprompt 0.5.0
File Size Uploaded
optprompt-0.5.0.tar.gz 15.2 kB Details

Built distribution (wheel)

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

Total release size: 29.6 kB

Release files / optprompt-0.5.0.tar.gz

Download URL optprompt-0.5.0.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7430c7f59e34a1e6f8bec947c8e48fa0249fe2a0444e90cf7a20e67e11489057
BLAKE2b-256 checksum
How to use checksums
4e5fce7382fc335081a23dff308e05f4be8f559f006cfa85906f718698341785
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.6

Release files / optprompt-0.5.0-py3-none-any.whl

Download URL optprompt-0.5.0-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fad114a28b254039efa7214bee47457ba8c91cf1a35a23dc78b1f65aee6d4135
BLAKE2b-256 checksum
How to use checksums
470c59cd4414b4f72b4e28cff53bc62b983f7ab290fd62a50a0a71a528d18af3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

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