Skip to main content

Effortlessly turn any ArgumentParser script into an interactive prompt.

Project description

InteractiveArgparse

Coverage Build Status PyPI version

Table of Contents

Installation

To install, run

pip install InteractiveArgparse

Getting Started

You can wrap your existing ArgumentParser with an InteractiveArgumentParser like so:

import argparse
from interactive_argparse import InteractiveArgumentParser

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--name", help="The user's name.")
    parser.add_argument("--should_greet", help="Whether or not I should greet the user", action="store_true")

    iparser = InteractiveArgumentParser(parser)
    args = iparser.parse_args()
    print(args)


if __name__ == "__main__":
    main()

Running this script without arguments results in interactive prompts like so:

Example 1 output

Prompters

Terminal prompts are just the default — InteractiveArgumentParser can be pointed at a completely different interactive flow via its prompter argument, including an auto-generated web form (WebPrompter) or your own custom Prompter subclass.

See docs/prompters.md for how to use the built-in web prompter and how to write your own.

Development

Running tests

To run all tests:

python -m pytest

Contributing

We welcome early adopters and contributors to this project! See the Contributing section for details.

License

This project is open-sourced under the MIT license. See LICENSE for details.

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

interactiveargparse-0.1.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

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

interactiveargparse-0.1.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file interactiveargparse-0.1.0.tar.gz.

File metadata

  • Download URL: interactiveargparse-0.1.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for interactiveargparse-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c3cb417a483efb344505c71da938ad418425dd5828f8e2efe9ed79a5a97a87c6
MD5 fde255750bad763d6088e162a1189ba4
BLAKE2b-256 dd242c5348f6db66aa0a057ad93baae294c20ccfa2be5f50dc39782f995448bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for interactiveargparse-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cdc9228594a79b4ada91f8853ddb3e85e292e903529830ecc4de93261c1c598b
MD5 9c76cb57066d633d4f5a537e6ec42156
BLAKE2b-256 0df27d45468132ceef54220b88fe763edb79786cd37a65a78d46cf7ddf752c82

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