- 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.
- With pip:
pip install argparse2typer
- 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!