Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple string argument is Converted to integer because input only contains numeric data #453

Open
kanaryayi opened this issue May 6, 2023 · 2 comments

Comments

@kanaryayi
Copy link

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

@dbieber
Copy link
Member

dbieber commented Dec 12, 2023

Yes, Fire does not take into account type annotations at this time. While this could be a big improvement for Fire, it is not planned at this time.

@Se-Hun
Copy link

Se-Hun commented Apr 30, 2024

Is it clear?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants