mitmproxy / mitmproxy/pdoc

Support PEP 727 Annotated/Doc annotations?

Open
#755 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
2.5k
Forks
228
PR merge metrics
No merged PRs in 30d

Description

Problem Description

PEP 727 proposes a standard syntax for applying documentation strings to function parameters, return values, class variables, etc. using Annotated/Doc. While the PEP has not yet been accepted (and may or may not be), some Python libraries like pydantic and FastAPI are already using it regardless.

Proposal

It would be nice if pdoc could support this, extracting Doc elements from Annotated type annotations and inserting the text into the appropriate section of the rendered documentation. This could be used in lieu of or in conjunction with existing docstring styles like Google or numpy.

Alternatives

I don't think any mainstream doc generators are supporting this syntax yet, but there is an extension for mkdocstrings that does seem to support it.

Additional context

If PEP 727 is accepted, then the typing module will introduce Doc. But otherwise, Doc is expected to remain in the 3rd party typing_extensions library indefinitely.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading PEP 727 and the linked griffe-typingdoc extension to compare how Doc elements are represented and placed in rendered documentation. Done means pdoc extracts Doc metadata from Annotated annotations and places it appropriately alongside existing docstring styles, with behavior covering both typing and typing_extensions as relevant.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.