Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward references break with NamedTuples #765

Open
khusmann opened this issue Dec 22, 2024 · 0 comments
Open

Forward references break with NamedTuples #765

khusmann opened this issue Dec 22, 2024 · 0 comments
Labels

Comments

@khusmann
Copy link

khusmann commented Dec 22, 2024

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
@khusmann khusmann added the bug label Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant