pyfactor icon indicating copy to clipboard operation
pyfactor copied to clipboard

Functionality to specify parsing root

Open ngraymon opened this issue 4 years ago • 3 comments

I found this worked nicely when the target file was a collection of functions. When running pyfactor on a file which contains a class object I was hoping to see a graph of relations between the members and variables of the class but it seems this is not possible? Instead it just lists the class itself and relation to imported libraries or variables defined globally.

ngraymon avatar Jan 26 '21 23:01 ngraymon

Thanks! This would be a good addition especially in combination with #5, giving a lot of flexibility to the analysis. Functions could also be the root node. I wonder if we could get away with just moving the class definition to the root, I'll have to test it. Anyways, this also calls for a change in the CLI. Having something like pyfactor file.py:Class would be in line with other tools that dive into source, but currently that means "output file named Class". Maybe some other delimiter?

felix-hilden avatar Jan 27 '21 08:01 felix-hilden

It might make sense to support any multi-file advanced functionality by using a formatted text file. That way you can maintain a simple clean command line usuage by calling pyfactor configfile instead of some long complicated line. Maybe a JSON file? Have a dictionary like this: `{"files":[file.py, secondfile.py, ...], "root":"file.py/example_class", "exclude":"secondfile.py/function"}'?

ngraymon avatar Jan 27 '21 16:01 ngraymon

That could be the way to go, although ideally the functionality would be available in clean cli options. JSON is a bit cumbersome to write but perhaps some other format!

felix-hilden avatar Jan 28 '21 07:01 felix-hilden