fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

8.8K
active users

OK, #python question: How do I generate docs for an embedded python project that uses a #SWIG generated library? #pydoc #pdoc and the like rightly complain about non-existent modules, but all the information I want is contained in docstrings and type annotations, so it *should* be possible to generate docs right?

Is there a tool for this?

Discovered, or possibly rediscovered, that for documenting Python modules « python -m pydoc -w png » will produce HTML documentation of the png module. And pydoc is in the Python Standard Library. AFAICT the only styling is automatically produced hyperlinks. I had a quick look at the code (to see if there were any undocumented styling features), and my impression was "plenty of attack surface here". (for example, pydoc includes a web server).

Replied in thread

@serge many of the projects we use in Python, like #Flask, are documented using #Sphinx, which can be configured to automatically generate API documentation from Python source code:

sphinx-doc.org/en/master/tutor

This is (similar to the #yardoc and #rdoc situation) backwards compatible with #pydoc, though much more expressive due to the machine-readable format for defining parameters, return values and potential exceptions:

sphinx-doc.org/en/master/tutor

docs.python.org/3/library/pydo

www.sphinx-doc.orgAutomatic documentation generation from code — Sphinx documentation

#python stdlib has a generated code documenter shoved into it: #pydoc. It has a lot of design problems, top of which is that it works poorly as a pure CI task to generate static HTML.

I forked it and made it at least usable, albeit still ugly.

github.com/matthewdeanmartin/p

Next step would be to use modern website templating. Maybe if it ever got attention & I felt peer pressure to improve it again.

GitHubGitHub - matthewdeanmartin/pydoc_fork: Run pydoc on a build server to generate API docsRun pydoc on a build server to generate API docs. Contribute to matthewdeanmartin/pydoc_fork development by creating an account on GitHub.