You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You already mentioned to plan to add a strict mode to python-fire in #221 and #222. I would highly appreciate this, so I am opening a new issue for this.
The problem with CLI facing function is that MyPy cannot help here. The type of the input arguments depends on how python-fire (or other CLI parsers) parse the arguments. Thus type hinting cannot spot errors. I for myself had strings were I expected a number (e.g. by passing in "02" instead of "2") or lists where I expected strings (erroneous trailing comma "foobar,"). There is no way to catch this except for explicitly checking for it.
I am currently experimenting with [[https://pypi.org/project/dpcontracts/|dpcontracts]] and https://github.com/RussBaz/enforce to prevent CLI induced errors. However, strict mode would make things much easier here.
One requirement for me would be that I can enable strict mode from within the script. Having to pass `--strict`` all the time would not prevent errors due to wrong usage.
I would be very glad to see this comming.
The text was updated successfully, but these errors were encountered:
This feature would be nice, but if you're trying to call a function from command line using Fire, you can always validate the inputs of the function by putting a decorator called @beartype on it.
You already mentioned to plan to add a strict mode to python-fire in #221 and #222. I would highly appreciate this, so I am opening a new issue for this.
The problem with CLI facing function is that MyPy cannot help here. The type of the input arguments depends on how python-fire (or other CLI parsers) parse the arguments. Thus type hinting cannot spot errors. I for myself had strings were I expected a number (e.g. by passing in "02" instead of "2") or lists where I expected strings (erroneous trailing comma "foobar,"). There is no way to catch this except for explicitly checking for it.
I am currently experimenting with [[https://pypi.org/project/dpcontracts/|dpcontracts]] and https://github.com/RussBaz/enforce to prevent CLI induced errors. However, strict mode would make things much easier here.
One requirement for me would be that I can enable strict mode from within the script. Having to pass `--strict`` all the time would not prevent errors due to wrong usage.
I would be very glad to see this comming.
The text was updated successfully, but these errors were encountered: