mbox series

[00/15] python: absorb scripts/qmp/qom-* tooling

Message ID 20201021185208.1611145-1-jsnow@redhat.com
Headers show
Series python: absorb scripts/qmp/qom-* tooling | expand

Message

John Snow Oct. 21, 2020, 6:51 p.m. UTC
Based-on: <20201020193555.1493936-1-jsnow@redhat.com>
          [PATCH v3 00/15] python: create installable package

This is a bit of a demonstration of the direction I want to take our
python tooling, and how it *might* work.

By moving items from ./scripts/*.py over to ./python/qemu/* somewhere,
they can be checked with the same isort/flake8/pylint/mypy tooling as
everything else. This will help prevent regressions.

I would like to, over time, move all applicable python scripts from
./scripts to ./python. That will be a long, gradual stream of changes,
but the more we do it, the better off we'll be for these tools.

Reviewer notes:

- I just rewrote qom-xxx entirely, though it is based on the original
  scripts. Doing it brick by brick was too slow.

- I added a symlink to the qom-fuse file under the python/ tree so I
  could check it with the usual linters. This causes some future
  knowledge to bleed through in a few places; notably I update the
  python setup.cfg several times in the middle of the series where it
  doesn't seem like that should have an effect.

- qom-fuse disappears from the tree for a single commit, but that
  preserves git-blame history. Best I could do.

John Snow (15):
  python/qmp: Add qom script rewrites
  python/qmp: add qom script entry points
  scripts/qmp: redirect qom-xxx scripts to python/qemu/qmp/
  scripts/qom-fuse: apply isort rules
  scripts/qom-fuse: apply flake8 rules
  python: Add 'fh' to known-good variable names
  scripts/qom-fuse: Apply pylint rules
  scripts/qom-fuse: Add docstrings
  scripts/qom-fuse: Convert to QOMCommand
  scripts/qom-fuse: use QOMCommand.qom_list()
  scripts/qom-fuse: ensure QOMFuse.read always returns bytes
  scripts/qom-fuse: add static type hints
  scripts/qom-fuse: move to python/qemu/qmp/qom_fuse.py
  scripts/qom-fuse: add redirection shim to python/qemu/qmp/qom-fuse.py
  python: add fuse command to 'qom' tools

 python/qemu/qmp/qom.py        | 217 ++++++++++++++++++++++++++++++++++
 python/qemu/qmp/qom_common.py | 153 ++++++++++++++++++++++++
 python/qemu/qmp/qom_fuse.py   | 207 ++++++++++++++++++++++++++++++++
 python/setup.cfg              |  24 +++-
 scripts/qmp/qom-fuse          | 144 +---------------------
 scripts/qmp/qom-get           |  66 +----------
 scripts/qmp/qom-list          |  63 +---------
 scripts/qmp/qom-set           |  63 +---------
 scripts/qmp/qom-tree          |  74 +-----------
 9 files changed, 618 insertions(+), 393 deletions(-)
 create mode 100644 python/qemu/qmp/qom.py
 create mode 100644 python/qemu/qmp/qom_common.py
 create mode 100644 python/qemu/qmp/qom_fuse.py

Comments

John Snow Nov. 4, 2020, 12:38 a.m. UTC | #1
On 10/21/20 2:51 PM, John Snow wrote:
> Based-on: <20201020193555.1493936-1-jsnow@redhat.com>
>            [PATCH v3 00/15] python: create installable package
> 

Thanks for the early look. This is superseded by:

[PATCH v2 00/72] python: move scripts/qmp to python/qemu/qmp

> This is a bit of a demonstration of the direction I want to take our
> python tooling, and how it *might* work.
> 
> By moving items from ./scripts/*.py over to ./python/qemu/* somewhere,
> they can be checked with the same isort/flake8/pylint/mypy tooling as
> everything else. This will help prevent regressions.
> 
> I would like to, over time, move all applicable python scripts from
> ./scripts to ./python. That will be a long, gradual stream of changes,
> but the more we do it, the better off we'll be for these tools.
> 
> Reviewer notes:
> 
> - I just rewrote qom-xxx entirely, though it is based on the original
>    scripts. Doing it brick by brick was too slow.
> 
> - I added a symlink to the qom-fuse file under the python/ tree so I
>    could check it with the usual linters. This causes some future
>    knowledge to bleed through in a few places; notably I update the
>    python setup.cfg several times in the middle of the series where it
>    doesn't seem like that should have an effect.
> 
> - qom-fuse disappears from the tree for a single commit, but that
>    preserves git-blame history. Best I could do.
> 
> John Snow (15):
>    python/qmp: Add qom script rewrites
>    python/qmp: add qom script entry points
>    scripts/qmp: redirect qom-xxx scripts to python/qemu/qmp/
>    scripts/qom-fuse: apply isort rules
>    scripts/qom-fuse: apply flake8 rules
>    python: Add 'fh' to known-good variable names
>    scripts/qom-fuse: Apply pylint rules
>    scripts/qom-fuse: Add docstrings
>    scripts/qom-fuse: Convert to QOMCommand
>    scripts/qom-fuse: use QOMCommand.qom_list()
>    scripts/qom-fuse: ensure QOMFuse.read always returns bytes
>    scripts/qom-fuse: add static type hints
>    scripts/qom-fuse: move to python/qemu/qmp/qom_fuse.py
>    scripts/qom-fuse: add redirection shim to python/qemu/qmp/qom-fuse.py
>    python: add fuse command to 'qom' tools
> 
>   python/qemu/qmp/qom.py        | 217 ++++++++++++++++++++++++++++++++++
>   python/qemu/qmp/qom_common.py | 153 ++++++++++++++++++++++++
>   python/qemu/qmp/qom_fuse.py   | 207 ++++++++++++++++++++++++++++++++
>   python/setup.cfg              |  24 +++-
>   scripts/qmp/qom-fuse          | 144 +---------------------
>   scripts/qmp/qom-get           |  66 +----------
>   scripts/qmp/qom-list          |  63 +---------
>   scripts/qmp/qom-set           |  63 +---------
>   scripts/qmp/qom-tree          |  74 +-----------
>   9 files changed, 618 insertions(+), 393 deletions(-)
>   create mode 100644 python/qemu/qmp/qom.py
>   create mode 100644 python/qemu/qmp/qom_common.py
>   create mode 100644 python/qemu/qmp/qom_fuse.py
> 

NACK