Tools for turning Python code into XMI?

S

Stefan Schwarzer

Hello,

I'm looking for a tool which can read Python files and write
a corresponding XMI file for import into UML tools.

Ideally, the conversion tool should:

- be open source or freeware

- be available for Linux

- be a command line tool

- allow to specify exactly the Python files that should to
be taken into account

- include operations, together with their parameters

- include attributes (in the UML sense) if possible (I know
this isn't reliable)

Here are some programs I found via PyPI or search engine and
tried so far. All of them miss something I'd really like to
have.

- pyreverse (now included with Pylint):
http://www.logilab.org/857

I think this has the most potential. You can specify the
files to import on the command line. There are many output
formats for the information from the Python code, but XMI
doesn't seem to be included. There are a few formats that
could be parsed and turned into XMI (plain, plain-ext).
Unfortunately, pyreverse doesn't include the parameters of
operations.

- Umbrello:
http://uml.sourceforge.net/

Umbrello is a graphical KDE tool. You can specify either
single files or whole directories including
subdirectories. In my case, one of the subdirectories is
for unit tests, which clutters the UML model. Attributes
(again, in the UML sense) are seemingly not considered but
operations. The parameters and return values of the latter,
however, are all output as of type "string".

- Gaphor:
http://gaphor.sourceforge.net/

Gaphor is a GUI tool allowing to specify the files one by
one which might be ok for a few files but surely
becomes tedious if there are some more. The generated
diagram, which can be exported to XMI, lacks the
parameters of the operations.

Do you have any other suggestions for programs I should have
a look at? Does someone even has written such a tool and has
not published it yet? :)

Stefan
 
L

Lawrence D'Oliveiro

I'm looking for a tool which can read Python files and write
a corresponding XMI file for import into UML tools.

UML ... isn’t that something more in vogue among the Java/DotNet corporate-
code-cutter-drone crowd?

Specifically, you’re asking for something that can parse a dynamic language
and generate a static structural description of that code. I don’t think
it’s possible, in general.
 
S

Stefan Schwarzer

Hi Lawrence,

I missed your answer because I didn't expect someone to
respond after all this time. :)

UML ... isn’t that something more in vogue among the
Java/DotNet corporate-code-cutter-drone crowd?

I don't know, that may well be. I still find it useful from
time to time. I don't mind using tools I find useful,
regardless who else uses them. :)
Specifically, you’re asking for something that can parse a
dynamic language and generate a static structural
description of that code. I don’t think it’s possible, in
general.

The tools I described in my previous post go a great length
towards extracting the necessary information. But of course
it's not reliably possible to extract all information, for
example dynamically generated methods. But few Python
programs use this extensively, and a good tool will extract
most of the information interesting for me. I'm always
surprised about what Pylint finds out about my source code. :)

Given the existing open source tools, the problem rather
seems to be the effort of implementing XMI generation than
to get the information out of the Python code in the first
place.

Stefan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top