How to explore a python file from commandline

Viewed 41

I have a python file with no argparse implementation in its __main__, yet, I'm interested in having a look at the functions and modules implemented in it from the commandline. I'm tempted to write a function to perform such exploration but I wanted to find out first whether this is already available.

EDIT 1: to make it more concrete, I'm interested in names of functions and classes + their docs.

1 Answers

You may be looking for a tool like python-fire.

From the repository:

Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object. [...] Python Fire helps with exploring existing code or turning other people's code into a CLI.

It is available as a package on pip.

Related