-
-
Notifications
You must be signed in to change notification settings - Fork 107
Using Type Aliases #132
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
Comments
What is it that you expect the output to be then? |
Hi, For example: |
What would tell your users that it's a subtype of |
@yasserfarouk by the way, you're using OutcomeUtilityMapping = Union[
Callable[[Union["Outcome", int, str, float]], "UtilityValue"],
Mapping[Union[Sequence, Mapping, int, str, float], "UtilityValue"],
] The reason behind this is that |
@yasserfarouk you might be interested in this workaround: pandas-dev/pandas#33025 (comment) |
I would expect sphinx_autodoc_typehints to render this source: :obj:`full.path.to.Image` which would then link to the documentation of the With |
Remove sphinx-autodoc-typehints and use native autodoc features instead, mainly because I can't find a workaround for: https://github.com/agronholm/sphinx-autodoc-typehints/issues/132 Re-introduce the "common" docs, else linking to send() and recv() is a mess.
Remove sphinx-autodoc-typehints and use native autodoc features instead, mainly because I can't find a workaround for: https://github.com/agronholm/sphinx-autodoc-typehints/issues/132 Re-introduce the "common" docs, else linking to send() and recv() is a mess.
Remove sphinx-autodoc-typehints and use native autodoc features instead, mainly because I can't find a workaround for: https://github.com/agronholm/sphinx-autodoc-typehints/issues/132 Re-introduce the "common" docs, else linking to send() and recv() is a mess.
Remove sphinx-autodoc-typehints and use native autodoc features instead, mainly because I can't find a workaround for: https://github.com/agronholm/sphinx-autodoc-typehints/issues/132 Re-introduce the "common" docs, else linking to send() and recv() is a mess.
See https://github.com/0x0L/typehints-test When the sphinx_autodoc_typehints extension is added both the alias and the link are lost |
I don't we can support type aliases in form of simple assignments, as we don't know if something is an alias or not, that information is lost at runtime. The path forward will be those projects to switch to using to explicit type alias via https://www.python.org/dev/peps/pep-0613/ and that would be handled well. |
@gaborbernat Is support for TypeAlias tracked somewhere else? |
I don't think so, but PR welcome to add support for it. |
Could this issue be re-opened and tracked as a PEP613 support? #284 is not an ideal workaround because it requires too much manual tracking, and on the other hand, sphinx already supports the PEP613. There are still benefits of having the support here:
|
I have a type alias defined using NewType:
Now one of my parameters uses this type:
mapping: OutcomeUtilityMapping
the problem is that the type gets unrolled to something like
which is unhelpful.
A tip for handling this is to rely on the new annotations using:
in conf.py but this fails for autodoc-typehints with an error:
AttributeError: '_SpecialForm' object has no attribute 'items'
I know that this should have been resolved in #64 but it seems that I am still having the same issue.
The text was updated successfully, but these errors were encountered: