pdoc
pdoc copied to clipboard
Forward references break with NamedTuples
Problem Description
Thanks for this library! Hopefully this is an easy one: Forward references inside NamedTuples do not get resolved and result in a warning
Steps to reproduce the behavior:
from __future__ import annotations
from typing import NamedTuple
class Foo(NamedTuple):
b: Bar
class Bar:
pass
Results in:
Warn: Error parsing type annotation ForwardRef('Bar') for bug.Foo.__init__. Import of Bar failed: name 'Bar' is not defined
It appears to just be NamedTuples -- regular classes (and dataclasses) do not produce this warning.
System Information
pdoc: 15.0.1
Python: 3.10.8
Platform: Linux-5.15.0-125-generic-x86_64-with-glibc2.31