Skip to content

if TYPE_CHECKING blocks not considered when resolving symbols #402

Closed
@cjw296

Description

@cjw296

I'm trying to use sphinx-autodoc-typehints to work around sphinx-doc/sphinx#10785.

However, I need to use an if TYPE_CHECKING block to resolve an unavoidable circular import issue:

https://github.com/simplistix/sybil/blob/f6d8772a3f0b32c79a0b4cdd83d21098cb0721a7/sybil/typing.py#L1-L14

However, now I get:

WARNING: Cannot resolve forward reference in type annotations of "sybil.Sybil": name 'sybil' is not defined

...because it doesn't appear this package is considering imports within the if TYPE_CHECKING.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions