Pdoc – Generate API Documentation for Python Projects
Posted3 months agoActive3 months ago
pdoc.devTechstory
supportivepositive
Debate
20/100
PythonAPI DocumentationDocumentation Tools
Key topics
Python
API Documentation
Documentation Tools
Pdoc, a lightweight Python API documentation generator, is shared on HN, sparking a discussion about its features, use cases, and comparisons to other documentation tools.
Snapshot generated from the HN discussion
Discussion Activity
Moderate engagementFirst comment
27m
Peak period
8
3-6h
Avg / period
3.6
Comment distribution25 data points
Loading chart...
Based on 25 loaded comments
Key moments
- 01Story posted
Oct 6, 2025 at 11:40 PM EDT
3 months ago
Step 01 - 02First comment
Oct 7, 2025 at 12:07 AM EDT
27m after posting
Step 02 - 03Peak activity
8 comments in 3-6h
Hottest window of the conversation
Step 03 - 04Latest activity
Oct 8, 2025 at 11:56 AM EDT
3 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45499170Type: storyLast synced: 11/20/2025, 6:42:50 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
[1]: https://pythonhosted.org/pyserial/
If that's something you like, then just lift their documentation/ wholesale and tailor it to your needs, which is how I started. I also tweaked the sphinx settings to generate a pdf as well, but that was a special thing for the customer we were delivering the library and documentation to.
Are there any libraries similar to Doxylink [2] that ensure that links from Sphinx to pdoc (and vice versa) are valid?
[1] https://news.ycombinator.com/item?id=25903595
[2] https://sphinxcontrib-doxylink.readthedocs.io/en/stable/
There is no pdoc-specific library for link checking as far as I'm aware. It's all plain HTML though, so you can use a more general tool like https://lychee.cli.rs/. :)
However, when they start to grow, MkDocs and the Material for MkDocs theme make the most sense — they’re easy to install and deploy, and they offer a ton of features for writing engaging documentation.
[0] https://www.mkdocs.org/ [1] https://squidfunk.github.io/mkdocs-material/
*not just because my initials are MK
Example here: https://quarkslab.github.io/quokka/reference/python/executab...
But there is one blemish.
They write on documenting variable assignments which don't support pythons __doc__ string:
> To compensate, pdoc will read the abstract syntax tree (an abstract representation of the source code) and include all assignment statements immediately followed by a docstring
I can't really understand that. I am programming Python for 14 years now, and any real codebase I have ever seen documents variables above their declaration. Even if there is some technical reason for it, if I saw a python developer comment what a variable declaration means below that declaration I would at least question their taste.
To me that particular implementation is so bad, that I would prefer pdoc without it.
It’s standard to write docstrings below the declaration they refer to. What you are refering to are comments, not docstrings. I’ve been programming in Python for 15 years and I learnt this quite recently. This gives you in-editor documentation for class attributes and other non-functions.
I wonder why they didn’t take the same approach here and invented a new syntax.
Also, when I first wrote pdoc, it was at a time of immense frustration with both Sphinx and reST.
I much prefer the way Rust did it, so just a separate type of comment-prefix for docstrings. In Rust a regular comment may be
while a docstring is simply with //! for docstrings at a module level. This is elegant. This is simple. It is a pythonic solution. Treating comments below a variable declaration implicity as a docstring is not. At the beginning of class or function declarations, ok (although I also would have prefered that to be above the declaration), but this.. I need a drink.and since sphinx is the documentation tool of choice by the python core devs to document python itself, i have to assume they've given this design pattern at least tacit approval... :shrug:
There's a workaround for this case (relevant issue has a link at the top), which is cool, but it uses an "internal" function to solve it, which is not.
Show HN: Pdoc, a lightweight Python API documentation generator - https://news.ycombinator.com/item?id=25903595 - Jan 2021 (18 comments)
It makes really nice use of python docstrings and is overall just really easy to use!