Seite 1 von 1

API generator

Verfasst: Dienstag 16. Februar 2010, 12:28
von Defnull
Hi Leute

Ich suche nach einem brauchbaren API Dokumentations-Generator für Bottle. pydoc funktioniert zwar, produziert aber ziemlich hässliche HTML Dokumente mit viel Müll, den man für end-user API docs nicht braucht (__blablb__ Methoden von Urgroßvater-Klassen).

Apydia sieht zwar besser aus, stirbt aber mit folgender Fehlermeldung:

Code: Alles auswählen

Traceback (most recent call last):
  File "/usr/local/bin/apydia", line 8, in <module>
    load_entry_point('Apydia==0.0.2', 'console_scripts', 'apydia')()
  File "/usr/local/lib/python2.6/dist-packages/Apydia-0.0.2-py2.6.egg/apydia/command.py", line 258, in main
    project = Project(options)
  File "/usr/local/lib/python2.6/dist-packages/Apydia-0.0.2-py2.6.egg/apydia/project.py", line 65, in __init__
    desc = create_desc(sys.modules[module_name])
  File "/usr/local/lib/python2.6/dist-packages/Apydia-0.0.2-py2.6.egg/apydia/descriptors.py", line 397, in create_desc
    return class_(value)
  File "/usr/local/lib/python2.6/dist-packages/Apydia-0.0.2-py2.6.egg/apydia/descriptors.py", line 214, in __init__
    super(ModuleDesc, self).__init__(module)
  File "/usr/local/lib/python2.6/dist-packages/Apydia-0.0.2-py2.6.egg/apydia/descriptors.py", line 107, in __init__
    self.file = _getsourcefile_relative(value)
  File "/usr/local/lib/python2.6/dist-packages/Apydia-0.0.2-py2.6.egg/apydia/descriptors.py", line 54, in _getsourcefile_relative
    dist = get_distribution()
  File "/usr/local/lib/python2.6/dist-packages/Apydia-0.0.2-py2.6.egg/apydia/descriptors.py", line 35, in get_distribution
    return pkg_resources.get_distribution(dist_name)
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 270, in get_distribution
    if isinstance(dist,Requirement): dist = get_provider(dist)
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 156, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 626, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 524, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: bottle
Gibt es noch weitere alternativen oder muss ich mir das selbst basteln?

Verfasst: Dienstag 16. Februar 2010, 12:49
von CM
epydoc - funktioniert mit latex und html. Ist allerdings auch nicht immer nutzerfreudlich. Und hübsch? Na ja ...

apydia ist allerdings ein schöner link. Mal probieren, was es bei mir sagt.

Gruß,
Christian

Verfasst: Dienstag 16. Februar 2010, 13:31
von Leonidas
Sphinx kann auch Docstrings auswerten...

Verfasst: Dienstag 16. Februar 2010, 14:04
von jbs
Apydia funktioniert bei mir. Allerdings sieht die aktuelle Github-Version nicht so gut aus, wie eine ältere, da der den Docstring irgendwie nicht auswertet.

Verfasst: Dienstag 16. Februar 2010, 19:14
von lunar
Ich würde sphinx und dessen autodoc-Erweiterung empfehlen. Der Vorteil daran ist vor allem, dass Du generierte API-Dokumentation mit Fließtext kombinieren und bei Bedarf auch ersetzen kannst. Dadurch kannst Du die API-Dokumentation in eine logische Gliederung bringen, und hast nicht nur eine einfache, doch eigentlich ziemlich unübersichtliche Liste ala Javadoc oder epydoc.