qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/72] python: move scripts/qmp to python/qemu/qmp
@ 2020-11-04  0:34 John Snow
  2020-11-04  0:34 ` [PATCH v2 01/72] python/qmp: Add qom script rewrites John Snow
                   ` (71 more replies)
  0 siblings, 72 replies; 73+ messages in thread
From: John Snow @ 2020-11-04  0:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cleber Rosa, John Snow, Markus Armbruster, Eduardo Habkost

Based-on: <20201020193555.1493936-1-jsnow@redhat.com>
          [PATCH v3 00/15] python: create installable package

Hi! This series looks big, but don't panic. Like many python refactoring
series, most of the individual patches are very tiny, isolated changes.

This series depends on the details of the installable package series,
so don't sweat too hard reviewing the particulars just yet, or at all.
I did want to showcase the process of moving scripts INTO the python
library, though, so here it is.

The purpose of this series is to move ./scripts/qmp/* to
./python/qemu/qmp/*.py.  To do so, we need to ensure that these files
pass the various linters and code quality standards we have instituted
for the python library. Doing so allows us to check these tools with the
same type checking utilities that we use to enforce integrity in the
base library.

This way, changes to the library will cause integration tests to fail,
and we can ensure the continued stability of these scripts.

Nicest of all, by installing this python package to your working
environment, you will now have access to 'qom-set', 'qom-get',
'qmp-shell', etc no matter what your working directory is, and it will
Just Work.

Let's run down the list:

- qom-set, qom-get, qom-tree, and qom-list are merged into a 'qom' tool.
- qom-[set|get|tree|list] are still available under those names, too.
- qemu-ga-client is lightly refurbished and is also now available.
- qmp-shell is lightly polished and will be available.

Patches 1-3: Introduce 'qom' tool, deprecate qom-[set|get|tree|list]
Patches 4-16: port qom-fuse to qemu.qmp.qom tool
Patches 17-27: port qemu-ga-client to qemu.qmp package
Patches 28-72: port qmp-shell to qemu.qmp package

Reviewer notes:

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

- I added symlinks (not in git) to the old scripts in the new location
  to run the linters against the files that haven't been moved yet, and
  once they're almost done (except for import problems), I move them.

- After moving scripts, I add a forwarder to the new location from the
  old location. The forwarders can be deleted eventually.

- some scripts disappear for a commit or two before being
  re-established. This helps preserve git-blame history where it
  happens; it was the best I could do.

John Snow (72):
  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: add optional fuse dependency
  scripts/qemu-ga-client: apply isort rules
  scripts/qemu-ga-client: apply (most) flake8 rules
  scripts/qemu-ga-client: Fix exception handling
  scripts/qemu-ga-client: replace deprecated optparse with argparse
  scripts/qemu-ga-client: add module docstring
  scripts/qemu-ga-client: apply (most) pylint rules
  python/qmp: Correct type of QMPReturnValue
  scripts/qmp/qemu-ga-client: add mypy type hints
  scripts/qemu-ga-client: move to python/qemu/qmp/qemu_ga_client.py
  python/qemu-ga-client: add entry point
  scripts/qemu-ga-client: Add forwarder stub
  scripts/qmp-shell: apply isort rules
  scripts/qmp-shell: Apply flake8 rules
  scripts/qmp-shell: fix show_banner signature
  scripts/qmp-shell: fix exception handling
  scripts/qmp-shell: fix connect method signature
  scripts/qmp-shell: remove shadowed variable from _print()
  scripts/qmp-shell: use @classmethod where appropriate
  scripts/qmp-shell: Use python3-style super()
  scripts/qmp-shell: declare verbose in __init__
  scripts/qmp-shell: use triple-double-quote docstring style
  scripts/qmp-shell: ignore visit_Name name
  scripts/qmp-shell: make QMPCompleter returns explicit
  scripts/qmp-shell: rename one and two-letter variables
  scripts/qmp-shell: fix shell history exception handling
  scripts/qmp-shell: explicitly chain exception context
  scripts/qmp-shell: remove if-raise-else patterns
  scripts/qmp-shell: use isinstance() instead of type()
  scripts/qmp-shell: use argparse
  python/qmp: Fix type of SocketAddrT
  python/qmp: add parse_address classmethod
  scripts/qmp-shell: Add pretty attribute to HMP shell
  scripts/qmp-shell: Make verbose a public attribute
  scripts/qmp-shell: move get_prompt() to prompt property
  scripts/qmp-shell: remove prompt argument from read_exec_command
  scripts/qmp-shell: move the REPL functionality into QMPShell
  scripts/qmp-shell: Fix "FuzzyJSON" parser
  scripts/qmp-shell: refactor QMPCompleter
  scripts/qmp-shell: initialize completer early
  python/qmp: add QMPObject type alias
  scripts/qmp-shell: add mypy types
  scripts/qmp-shell: Accept SocketAddrT instead of string
  scripts/qmp-shell: unprivatize 'pretty' property
  python/qmp: return generic type from context manager
  scripts/qmp-shell: Use context manager instead of atexit
  scripts/qmp-shell: use logging to show warnings
  scripts/qmp-shell: remove TODO
  scripts/qmp-shell: Fix empty-transaction invocation
  scripts/qmp-shell: Remove too-broad-exception
  scripts/qmp-shell: convert usage comment to docstring
  scripts/qmp-shell: remove double-underscores
  scripts/qmp-shell: make QMPShellError inherit QMPError
  scripts/qmp-shell: add docstrings
  scripts/qmp-shell: move to python/qemu/qmp/qmp_shell.py
  python: add qmp-shell entry point
  scripts/qmp-shell: add redirection shim

 python/Pipfile.lock               |  13 +-
 python/qemu/qmp/__init__.py       |  61 +++-
 python/qemu/qmp/qemu_ga_client.py | 323 ++++++++++++++++++
 python/qemu/qmp/qmp_shell.py      | 535 ++++++++++++++++++++++++++++++
 python/qemu/qmp/qom.py            | 217 ++++++++++++
 python/qemu/qmp/qom_common.py     | 153 +++++++++
 python/qemu/qmp/qom_fuse.py       | 207 ++++++++++++
 python/setup.cfg                  |  30 +-
 scripts/qmp/qemu-ga-client        | 297 +----------------
 scripts/qmp/qmp-shell             | 454 +------------------------
 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 +----
 15 files changed, 1546 insertions(+), 1154 deletions(-)
 create mode 100644 python/qemu/qmp/qemu_ga_client.py
 create mode 100644 python/qemu/qmp/qmp_shell.py
 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

-- 
2.26.2




^ permalink raw reply	[flat|nested] 73+ messages in thread

end of thread, other threads:[~2020-11-04  1:32 UTC | newest]

Thread overview: 73+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-04  0:34 [PATCH v2 00/72] python: move scripts/qmp to python/qemu/qmp John Snow
2020-11-04  0:34 ` [PATCH v2 01/72] python/qmp: Add qom script rewrites John Snow
2020-11-04  0:34 ` [PATCH v2 02/72] python/qmp: add qom script entry points John Snow
2020-11-04  0:34 ` [PATCH v2 03/72] scripts/qmp: redirect qom-xxx scripts to python/qemu/qmp/ John Snow
2020-11-04  0:34 ` [PATCH v2 04/72] scripts/qom-fuse: apply isort rules John Snow
2020-11-04  0:34 ` [PATCH v2 05/72] scripts/qom-fuse: apply flake8 rules John Snow
2020-11-04  0:34 ` [PATCH v2 06/72] python: Add 'fh' to known-good variable names John Snow
2020-11-04  0:34 ` [PATCH v2 07/72] scripts/qom-fuse: Apply pylint rules John Snow
2020-11-04  0:34 ` [PATCH v2 08/72] scripts/qom-fuse: Add docstrings John Snow
2020-11-04  0:34 ` [PATCH v2 09/72] scripts/qom-fuse: Convert to QOMCommand John Snow
2020-11-04  0:35 ` [PATCH v2 10/72] scripts/qom-fuse: use QOMCommand.qom_list() John Snow
2020-11-04  0:35 ` [PATCH v2 11/72] scripts/qom-fuse: ensure QOMFuse.read always returns bytes John Snow
2020-11-04  0:35 ` [PATCH v2 12/72] scripts/qom-fuse: add static type hints John Snow
2020-11-04  0:35 ` [PATCH v2 13/72] scripts/qom-fuse: move to python/qemu/qmp/qom_fuse.py John Snow
2020-11-04  0:35 ` [PATCH v2 14/72] scripts/qom-fuse: add redirection shim to python/qemu/qmp/qom-fuse.py John Snow
2020-11-04  0:35 ` [PATCH v2 15/72] python: add fuse command to 'qom' tools John Snow
2020-11-04  0:35 ` [PATCH v2 16/72] python: add optional fuse dependency John Snow
2020-11-04  0:35 ` [PATCH v2 17/72] scripts/qemu-ga-client: apply isort rules John Snow
2020-11-04  0:35 ` [PATCH v2 18/72] scripts/qemu-ga-client: apply (most) flake8 rules John Snow
2020-11-04  0:35 ` [PATCH v2 19/72] scripts/qemu-ga-client: Fix exception handling John Snow
2020-11-04  0:35 ` [PATCH v2 20/72] scripts/qemu-ga-client: replace deprecated optparse with argparse John Snow
2020-11-04  0:35 ` [PATCH v2 21/72] scripts/qemu-ga-client: add module docstring John Snow
2020-11-04  0:35 ` [PATCH v2 22/72] scripts/qemu-ga-client: apply (most) pylint rules John Snow
2020-11-04  0:35 ` [PATCH v2 23/72] python/qmp: Correct type of QMPReturnValue John Snow
2020-11-04  0:35 ` [PATCH v2 24/72] scripts/qmp/qemu-ga-client: add mypy type hints John Snow
2020-11-04  0:35 ` [PATCH v2 25/72] scripts/qemu-ga-client: move to python/qemu/qmp/qemu_ga_client.py John Snow
2020-11-04  0:35 ` [PATCH v2 26/72] python/qemu-ga-client: add entry point John Snow
2020-11-04  0:35 ` [PATCH v2 27/72] scripts/qemu-ga-client: Add forwarder stub John Snow
2020-11-04  0:35 ` [PATCH v2 28/72] scripts/qmp-shell: apply isort rules John Snow
2020-11-04  0:35 ` [PATCH v2 29/72] scripts/qmp-shell: Apply flake8 rules John Snow
2020-11-04  0:35 ` [PATCH v2 30/72] scripts/qmp-shell: fix show_banner signature John Snow
2020-11-04  0:35 ` [PATCH v2 31/72] scripts/qmp-shell: fix exception handling John Snow
2020-11-04  0:35 ` [PATCH v2 32/72] scripts/qmp-shell: fix connect method signature John Snow
2020-11-04  0:35 ` [PATCH v2 33/72] scripts/qmp-shell: remove shadowed variable from _print() John Snow
2020-11-04  0:35 ` [PATCH v2 34/72] scripts/qmp-shell: use @classmethod where appropriate John Snow
2020-11-04  0:35 ` [PATCH v2 35/72] scripts/qmp-shell: Use python3-style super() John Snow
2020-11-04  0:35 ` [PATCH v2 36/72] scripts/qmp-shell: declare verbose in __init__ John Snow
2020-11-04  0:35 ` [PATCH v2 37/72] scripts/qmp-shell: use triple-double-quote docstring style John Snow
2020-11-04  0:35 ` [PATCH v2 38/72] scripts/qmp-shell: ignore visit_Name name John Snow
2020-11-04  0:35 ` [PATCH v2 39/72] scripts/qmp-shell: make QMPCompleter returns explicit John Snow
2020-11-04  0:35 ` [PATCH v2 40/72] scripts/qmp-shell: rename one and two-letter variables John Snow
2020-11-04  0:35 ` [PATCH v2 41/72] scripts/qmp-shell: fix shell history exception handling John Snow
2020-11-04  0:35 ` [PATCH v2 42/72] scripts/qmp-shell: explicitly chain exception context John Snow
2020-11-04  0:35 ` [PATCH v2 43/72] scripts/qmp-shell: remove if-raise-else patterns John Snow
2020-11-04  0:35 ` [PATCH v2 44/72] scripts/qmp-shell: use isinstance() instead of type() John Snow
2020-11-04  0:35 ` [PATCH v2 45/72] scripts/qmp-shell: use argparse John Snow
2020-11-04  0:35 ` [PATCH v2 46/72] python/qmp: Fix type of SocketAddrT John Snow
2020-11-04  0:35 ` [PATCH v2 47/72] python/qmp: add parse_address classmethod John Snow
2020-11-04  0:35 ` [PATCH v2 48/72] scripts/qmp-shell: Add pretty attribute to HMP shell John Snow
2020-11-04  0:35 ` [PATCH v2 49/72] scripts/qmp-shell: Make verbose a public attribute John Snow
2020-11-04  0:35 ` [PATCH v2 50/72] scripts/qmp-shell: move get_prompt() to prompt property John Snow
2020-11-04  0:35 ` [PATCH v2 51/72] scripts/qmp-shell: remove prompt argument from read_exec_command John Snow
2020-11-04  0:35 ` [PATCH v2 52/72] scripts/qmp-shell: move the REPL functionality into QMPShell John Snow
2020-11-04  0:35 ` [PATCH v2 53/72] scripts/qmp-shell: Fix "FuzzyJSON" parser John Snow
2020-11-04  0:35 ` [PATCH v2 54/72] scripts/qmp-shell: refactor QMPCompleter John Snow
2020-11-04  0:35 ` [PATCH v2 55/72] scripts/qmp-shell: initialize completer early John Snow
2020-11-04  0:35 ` [PATCH v2 56/72] python/qmp: add QMPObject type alias John Snow
2020-11-04  0:35 ` [PATCH v2 57/72] scripts/qmp-shell: add mypy types John Snow
2020-11-04  0:35 ` [PATCH v2 58/72] scripts/qmp-shell: Accept SocketAddrT instead of string John Snow
2020-11-04  0:35 ` [PATCH v2 59/72] scripts/qmp-shell: unprivatize 'pretty' property John Snow
2020-11-04  0:35 ` [PATCH v2 60/72] python/qmp: return generic type from context manager John Snow
2020-11-04  0:35 ` [PATCH v2 61/72] scripts/qmp-shell: Use context manager instead of atexit John Snow
2020-11-04  0:35 ` [PATCH v2 62/72] scripts/qmp-shell: use logging to show warnings John Snow
2020-11-04  0:35 ` [PATCH v2 63/72] scripts/qmp-shell: remove TODO John Snow
2020-11-04  0:35 ` [PATCH v2 64/72] scripts/qmp-shell: Fix empty-transaction invocation John Snow
2020-11-04  0:35 ` [PATCH v2 65/72] scripts/qmp-shell: Remove too-broad-exception John Snow
2020-11-04  0:35 ` [PATCH v2 66/72] scripts/qmp-shell: convert usage comment to docstring John Snow
2020-11-04  0:35 ` [PATCH v2 67/72] scripts/qmp-shell: remove double-underscores John Snow
2020-11-04  0:35 ` [PATCH v2 68/72] scripts/qmp-shell: make QMPShellError inherit QMPError John Snow
2020-11-04  0:35 ` [PATCH v2 69/72] scripts/qmp-shell: add docstrings John Snow
2020-11-04  0:36 ` [PATCH v2 70/72] scripts/qmp-shell: move to python/qemu/qmp/qmp_shell.py John Snow
2020-11-04  0:36 ` [PATCH v2 71/72] python: add qmp-shell entry point John Snow
2020-11-04  0:36 ` [PATCH v2 72/72] scripts/qmp-shell: add redirection shim John Snow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).