Python Analyzer#

The Python Analyzer is a Perl script provided with the Lattix installation that allows you to import Python 2 source code into Lattix. The Python Analyzer’s input is the output of snakefood. Snakefood is an open-source dependency parser. You will first analyze your Python 2 source code with snakewood. Then you will take the snakewood output and input that into the Lattix Python Analyzer which will generate a LDI file that can be imported into Lattix using the Python module. Follow these steps to generate LDI:

Generate snakefood output file#

Use snakefood to generate a file that contains the dependency information between Python files. Typically, snakefood output files are of the form:

(('/myproject', 'pack2/department.py'), ('/myproject', 'pack1/person.py'))
(('/myproject', 'pack1/person.py'), ('/myproject', 'pack1/employee.py'))
(('source_package_root', 'source_file.py'), ('None', 'None'))

Generate LDI file#

Run the perl script sf2ldi.pl to generate the LDI file. The perl script is located in the tools/scripts/python-snakefood directory. Note that you must have perl installed in order to run the script.

perl sf2ldi.pl snakefood-output-file > output.ldi.xml

The generated ldi file can then be loaded into Lattix.