6

I have a Python program and I would like to generate an UML diagram from from. Which programs can do that?

edit: I would like to have an option of editing the generated diagram

redman
  • 2,115
  • 5
  • 32
  • 59
  • 1
    Have a look at the discussion here: [link](http://stackoverflow.com/questions/260165/whats-the-best-way-to-generate-a-uml-diagram-from-python-source-code) – Will Sewell Apr 13 '12 at 17:44
  • 3
    The trouble with these 'marked as duplicate' topics is the refer to questions that were answered 7 years ago and are mighty stale – slashdottir Sep 01 '16 at 20:59

4 Answers4

1

And there's Stani's Python Editor (SPE) which draws simple UML diagrams on-the-fly.

gruentee
  • 323
  • 2
  • 12
  • I don't get it either. I was not commenting on this post when I wrote that. How did it end up here? Interesting... – S. Albano Sep 16 '12 at 15:01
1

My tool Pynsource will reverse engineer Python 3 / Python 2 source code into UML class diagrams. You can drag to re-arrange the classes on the screen or let the auto-layout do it.

You can edit/add/delete classes and associations - yellow comment notes are supported. It can even generate ASCII UML to paste into your code.

There's an open source community edition, as well as a pro version if you want zoom functionality.

abulka
  • 1,316
  • 13
  • 18
  • Will this program handle large projects well (something as large as, say, matplotlib)? – Rickkwa Feb 01 '14 at 06:08
  • Well, large projects are best broken up into sub diagrams, otherwise the number of classes becomes overwhelming and spaghetti like. Each diagram should tell a story that communicates something. My open source UML tool Pynsource http://pynsource.com referred to above has undergone many version changes since it was mentioned. It now parses Python 3, has zoom, layout, ASCII UML and PlantUML rendering support. It, as far as I know, the only UML tool that recognises Python instance attributes not just class attributes. Ready to run binaries are available for Mac, Windows, Ubuntu 18 and 16. – abulka Mar 15 '19 at 10:22
1

I'm not sure what kind of quality you want your diagrams to be, but there is a tool called PyNSource that is still maintained (last update August) and does what you are after. You can find it here. I should clarify that this program is for Windows.

  • Above link is old, Pynsource is now at http://pynsource.com. No longer Windows only - it is now fully cross platform. Ready to run binaries are available for Mac, Windows, Ubuntu 18 and Ubuntu 16. – abulka Mar 15 '19 at 22:44
1

Here you can find a list of UML-Python tools. If you need to edit the diagram, then probably you should start by taking a look at PyUML

Jordi Cabot
  • 8,058
  • 2
  • 33
  • 39