0

I am using decorators on classes in my python code. I need to generate some xml which contains which classes have which decorators, which module they are in, and what are the globals in those modules. I have tried all major documentation generators, but could not figure out even which is capable to do this.

  • Doxygen (1.8.13-10): the generated documentation have no reference to any decorators
  • Sphinx: I could not even get sphinx to generate any documentation on my modules. I have tried a couple of howtos, but automodule just does not seem to work.
  • pydoctor: I was using this in python2 projects with a custom generator class, but does not work with python3
  • pdoc works, but no decorators, and I do not see any way to generate xml
  • pydoc3 just says there is no documentation found (as there are no comments, it is clean code)

A minimal example would contain the following tree:

src/categorizerai
src/categorizerai/__init__.py
src/categorizerai/ExampleService.py

Where __init__.py is empty, and ExampleService.py have the following code:

from winterboot.Autowired import Autowired

underlyingService = Autowired('underlyingService')

@Service
ExampleService(object):
    def serviceCall(foo: int = 0) -> int:
        return foo+1;

At the end I would create an xml like this (anything containing the necessary information is okay, I can xslt):

<project>
  <package name="categorizerai">
    <class type="Service" name="ExampleService"><!-- the type comes from the decorator -->
      <dependency name="underlyingService"/><!-- name of the global in the same module-->
    <method name="serviceCall" returns="int">
     <parameter name="foo" type="int" default="0"/>
    </method>
    </class>
  </package>
</project>
Árpád Magosányi
  • 1,394
  • 2
  • 19
  • 35
  • Regarding doxygen: which version of doxygen did you use? can you give a small example of the python code so we can try it. – albert Jul 22 '19 at 17:00
  • I have updated the question with answers: 1.8.13-10 and https://github.com/kode-konveyor/CategorizerAI – Árpád Magosányi Jul 22 '19 at 17:21
  • Maybe you should try doxygen 1.8.15 (I don't know by head if there are changes regarding decorators).I was hinting to include a small piece of code in the question and not a complete repository that also changes in time. – albert Jul 22 '19 at 17:31
  • What are the best practices to include example code when by the nature of the problem it will consists of multiple files, sometimes in multiple directories? – Árpád Magosányi Jul 22 '19 at 17:47
  • Well I think a basic example should be small and it should be possible to show a decorator problem with 1 or 2 small code snippets / files. – albert Jul 22 '19 at 17:49
  • I have given a minimal example. – Árpád Magosányi Jul 22 '19 at 18:00

0 Answers0