[Python-ideas] Add an UML class diagram to the collections.abc module documentation

Steve Barnes gadgetsteve at live.co.uk
Wed Jan 3 02:40:45 EST 2018

You can embed plantuml directives in rst, and possibly the code, and use 
sphinxcontrib-plantuml which at least keeps the diagrams for 
documentation close to the code.

pyplantuml claims to be able to extract the infromation directly from 
the code, (https://github.com/cb109/pyplantuml), but having tried it it 
seems a little flaky (and over specific in its dependencies).

pyreverse by default produces a .dot file but takes some time to come up 
with the correct flags.

https://github.com/rtfd/readthedocs.org/issues/407 makes interesting 
reading as well and is also relevant to this thread.

On 02/01/2018 21:29, Barry wrote:
> After reading this thread I went off and read up about plantuml.
> According to its docs it produces dot files that it reandes with graphviz.
> So if graphviz will produce svg that part is solved.
> Can you creat the plantuml file automatically from the python code?
> Barry
> On 2 Jan 2018, at 15:26, Yahya Abou 'Imran via Python-ideas <python-ideas at python.org> wrote:
>>> Can I suggest that rather than manually producing or tweaking, and later
>>> updating, the diagrams it might be better to spend a little time
>>> annotating the source code [...]
>>> While the diagrams produced might lack the elegance of manually produced
>>> ones they would be much more useful as they would always be up to date
>>> due to being produced, and updated, automatically.
>> I think it would be a lot of changes in the source code...
>> I would like to precise, so everybody can know it, the syntax of a .puml is realy simple. For example:
>> test.puml:
>> @startuml
>> hide members
>> show methods
>> abstract class Iterable {
>>   {abstract} __iter__()
>> }
>> abstract class Iterator {
>>    {abstract} __next__()
>>    ..
>>    __iter__()
>> }
>> Iterable <|-- Iterator
>> @enduml
>> Then:
>> $ plantuml test.puml
>> And you have test.png I joined.
>>> [...]
>>> I am attaching the diagram produced for the full inheritance of
>>> collections.abc as produced by doxygen/graphviz but I am sure that there
>>> are some options that could make this more readable/useful.
>>> Steve
>> It's a blank file that I have...
>> I've been struggling with those kind of tools these days, and realised that it's a lot more work (and pain) than a plain text file.
>> <test.png>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Fpython-ideas&data=02%7C01%7C%7C6d32c06f38af4d40145708d55227e234%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636505253601685827&sdata=DyrMOxl32rsEHK%2ByWUW9QlvzP%2Fn%2FqHXsKlSNuT%2B0loU%3D&reserved=0
>> Code of Conduct: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpython.org%2Fpsf%2Fcodeofconduct%2F&data=02%7C01%7C%7C6d32c06f38af4d40145708d55227e234%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636505253601685827&sdata=PQTKP%2FYAkdZscYpy815VbJXBeE89K1aslWibFgGf1Ww%3D&reserved=0

Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect 
those of my employer.

More information about the Python-ideas mailing list