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

if TYPE_CHECKING blocks not considered when resolving symbols #402

Closed
cjw296 opened this issue Nov 16, 2023 · 2 comments
Closed

if TYPE_CHECKING blocks not considered when resolving symbols #402

cjw296 opened this issue Nov 16, 2023 · 2 comments

Comments

@cjw296
Copy link

cjw296 commented Nov 16, 2023

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.

@hoodmane
Copy link
Collaborator

I think this is a duplicate of #22?

@cjw296
Copy link
Author

cjw296 commented Nov 16, 2023

Yep

@cjw296 cjw296 closed this as completed Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants