Skip to main content

Convert argparse.ArgumentParser to json compatible with JSON Form

Project description

argparse-to-json

Convert Python argparse parsers to json compatible with JSON Form.

Usage

import argparse

from argparse_to_json import convert_parser_to_json

parser = argparse.ArgumentParser()
parser.add_argument('input')
json_schema = convert_parser_to_json(parser)

See the example folder for a Flask app that renders forms for command line interfaces using JSON Form. You can run the example as follows:

pip install flask
FLASK_APP=app.py
flask run

Why?

Because maybe I wanted to have a simple way to create GUIs for my Python CLI's.

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

argparse-to-json-0.0.1.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distributions

argparse_to_json-0.0.1-py3.10.egg (4.8 kB view hashes)

Uploaded Source

argparse_to_json-0.0.1-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

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