Currently you have to add something like this to the end of your file just to mess around with fire:
if __name__ == '__main__':
fire.Fire()
and then run with
But it'd be neat if instead you could just do
and that does equivalent of exec appending the ifmain statement to the end.
Not sure how to do it - I know kernprof does some magic to inject into builtins before exec'ing code. (or maybe you get a code object back from exit) - but this would make fire even better as a debugging tool as well.
Currently you have to add something like this to the end of your file just to mess around with fire:
and then run with
But it'd be neat if instead you could just do
and that does equivalent of
execappending the ifmain statement to the end.Not sure how to do it - I know kernprof does some magic to inject into builtins before exec'ing code. (or maybe you get a code object back from exit) - but this would make fire even better as a debugging tool as well.