|
|
A UML reverse engineering tool for Python source codeA python code scanner and UML modelling tool that generates
Features
Java Code Generation from python code Join the mailing list and be notified when there are new releases of PyNSource.
GUI UsageRun pynsourceGui.py e.g. C:\Python24\Lib\site-packages\pynsource\pyNsourceGui.py
or simply run the standalone pynsourceGui.exe. Simply select from the menu "File Import..." and import the python modules you want to visualise. Additional modules can be added to the diagram at any time.
You can drag around the classes to make your diagram look nice. To get rid of the selection handles around a class, simply click on that class again with the mouse.
Command line Usagepynsource -v -m [-j | -d outdir] sourceDirOrListOfPythonFiles...
Examplese.g. \python22\python.exe
\Python22\Lib\site-packages\pynsource\pynsource.py
-d c:\delphiouputdir c:\pythoninputdir\*.pyThe above line (please type all three lines in on one single line) will scan all the files in c:\pythoninputdir and generate a bunch of delphi files in the folder c:\delphiouputdir BASIC ASCII UML OUTPUT from PYTHON - EXAMPLES GENERATE JAVA FILES from PYTHON - EXAMPLES GENERATE DELPHI FILES from PYTHON - EXAMPLE See batch file usage for another handy way to drive pynsource from the command line.
Future Directions & Help NeededIn priority order: Need a smarter layout algorithm. Please email me on suggestions on how to do this. The quickest way is to borrow the layout algorithm inside Boa, though it probably won't handle the UML style layout of parent classes above and composed classes to the right. Perhaps something good could be ported to python? Allow the deletion of classes from diagrams. This should be easy to do, and can relieve a lot of the clutter that can quickly build up in your diagrams. DONE - see release 1.4a. - right mouse click deletes classes. Print needs to be smarter and allocate more than one page over which to spread the diagram. Anyone who has used the wxPython printing component could help here. 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. AcknowledgementsThanks to Denis Dube for the
recursive import algorithm and some misc GUI fixes, including the initial
version of the print preview support. Send all comments to Andy Bulka. Join the mailing list and be notified when there are new releases of PyNSource.
|