-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Error messages don't tell you where the problem originates #403
Comments
The problem here actually has nothing to do with The following is a minimal reproduction: Minimal example
a.pyfrom typing import Callable
class A:
pass
T = Callable[['A'], None] b.pyfrom a import T
from typing import get_type_hints
def f(t: T):
pass
# The following fails:
get_type_hints(f) sphinx-autodoc-typehints tries to use I think in your case you can fix it with: if TYPE_CHECKING:
from sybil import Example, Document, LexedRegion, Region
#: The signature for an evaluator. See :ref:`developing-parsers`.
Evaluator = Callable[['Example'], Optional[str]]
#: The signature for a lexer. See :ref:`developing-parsers`.
Lexer = Callable[['Document'], Iterable['LexedRegion']]
#: The signature for a parser. See :ref:`developing-parsers`.
Parser = Callable[['Document'], Iterable['Region']] Python 3.12 gives a way out if people use the new type keyword: type Evaluator = Callable[['Sybil.Example'], Optional[str]] Then |
Yeah, I don't think your suggestion works as we just end up back at #22 |
I don't think you can hit #22 with your code because the import guard is only in |
In any case, the errors are confusing, the problem is difficult to understand, and when you understand the problem it is difficult to work around. It would be nice if we could improve the situation in some way. |
Ah I see do you hit #22 for example with |
I'm trying to use this package when generating the API docs for https://github.com/simplistix/sybil.
I've hit an issue, but it's made more tricky because the error messages give little clue as to where the problem originates:
These problems actually appear to be in the
sybil.typing
module due to #402, but there's no mention of that module or any filenames in the above.The text was updated successfully, but these errors were encountered: