google / python-fire

Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.
Other
26.86k stars 1.44k forks source link

Argument String becomes Integer because of numeric data #452

Closed YigitBurdurlu closed 1 year ago

YigitBurdurlu commented 1 year ago

A simple argument is automatically converted to integer because the input only has numeric data in a string. I wondered if it is a wanted feature. Thank you

Python3 version = Pyton3.8.10 Fire version = 0.5

file sample.py

import fire                                                                                                                                                                                                     
from fire import Fire                                                                                                                                                                                           

print(fire.__version__)                                                                                                                                                                                         

def sample(sequence:str):                                                                                                                                                                                       
    print(sequence, type(sequence))                                                                                                                                                                             

Fire(sample)   
$ python3 ./sample.py "00"                                                                                                                                                                                      
0.5.0                                                                                                                                                                                                           
0 <class 'int'>

Expected behavior: "00" string type