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 intotyper
CLI with as little changes as possible.
Installation
- With pip:
pip install argparse2typer
Usage
- Locate the line
args = parser.parse_args()
in the original script - Import the function
from argparse2typer import argparse2typer
- Run the function before
parse_args
:
argparse2typer(parser=parser, output_path=Path(<path>)) # <- new line
args = parser.parse_args()
- New file @ will be created with the typer CLI format!
Project details
Release history Release notifications | RSS feed
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)
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42b25ee2b833037b4ce549cff48491f24f5e92eb04af00aef3505b790b8db6d1 |
|
MD5 | f685cc99f77baea59ce61175113b7989 |
|
BLAKE2b-256 | 84e6e5859cb5d8a422191161c3650f6877be58909f0eb33b2568d24b604d3c46 |
File details
Details for the file argparse2typer-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: argparse2typer-0.0.2-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee1d760ef3979560109347f43e81e3c15cb592f36c3c0446a329a846e36f58bb |
|
MD5 | 405ae42044e222e3aa06b012ea260e52 |
|
BLAKE2b-256 | dbb6e7e7844884c0d4b0952fc6f9d32ea68337f7b6d92dab1668611ec10260d1 |