Skip to content

Use fire without editing code directly #29

@jtratner

Description

@jtratner

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

python path/to/code.py

But it'd be neat if instead you could just do

fire path/to/code.py

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions