twisted / pydoctor

This is pydoctor, an API documentation generator that works by static analysis.
https://pydoctor.readthedocs.io
Other
179 stars 48 forks source link

Drop python 3.6 and enable future annotations everywhere #735

Closed tristanlatr closed 9 months ago

tristanlatr commented 9 months ago

Fixes #733

Fixes #732

And add python 3.12rc3 in the CI

codecov[bot] commented 9 months ago

Codecov Report

Attention: 23 lines in your changes are missing coverage. Please review.

Comparison is base (1a7d052) 91.98% compared to head (0281ba0) 91.78%.

:exclamation: Current head 0281ba0 differs from pull request most recent head 77734ab. Consider uploading reports for the commit 77734ab to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #735 +/- ## ========================================== - Coverage 91.98% 91.78% -0.21% ========================================== Files 47 47 Lines 8147 8058 -89 Branches 1780 1641 -139 ========================================== - Hits 7494 7396 -98 - Misses 380 385 +5 - Partials 273 277 +4 ``` | [Files](https://app.codecov.io/gh/twisted/pydoctor/pull/735?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=twisted) | Coverage Δ | | |---|---|---| | [pydoctor/\_configparser.py](https://app.codecov.io/gh/twisted/pydoctor/pull/735?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=twisted#diff-cHlkb2N0b3IvX2NvbmZpZ3BhcnNlci5weQ==) | `87.07% <100.00%> (+0.08%)` | :arrow_up: | | [pydoctor/driver.py](https://app.codecov.io/gh/twisted/pydoctor/pull/735?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=twisted#diff-cHlkb2N0b3IvZHJpdmVyLnB5) | `64.07% <100.00%> (+0.35%)` | :arrow_up: | | [pydoctor/epydoc/doctest.py](https://app.codecov.io/gh/twisted/pydoctor/pull/735?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=twisted#diff-cHlkb2N0b3IvZXB5ZG9jL2RvY3Rlc3QucHk=) | `100.00% <100.00%> (ø)` | | | [pydoctor/epydoc/docutils.py](https://app.codecov.io/gh/twisted/pydoctor/pull/735?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=twisted#diff-cHlkb2N0b3IvZXB5ZG9jL2RvY3V0aWxzLnB5) | `97.26% <100.00%> (+5.59%)` | :arrow_up: | | [pydoctor/epydoc/markup/\_\_init\_\_.py](https://app.codecov.io/gh/twisted/pydoctor/pull/735?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=twisted#diff-cHlkb2N0b3IvZXB5ZG9jL21hcmt1cC9fX2luaXRfXy5weQ==) | `92.15% <100.00%> (-0.06%)` | :arrow_down: | | [pydoctor/epydoc/markup/\_napoleon.py](https://app.codecov.io/gh/twisted/pydoctor/pull/735?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=twisted#diff-cHlkb2N0b3IvZXB5ZG9jL21hcmt1cC9fbmFwb2xlb24ucHk=) | `100.00% <100.00%> (ø)` | | | [pydoctor/epydoc/markup/\_types.py](https://app.codecov.io/gh/twisted/pydoctor/pull/735?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=twisted#diff-cHlkb2N0b3IvZXB5ZG9jL21hcmt1cC9fdHlwZXMucHk=) | `96.51% <100.00%> (ø)` | | | [pydoctor/epydoc/markup/epytext.py](https://app.codecov.io/gh/twisted/pydoctor/pull/735?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=twisted#diff-cHlkb2N0b3IvZXB5ZG9jL21hcmt1cC9lcHl0ZXh0LnB5) | `79.73% <100.00%> (ø)` | | | [pydoctor/epydoc/markup/google.py](https://app.codecov.io/gh/twisted/pydoctor/pull/735?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=twisted#diff-cHlkb2N0b3IvZXB5ZG9jL21hcmt1cC9nb29nbGUucHk=) | `100.00% <100.00%> (ø)` | | | [pydoctor/epydoc/markup/numpy.py](https://app.codecov.io/gh/twisted/pydoctor/pull/735?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=twisted#diff-cHlkb2N0b3IvZXB5ZG9jL21hcmt1cC9udW1weS5weQ==) | `100.00% <100.00%> (ø)` | | | ... and [32 more](https://app.codecov.io/gh/twisted/pydoctor/pull/735?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=twisted) | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

tristanlatr commented 9 months ago

@buhtz, I would you like to review this PR please ? :)

buhtz commented 9 months ago

I don't know if I have enough expertise here. I don't understand why you use types from the ast module instead of typing module which is IMHO recommended.

tristanlatr commented 9 months ago

I don't understand why you use types from the ast module instead of typing module which is IMHO recommended.

Indeed you don’t quite understood. The typing annotations are provided for generics and protocols. But ast classes are not generics, there is only these classes available to annotate these instances.

buhtz commented 9 months ago

I don't understand why you use types from the ast module instead of typing module which is IMHO recommended.

Indeed you don’t quite understood. The typing annotations are provided for generics and protocols. But ast classes are not generics, there is only these classes available to annotate these instances.

Is this a limitation of older Python versions? I do use annotations, too. But I don't have to use ast package or __futer__ magic.

tristanlatr commented 9 months ago

Is this a limitation of older Python versions?

No.

ast classes are just like other classes.

The __future__ import is not a hack. It enables this compiler feature: https://peps.python.org/pep-0563/. This helps with import cycle within TYPE_CHECKING blocks and enables us to use forward references in annotations.