-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix 10605 constructor annotations in description #10880
base: master
Are you sure you want to change the base?
Fix 10605 constructor annotations in description #10880
Conversation
@@ -2345,7 +2345,11 @@ def test_autodoc(app, status, warning): | |||
my_name | |||
|
|||
alias of Foo""" | |||
assert warning.getvalue() == '' | |||
warning_lines = [line for line in warning.getvalue().split('\n') if line] | |||
# This might be a bug. We're not picking up the TypeVar T. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify: the test file tests/roots/test-ext-autodoc/target/typehints_lazy.py
causes this warning with or without my changes. Not sure if I did something wrong in the test example or if this needs fixing in autodoc.
Constructor annotations where not properly detected in autodoc when `autodoc_typehints` was `'description'` or `'both'`.
23516fc
to
862db92
Compare
Potentially pending: updating the docs with the new event. But I'd first like to get feedback if it's even worth putting further effort into this approach. |
By constructor annotations, do you mean only I'm wary about adding a new event to autodoc if this can be solved another way, I suppose. Please may you also be a little more specific in your tests--why is A |
Please also don't force-push if possible, I squash-merge PRs and GitHub makes reviewing force-pushes much harder than the merge workflow. A |
Lazy annotations (`from __future__ import annotations`) were only introduced in Python 3.7+.
Thanks for having a look.
Sorry. I only do this before the review process has begun, as I know how hard it is to figure out what changed between reviews when force pushed.
I'm not sure this is possible without a big rewrite. Right now, iirc (this work is a few weeks old already), the code that puts together the types for the combined documentation is a processor (
Because |
I'm also battling the tests right now. The issue is that if sys.version_info < (3, 7):
exclude_patterns = ['index_py37.rst'] But then I'm still stuck with |
I am delaying this to 6.0 or 6.1, which will be the next releases after 5.3. It will also solve the test issues as 3.6/3.7 support has been dropped. A |
@AA-Turner 6.1 is out already and this fix sadly still didn't land. It'd really be a great deal if we could merge this or find a different solution. Unresolved type aliases reduce the usability of the docs significantly. |
Constructor annotations were not properly detected in autodoc when
autodoc_typehints
was'description'
or'both'
.Feature or Bugfix
Fixes
Rebase of