mbox series

[v2,0/6] qapi: static typing conversion, pt5b

Message ID 20210520225710.168356-1-jsnow@redhat.com (mailing list archive)
Headers show
Series qapi: static typing conversion, pt5b | expand

Message

John Snow May 20, 2021, 10:57 p.m. UTC
This is part five (b), and focuses on QAPIDoc in parser.py.

gitlab: https://gitlab.com/jsnow/qemu/-/commits/python-qapi-cleanup-pt5b

Requirements:
- Python 3.6+
- mypy >= 0.770
- pylint >= 2.6.0 (2.7.0+ when using Python 3.9+)

Every commit should pass with:
 - `isort -c qapi/`
 - `flake8 qapi/`
 - `pylint --rcfile=qapi/pylintrc qapi/`
 - `mypy --config-file=qapi/mypy.ini qapi/`

V2:
 - Changed patch 01 to fix error message.
 - Add a TODO for fixing the cycle in patch 03.
 - Changed some commit messages, patch names

John Snow (6):
  qapi/parser: fix unused check_args_section arguments
  qapi/parser: Allow empty QAPIDoc Sections
  qapi/parser: add type hint annotations (QAPIDoc)
  qapi/parser: enable mypy checks
  qapi/parser: Silence too-few-public-methods warning
  qapi/parser: enable pylint checks

 scripts/qapi/mypy.ini                 |  5 --
 scripts/qapi/parser.py                | 98 +++++++++++++++++----------
 scripts/qapi/pylintrc                 |  3 +-
 tests/qapi-schema/doc-bad-feature.err |  2 +-
 4 files changed, 64 insertions(+), 44 deletions(-)

Comments

John Snow Aug. 5, 2021, 12:20 a.m. UTC | #1
On 5/20/21 6:57 PM, John Snow wrote:
> This is part five (b), and focuses on QAPIDoc in parser.py.
> 
> gitlab: https://gitlab.com/jsnow/qemu/-/commits/python-qapi-cleanup-pt5b
> 
> Requirements:
> - Python 3.6+
> - mypy >= 0.770
> - pylint >= 2.6.0 (2.7.0+ when using Python 3.9+)
> 
> Every commit should pass with:
>   - `isort -c qapi/`
>   - `flake8 qapi/`
>   - `pylint --rcfile=qapi/pylintrc qapi/`
>   - `mypy --config-file=qapi/mypy.ini qapi/`
> 
> V2:
>   - Changed patch 01 to fix error message.
>   - Add a TODO for fixing the cycle in patch 03.
>   - Changed some commit messages, patch names
> 
> John Snow (6):
>    qapi/parser: fix unused check_args_section arguments
>    qapi/parser: Allow empty QAPIDoc Sections
>    qapi/parser: add type hint annotations (QAPIDoc)
>    qapi/parser: enable mypy checks
>    qapi/parser: Silence too-few-public-methods warning
>    qapi/parser: enable pylint checks
> 
>   scripts/qapi/mypy.ini                 |  5 --
>   scripts/qapi/parser.py                | 98 +++++++++++++++++----------
>   scripts/qapi/pylintrc                 |  3 +-
>   tests/qapi-schema/doc-bad-feature.err |  2 +-
>   4 files changed, 64 insertions(+), 44 deletions(-)
> 

 From memory, where we left off was:

- What is our plan for eliminating the cycle in QAPIDoc?
- What's the actual situation with these "empty" sections?

And my answer to both problems as of today is:

... I'm not really sure yet, but I have a lot of preliminary work 
building up on implementing a cross-referenceable QAPI domain for 
sphinx, which might necessitate some heavier changes to how QAPIDoc 
information is parsed and stored.

I'd like to cover fixing both design problems of QAPIDoc at that time if 
you'll let me sweep the dirt under the mat until then. I can add FIXME 
comments to the code -- at the moment, the configuration of ./python/ 
does not tolerate TODO nor FIXME comments, and I do intend to move 
./scripts/qapi to ./python/qemu/qapi once we finish typing it, so you 
can be assured that I'll have to address those to do the thing I want.

In the meantime it means a blemish in the form of TYPE_CHECKING, but it 
lets us get on with everything else in the meantime.

Worst case scenario: A meteorite pierces my skull and the work goes 
unfinished. parser.py type checks but has some FIXME comments jangling 
around that Someone:tm: has to fix, but the Heat Death Of The Universe 
occurs first. Nobody has any energy left to be dissatisfied with the way 
things wound up.

--js
Markus Armbruster Sept. 7, 2021, 10:56 a.m. UTC | #2
John Snow <jsnow@redhat.com> writes:

> This is part five (b), and focuses on QAPIDoc in parser.py.
>
> gitlab: https://gitlab.com/jsnow/qemu/-/commits/python-qapi-cleanup-pt5b
>
> Requirements:
> - Python 3.6+
> - mypy >= 0.770
> - pylint >= 2.6.0 (2.7.0+ when using Python 3.9+)
>
> Every commit should pass with:
>  - `isort -c qapi/`
>  - `flake8 qapi/`
>  - `pylint --rcfile=qapi/pylintrc qapi/`
>  - `mypy --config-file=qapi/mypy.ini qapi/`

Review complete.  Let's discuss my findings, decide what needs to be
addressed now, then see whether I can do it myself or need you to
respin.