pdoc3 / pdoc3/pdoc

Incorrect documentation for type aliases for `Callable`

Open
#229 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.2k
Forks
146
PR merge metrics
No merged PRs in 30d

Description

I have the following code using a type alias (https://docs.python.org/3/library/typing.html#type-aliases):

from typing import Callable
MyType = Callable[[str], str]
"""My function type"""
Expected Behavior

I would expect to see the documentation of MyType as a type alias, including the provided doc string

Actual Behavior
  • the documentation shows the type as a class
  • shows the name of the type as Callable instead of MyType
  • shows the inherited documentation from Callable instead of the provided docstring

Refer to https://carsten-leue.github.io/pdoc-test/pdoc_test/#pdoc_test.Callable for an example

Steps to Reproduce

Refer to this example: https://github.com/Carsten-Leue/pdoc-test/blob/master/pdoc_test/__init__.py#L13

Additional info
  • pdoc version:
    0.8.3

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 with the reproduced example in pdoc_test/init.py at line 13 and compare its generated page at the linked pdoc_test.Callable URL. Trace how pdoc3 0.8.3 identifies the Callable alias, then verify that the rendered result uses MyType and its provided docstring rather than Callable's inherited documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.