Uh oh!
There was an error while loading. Please reload this page.
Remove :type lines now sphinx-autoapi supports typehints - #20951
Conversation
potiuk
commented
Jan 19, 2022
HELL YEAH! BTW. I guess the main reason you did it is to finally reach negative net number of lines changed in Airflow ? |
ashb
commented
Jan 19, 2022
I mean that was certainly part of the reason. A big part. It just happens to help that it's also the right thing to do 😁 |
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
ashb
commented
Jan 20, 2022
Looks like some spelling errors (aka ClassNames) coming in via the types now need to be added to dictionary |
potiuk
commented
Jan 20, 2022
But images are ok, all tests pass and all looks good besides :) |
de76855 to
1149e63Compareashb
commented
Jan 20, 2022
Right, I think I've got all the type-induced spelling errors, unless one crept back in when rebasing 🤞🏻 |
potiuk
commented
Jan 20, 2022
2 errors left @ashb ! |
potiuk
commented
Jan 20, 2022
And conflicts with my cloud formation change :( |
Fixed the errors. Has your change merged? Ah, yes, conflicts already I see |
Since we have no updated sphinx-autoapi to a more recent version it supports showing type hints in the documentation, so we don't need to have the type hints _and_ the `:type` lines -- which is good, as the ones in the doc strings are easy to get out of date! The following settings have been set: `autodoc_typehints = 'description'` -- show types in description (where previous `:type` used to show up) `autodoc_typehints_description_target = 'documented'` -- only link to types that are documented. (Without this we have some missing return types that aren't documented, and aren't linked to in our current python API docs, so this caused a build failure) `autodoc_typehints_format = 'short'` -- Shorten type hints where possible, i.e. `StringIO` instead of `io.StringIO`
Now that we are using the type hints in the docs, sphinxcontrib-spelling picks them up as words to be checked, so we have to ignore them. I've chosen to add the provider specific ones to local dictionary files rather than the global, as for example, `mgmt` is an error in most places, but not in some of the Azure provider.
4685698 to
b3aec74Compare@potiuk Any idea what failed with the 'Constraints" job https://github.com/apache/airflow/runs/4888325400?check_suite_focus=true I don't actually see any error -- just some process exited with 1. (I thought we only ran that on main, not on PRs?) Ah, it's just the Push that only runs on main. That makes sense. |
Oh there's the error much futher up https://github.com/apache/airflow/runs/4888325400?check_suite_focus=true#step:7:580 Ummmm, yeah, something is wrong about constraint generation now, as it's trying to generate new constraints while using the old file?! |
potiuk
commented
Jan 20, 2022
Rebase ? |
ashb
commented
Jan 20, 2022
Already up to date. |
potiuk
commented
Jan 20, 2022
Hmm. Will take a look in a bit |
potiuk
commented
Jan 20, 2022
We can merge the change now. The problem was because of one line missing in the latest refactor: |
potiuk
commented
Jan 20, 2022
BTW. This time the round number is mine ;) |
ashb
commented
Jan 21, 2022
Thanks, I had a feeling it would be something like this but didn't want to break main if it was a bigger problem. |
Since we have no updated sphinx-autoapi to a more recent version it supports showing type hints in the documentation, so we don't need to have the type hints and the
:typelines -- which is good, as the ones in the doc strings are easy to get out of date!The following settings have been set:
autodoc_typehints = 'description'-- show types in description (where previous:typeused to show up)autodoc_typehints_description_target = 'documented'-- only link to types that are documented. (Without this we have some missing return types that aren't documented, and aren't linked to in our current python API docs, so this caused a build failure)autodoc_typehints_format = 'short'-- Shorten type hints where possible, i.e.StringIOinstead ofio.StringIOBefore (https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/models/baseoperator/index.html#airflow.models.baseoperator.BaseOperator)
After
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.