-
-
Notifications
You must be signed in to change notification settings - Fork 144
Closed
Labels
duplicateThis issue or pull request already existsThis issue or pull request already exists
Description
According to the Python docs, typing.Callable is deprecated for type hinting, in favour of using collections.abc.Callable. When I replaced this usage in some of my code, pdoc3 fails to produce documentation. I have a minimal example which shows the issue (this was running on Python 3.10.16 with pdoc3 0.11.5)
from collections.abc import Callable
from typing import Callable as CallableTyping
def test_fn(
in1: str, in2: str, in3: str|None
) -> Callable[[str], str]:
"""Test function"""
def returned_fn(iput: str) -> str:
print(iput)
return f"Printed {iput}"
return returned_fn
def test_fn_2(
in1: str, in2: str, in3: str|None
) -> CallableTyping[[str], str]:
"""Test function"""
def returned_fn2(iput: str) -> str:
print(iput)
return f"Printed {iput}"
return returned_fn2The first function will trip pdoc3 up, with the error TypeError: Expected a list of types, an ellipsis, ParamSpec, or Concatenate. Got (<class 'str'>,), while the second will be fine.
Metadata
Metadata
Assignees
Labels
duplicateThis issue or pull request already existsThis issue or pull request already exists