A reverse engineering tool for Python source code

PyNSource is a python code scanner and UML modelling tool.

Reverse engineer python source code into UML - display UML as Ascii art or in a proper diagramming visual workspace.

You can also generate java and delphi skeleton code from the python, for the purpose of importing that skeleton code into other more sophisticated UML tools e.g. Enterprise Architect or ESS-Model (free).

Features

  • Resilient: doesn't import the python files, thus will never get "stuck" when syntax is wrong.
  • Fast
  • Free
  • Recognises inheritance and composition  relationships
  • Recognises ocurrences of self.somevar as UML fields (no other UML tool does this for python)
  • Detects the cardinality of associations e.g. one to one or 1..*  etc
  • Optionally treat modules as classes - creating a pseudo class for each module - module variables and functions are  treated as attributes and methods of a class
  • Has been developed using unit tests (supplied) so that you can trust it just that little bit more ;-)
  • Can generate UML Ascii-art :-)
  • Can generate Java and Delphi code skeletons (out of your python code) so that you can import those into a proper UML tool.

Future Directions & Help Needed

In priority order:

Need a smarter layout algorithm.

Marquee selection facility - be able to select multiple uml classes at the same time, and be able to drag them around to position them.

Make the code parser smarter and smarter - not easy to do with a dynamic language like python.

Zoom out functionality - can use the approach used by UML Pad (which is written in wxWindows, though I think in C) which scales all objects on the canvas.  Works remarkably well.  We could port the algorithm over to wxPython and integrate it into PyNSource.  Or maybe ditch wx and use Java/Jython based swing GUI  with zoom+ graph layout?

Persistence - save diagrams to disk and then as you re-import only changes are updated.  That way a nicely laid out diagram could always be kept up to date.  Could save in standard UML xml format, which could then be imported into other uml modellers which can read xml.

Add all the features of the command line parser to the GUI.  E.g. The java and delphi code generation, the Ascii UML generation.  Perhaps even have 'batch jobs' that could be run periodically to regenerate any java or delphi source code, which is then in turn imported by a third party UML modeller.

If you like PyNSource then have a go at one of the tasks above, and send me the patches & I will incorporate and re-release.

Acknowledgements

Thanks to Denis Dube for the recursive import algorithm and some misc GUI fixes, including the initial version of the  print preview support.
Thanks to Vern Muhr for fixing a small bug in Printing.
Thanks to Thomas Margraf for working out the tweak to make the GUI run under wxpython 2.5 (even on a Mac!).

Mailing List

Join the mailing list and be notified when there are new releases of PyNSource.

Subscribe email to pynsource-subscribe@yahoogroups.com or visit http://groups.yahoo.com/group/pynsource

Send all comments to Andy Bulka.

Comments:

Leave a Reply



(Your email will not be publicly displayed.)

Please type the letters and numbers shown in the image.Captcha Code