Skip to main content

Convert Python's default argparse into typer CLI

Project description

argparse2typer

Use case

  • Do you ever need to work on an open source project and find that they use argparse? Nothing's wrong with argparse but you have already been falling in love with typer CLI (you all will someday)?
  • Fear no more, just use argparse2typer and all the argparse code would be parsed into typer CLI with as little changes as possible.

Installation

  • With pip:
pip install argparse2typer

Usage

  1. Locate the line args = parser.parse_args() in the original script
  2. Import the function from argparse2typer import argparse2typer
  3. Run the function before parse_args:
argparse2typer(parser=parser, output_path=Path(<path>)) # <- new line
args = parser.parse_args()
  1. New file @ will be created with the typer CLI format!

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

argparse2typer-0.0.2.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

argparse2typer-0.0.2-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file argparse2typer-0.0.2.tar.gz.

File metadata

  • Download URL: argparse2typer-0.0.2.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for argparse2typer-0.0.2.tar.gz
Algorithm Hash digest
SHA256 42b25ee2b833037b4ce549cff48491f24f5e92eb04af00aef3505b790b8db6d1
MD5 f685cc99f77baea59ce61175113b7989
BLAKE2b-256 84e6e5859cb5d8a422191161c3650f6877be58909f0eb33b2568d24b604d3c46

See more details on using hashes here.

File details

Details for the file argparse2typer-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for argparse2typer-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ee1d760ef3979560109347f43e81e3c15cb592f36c3c0446a329a846e36f58bb
MD5 405ae42044e222e3aa06b012ea260e52
BLAKE2b-256 dbb6e7e7844884c0d4b0952fc6f9d32ea68337f7b6d92dab1668611ec10260d1

See more details on using hashes here.

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