Skip to content

Documentation should be generated with typing.TYPE_CHECKING == True #460

Open
@USSX-Hares

Description

@USSX-Hares

TL;DR

pdoc should set typing.TYPE_CHECKING to True.

Long Read

I was investigating a root cause of #459, and to apply the workaround, I added an import within the if (typing.TYPE_CHECKING) condition.
However, this didn't work, and it forced me to extract the import in question outside of the if statement. Then I've searched for the TYPE_CHECKING in the entire source tree, and found only two occurrences inside _version.py.

Enabling this will allow "heavy" or otherwise not needed imports to occur, and thus will allow proper linking between the modules.

Looks like this is an easy fix, and the flag should be set before generating the modules' documentation, probably in pdoc.Module class or in cli.main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions