Python: Fork qemu.qmp Python lib into independent repo
cover Python: Fork qemu.qmp Python lib into independent repo
Hi, this series is part of an effort to publish the qemu.qmp package on PyPI. It is the second of three series to complete this work:
(1) Switch the new Async QMP library in to python/qemu/qmp
--> (2) Fork python/qemu/qmp out into its own repository,
with updated GitLab CI/CD targets to build packages.
(3) Update qemu.git to install qemu.qmp from PyPI, and then delete python/qemu/qmp.
This series is not meant to apply to qemu.git, rather -- it's the series that performs the split and would apply to a brand new repository.
I am submitting it to the QEMU mailing list for these reasons:
(1) To more broadly announce my intentions, and as reference alongside series #1 and #3 detailed above.
(2) To ask for permission to become the maintainer of a 'qemu-project/qemu.qmp' repository, where I would like to host this subproject.
(3) To ask for review on the README.rst file which details my intended contribution guidelines for this subproject.
(4) To ask for review on the .gitlab-ci.d/ files and other repo-level CI/CD ephemera, including and especially the docs-building process. I think the generated docs are still ugly, and I'd like to upload them to readthedocs, among other things -- hence the RFC quality of this series.
Some review/RFC notes:
- I use jsnow/qemu.qmp as the repo name throughout the series; that will have to be changed eventually, but for the purposes of prototyping, it was nicer to have a fully working series.
- I'm planning on using gitlab issues and MRs for the subproject.
- I plan to version this lib independently, starting at 0.0.1 for the initial public release and bumping only the micro version for every last release. I plan to bump the minor version once it hits a "beta" state. There will be no cross-versioning against QEMU. I don't plan to publish new releases during QEMU freezes.
- Check out a completed pipeline here:
https://gitlab.com/jsnow/qemu.qmp/-/pipelines/430528258
It offers build artifacts, junit xml artifacts and GitLab test-level-view into the avocado unit tests. The build container is uploaded to GitLab's container registry and can be used to reproduce potential build/packaging errors.
Every pipeline will produce built python packages and upload them to the GitLab package repository, see
https://gitlab.com/jsnow/qemu.qmp/-/packages
Known problems:
- Sphinx output is still subjectively ugly, with too many layers of nesting
- Docs are not yet uploaded anywhere (GitLab pages, readthedocs?)
- Tags on a commit trigger two pipelines; this causes one of the package builds to fail as the version number will be duplicated in this case. Not entirely sure how I want to fix this yet ...
~ Happy Holidays ~, --js.
John Snow (24):
Fork qemu.qmp from qemu.git
Update VERSION to 0.0.0a1
Update maintainer metadata
Update project description
Update project URLs
Move README.rst to INDEX.rst and update
Move PACKAGE.rst to README.rst and update
Update Pipfile.lock
Remove sub-dependency pins from Pipfile
Add build and test container to gitlab CI configuration Add package build step to GitLab CI
GitLab CI: Add check-dco script
GitLab CI: Add pipenv and tox tests
GitLab CI: Add avocado junit XML output to tests GitLab CI: Publish python packages to GitLab package repo Add setuptools_scm package versioning
Makefile: add build and publish targets
add Sphinx documentation config stub
python: configure sphinx
python: adjust apidoc stubs
Fix doc cross-reference regressions
docs: add Makefile target
docs: add doc build to GitLab CI build step v0.0.1
.gitignore | 2 +- .gitlab-ci.d/build.yml | 14 ++ .gitlab-ci.d/check-dco.py | 98 ++++++++++ .gitlab-ci.d/containers.yml | 28 +++ .gitlab-ci.d/index.yml | 14 ++ .gitlab-ci.d/publish.yml | 11 ++ .gitlab-ci.d/python.Dockerfile | 35 ++++ .gitlab-ci.d/test.yml | 74 ++++++++ .gitlab-ci.yml | 3 + INDEX.rst | 64 +++++++ MANIFEST.in | 4 +- Makefile | 54 +++++- PACKAGE.rst | 43 ----- Pipfile | 4 +- Pipfile.lock | 314 ++++++++++++++++++--------------- README.rst | 219 ++++++++++++++--------- VERSION | 1 - avocado.cfg | 7 + docs/Makefile | 20 +++ docs/conf.py | 107 +++++++++++ docs/index.rst | 21 +++ docs/make.bat | 35 ++++ docs/qemu.qmp.error.rst | 8 + docs/qemu.qmp.events.rst | 7 + docs/qemu.qmp.legacy.rst | 7 + docs/qemu.qmp.message.rst | 8 + docs/qemu.qmp.models.rst | 8 + docs/qemu.qmp.protocol.rst | 9 + docs/qemu.qmp.qmp_client.rst | 8 + docs/qemu.qmp.rst | 24 +++ docs/qemu.qmp.util.rst | 8 + qemu/qmp/legacy.py | 4 +- setup.cfg | 41 ++--- setup.py | 13 +- 34 files changed, 1000 insertions(+), 317 deletions(-) create mode 100644 .gitlab-ci.d/build.yml create mode 100755 .gitlab-ci.d/check-dco.py create mode 100644 .gitlab-ci.d/containers.yml create mode 100644 .gitlab-ci.d/index.yml create mode 100644 .gitlab-ci.d/publish.yml create mode 100644 .gitlab-ci.d/python.Dockerfile create mode 100644 .gitlab-ci.d/test.yml create mode 100644 .gitlab-ci.yml create mode 100644 INDEX.rst delete mode 100644 PACKAGE.rst delete mode 100644 VERSION create mode 100644 docs/Makefile create mode 100644 docs/conf.py create mode 100644 docs/index.rst create mode 100644 docs/make.bat create mode 100644 docs/qemu.qmp.error.rst create mode 100644 docs/qemu.qmp.events.rst create mode 100644 docs/qemu.qmp.legacy.rst create mode 100644 docs/qemu.qmp.message.rst create mode 100644 docs/qemu.qmp.models.rst create mode 100644 docs/qemu.qmp.protocol.rst create mode 100644 docs/qemu.qmp.qmp_client.rst create mode 100644 docs/qemu.qmp.rst create mode 100644 docs/qemu.qmp.util.rst
Signature · 1 line
2.31.1
RFC PATCH 1/24 Fork qemu.qmp from qemu.git
Split python/ from qemu.git, using these commands:
Quoted 6 lines
git subtree split -P python/ -b python-split-v2
mkdir ~/src/tmp
cd ~/src/tmp
git clone --no-local --branch python-split-v2 --single-branch ~/src/qemu cd qemu
git filter-repo --path qemu/machine/ \
--path qemu/utils/ \
--path tests/iotests-mypy.sh \
--path tests/iotests-pylint.sh \
--invert-pathsThis commit performs some minimum cleanup to reflect the deletion of the other subpackages. It is not intended to be exhaustive, and further edits are made in forthcoming commits.
--- .gitignore | 2 +- Makefile | 16 ++++++++-------- setup.cfg | 24 +----------------------- setup.py | 2 +- 4 files changed, 11 insertions(+), 33 deletions(-)
.gitignore +1 -1
@@ -5,7 +5,7 @@ # python packaging build/ dist/ -qemu.egg-info/ +qemu.qmp.egg-info/ # editor config .idea/
Makefile +8 -8
@@ -30,7 +30,7 @@ help: @echo "" @echo "make develop:" @echo " Install deps needed for for 'make check'," - @echo " and install the qemu package in editable mode." + @echo " and install the qemu.qmp package in editable mode." @echo " (Can be used in or outside of a venv.)" @echo "" @echo "make pipenv"
@@ -43,7 +43,7 @@ help: @echo " Remove package build output." @echo "" @echo "make distclean:" - @echo " remove pipenv/venv files, qemu package forwarder," + @echo " remove pipenv/venv files, qemu.qmp package forwarder," @echo " built distribution files, and everything from 'make clean'." @echo "" @echo -e "Have a nice day ^_^\n"
@@ -64,11 +64,11 @@ dev-venv: $(QEMU_VENV_DIR) $(QEMU_VENV_DIR)/bin/activate $(QEMU_VENV_DIR) $(QEMU_VENV_DIR)/bin/activate: setup.cfg @echo "VENV $(QEMU_VENV_DIR)" @python3 -m venv $(QEMU_VENV_DIR) - @( \ - echo "ACTIVATE $(QEMU_VENV_DIR)"; \ - . $(QEMU_VENV_DIR)/bin/activate; \ - echo "INSTALL qemu[devel] $(QEMU_VENV_DIR)"; \ - make develop 1>/dev/null; \ + @( \ + echo "ACTIVATE $(QEMU_VENV_DIR)"; \ + . $(QEMU_VENV_DIR)/bin/activate; \ + echo "INSTALL qemu.qmp[devel] $(QEMU_VENV_DIR)"; \ + make develop 1>/dev/null; \ ) @touch $(QEMU_VENV_DIR)
@@ -106,6 +106,6 @@ clean: .PHONY: distclean distclean: clean - rm -rf qemu.egg-info/ .venv/ .tox/ $(QEMU_VENV_DIR) dist/ + rm -rf qemu.qmp.egg-info/ .venv/ .tox/ $(QEMU_VENV_DIR) dist/ rm -f .coverage .coverage.* rm -rf htmlcov/
setup.cfg +1 -23
@@ -1,5 +1,5 @@ [metadata] -name = qemu +name = qemu.qmp version = file:VERSION maintainer = QEMU Developer Team maintainer_email = [email protected]
@@ -25,8 +25,6 @@ classifiers = python_requires = >= 3.6 packages = qemu.qmp - qemu.machine - qemu.utils [options.package_data] * = py.typed
@@ -38,7 +36,6 @@ packages = devel = avocado-framework >= 90.0 flake8 >= 3.6.0 - fusepy >= 2.0.4 isort >= 5.1.2 mypy >= 0.770 pylint >= 2.8.0
@@ -47,10 +44,6 @@ devel = urwid-readline >= 0.13 Pygments >= 2.9.0 -# Provides qom-fuse functionality -fuse = - fusepy >= 2.0.4 - # AQMP TUI dependencies tui = urwid >= 2.1.2
@@ -59,13 +52,6 @@ tui = [options.entry_points] console_scripts = - qom = qemu.utils.qom:main - qom-set = qemu.utils.qom:QOMSet.entry_point - qom-get = qemu.utils.qom:QOMGet.entry_point - qom-list = qemu.utils.qom:QOMList.entry_point - qom-tree = qemu.utils.qom:QOMTree.entry_point - qom-fuse = qemu.utils.qom_fuse:QOMFuse.entry_point [fuse] - qemu-ga-client = qemu.utils.qemu_ga_client:main qmp-shell = qemu.qmp.qmp_shell:main aqmp-tui = qemu.qmp.aqmp_tui:main [tui]
@@ -79,19 +65,12 @@ python_version = 3.6 warn_unused_configs = True namespace_packages = True -[mypy-qemu.utils.qom_fuse] -# fusepy has no type stubs: -allow_subclassing_any = True - [mypy-qemu.qmp.aqmp_tui] # urwid and urwid_readline have no type stubs: allow_subclassing_any = True # The following missing import directives are because these libraries do not # provide type stubs. Allow them on an as-needed basis for mypy. -[mypy-fuse] -ignore_missing_imports = True - [mypy-urwid] ignore_missing_imports = True
@@ -160,7 +139,6 @@ skip_missing_interpreters = true allowlist_externals = make deps = .[devel] - .[fuse] # Workaround to trigger tox venv rebuild .[tui] # Workaround to trigger tox venv rebuild commands = make check
setup.py +1 -1
@@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -QEMU tooling installer script +QEMU QMP library installer script Copyright (c) 2020-2021 John Snow for Red Hat, Inc. """
Signature · 1 line
2.31.1
RFC PATCH 2/24 Update VERSION to 0.0.0a1
In reply to John Snowqemu.qmp will be independently versioned, without regard to QMP version. While the repo is being established here, set the version to something impossibly low.
--- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
VERSION +1 -1
@@ -1 +1 @@ -0.6.1.0a1 +0.0.0a1
Signature · 1 line
2.31.1
RFC PATCH 3/24 Update maintainer metadata
In reply to John SnowI'm the primary author of this particular component; update the metadata accordingly.
--- setup.cfg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
setup.cfg +3 -1
@@ -1,7 +1,9 @@ [metadata] name = qemu.qmp version = file:VERSION -maintainer = QEMU Developer Team +author = John Snow +author_email = [email protected] +maintainer = QEMU Project maintainer_email = [email protected] url = https://www.qemu.org/ download_url = https://www.qemu.org/download/
Signature · 1 line
2.31.1
Re: [RFC qemu.qmp PATCH 03/24] Update maintainer metadata
Quoted 13 lines · John Snow
I'm the primary author of this particular component; update the metadata accordingly.
Signed-off-by John Snow <[email protected]>--- setup.cfg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)setup.cfg +0
-0
setup.cfg line 5
Quoted 6 lines
setup.cfg +2
-1@@ -1,7 +1,9 @@ [metadata] name = qemu.qmp version = file:VERSION -maintainer = QEMU Developer Team +author = John Snow +author_email = [email protected]
Isn't the authorship of this more of a collaborative effort ? IOW, shouldn't it just be "The QEMU Project" as for the maintainer.
setup.cfg line 9
Quoted 4 lines
setup.cfg +1
-0+maintainer = QEMU Project maintainer_email = [email protected] url = https://www.qemu.org/ download_url = https://www.qemu.org/download/
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [RFC qemu.qmp PATCH 03/24] Update maintainer metadata
Quoted 9 lines · Daniel P. Berrangé
Quoted 8 lines · John Snow
I'm the primary author of this particular component; update the metadata accordingly.
Signed-off-by John Snow <[email protected]>--- setup.cfg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 16 lines
setup.cfg line 5
Quoted 11 lines
setup.cfg +2
-1@@ -1,7 +1,9 @@ [metadata] name = qemu.qmp version = file:VERSION -maintainer = QEMU Developer Team +author = John Snow +author_email = [email protected]Isn't the authorship of this more of a collaborative effort ? IOW, shouldn't it just be "The QEMU Project" as for the maintainer.
Sorta. The code in this specific package is > 95% written by me, so I felt the authorship credit here was roughly appropriate. So, I put myself as the "Author" but "QEMU Project" as the "maintainer". I put a lot of work into this, so it felt weird to say that it was authored by a mailing list.
I also wanted to avoid not listing my own name at all, since this has largely been my initiative to polish it up, write docs, and split it out -- it feels rude to just dump responsibility straight back on the list and pretend I'm not the point of contact for it.
Quoted 17 lines
setup.cfg line 9
Quoted 5 lines
setup.cfg +1
-0+maintainer = QEMU Project maintainer_email = [email protected] url = https://www.qemu.org/ download_url = https://www.qemu.org/download/Regards,
Daniel
--
|: https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-
https://fstop138.berrange.com :|
|: https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|
RFC PATCH 4/24 Update project description
In reply to John Snow--- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
setup.cfg +1 -1
@@ -7,7 +7,7 @@ maintainer = QEMU Project maintainer_email = [email protected] url = https://www.qemu.org/ download_url = https://www.qemu.org/download/ -description = QEMU Python Build, Debug and SDK tooling. +description = QEMU Monitor Protocol library. long_description = file:PACKAGE.rst long_description_content_type = text/x-rst classifiers =
Signature · 1 line
2.31.1
RFC PATCH 5/24 Update project URLs
In reply to John SnowPoint to this library's URLs instead of the entire project's.
FIXME: In development, the URLs here are jsnow/qemu.qmp. It is intended that the production version that gets pushed to qemu-project/qemu.qmp will use URLs that reflect that repository appropriately.
--- setup.cfg | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
setup.cfg +4 -2
@@ -5,8 +5,10 @@ author = John Snow author_email = [email protected] maintainer = QEMU Project maintainer_email = [email protected] -url = https://www.qemu.org/ -download_url = https://www.qemu.org/download/ +# NOTE: Remember to update the commit message when changing these URLs. +url = https://gitlab.com/jsnow/qemu.qmp +download_url = https://gitlab.com/jsnow/qemu.qmp/-/packages +# NOTE: Remember to update the commit message when changing these URLs. description = QEMU Monitor Protocol library. long_description = file:PACKAGE.rst long_description_content_type = text/x-rst
Signature · 1 line
2.31.1
RFC PATCH 6/24 Move README.rst to INDEX.rst and update
In reply to John SnowThe intent is to use README.rst as the new package-level readme that will be bundled with the source; so move the old "git level readme" over to INDEX.rst instead, and update it accordingly.
This is primarily here to just document and explain what all the little bits and pieces of files in the root are and what they do. I find this stuff helpful when I wander over into other projects, so I'd like to extend the same courtesy.
--- README.rst => INDEX.rst | 49 +++++++++++------------------------------ MANIFEST.in | 1 - 2 files changed, 13 insertions(+), 37 deletions(-) rename README.rst => INDEX.rst (64%)
INDEX.rst renamed from README.rst +13 -36
@@ -1,9 +1,14 @@ -QEMU Python Tooling +qemu.qmp File Index =================== -This directory houses Python tooling used by the QEMU project to build, -configure, and test QEMU. It is organized by namespace (``qemu``), and -then by package (e.g. ``qemu/machine``, ``qemu/qmp``, etc). +This file is here to explain the purpose of all the little bits and +pieces of project files in the root directory and how they are +used. It's useful info for those contributing to this project, but not +so much for those who just want to use the library. + + +Much ado about packaging +------------------------ ``setup.py`` is used by ``pip`` to install this tooling to the current environment. ``setup.cfg`` provides the packaging configuration used by
@@ -20,7 +25,7 @@ environment. ``setup.cfg`` provides the packaging configuration used by If you append the ``--editable`` or ``-e`` argument to either invocation above, pip will install in "editable" mode. This installs the package as -a forwarder ("qemu.egg-link") that points to the source tree. In so +a forwarder ("qemu.qmp.egg-link") that points to the source tree. In so doing, the installed package always reflects the latest version in your source tree.
@@ -37,34 +42,6 @@ See `Installing packages using pip and virtual environments for more information. -Using these packages without installing them --------------------------------------------- - -These packages may be used without installing them first, by using one -of two tricks: - -1. Set your PYTHONPATH environment variable to include this source - directory, e.g. ``~/src/qemu/python``. See - https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH - -2. Inside a Python script, use ``sys.path`` to forcibly include a search - path prior to importing the ``qemu`` namespace. See - https://docs.python.org/3/library/sys.html#sys.path - -A strong downside to both approaches is that they generally interfere -with static analysis tools being able to locate and analyze the code -being imported. - -Package installation also normally provides executable console scripts, -so that tools like ``qmp-shell`` are always available via $PATH. To -invoke them without installation, you can invoke e.g.: - -``> PYTHONPATH=~/src/qemu/python python3 -m qemu.qmp.qmp_shell`` - -The mappings between console script name and python module path can be -found in ``setup.cfg``. - - Files in this directory -----------------------
@@ -72,6 +49,7 @@ Files in this directory - ``tests/`` Python package tests directory. - ``avocado.cfg`` Configuration for the Avocado test-runner. Used by ``make check`` et al. +- ``INDEX.rst`` you are here! - ``Makefile`` provides some common testing/installation invocations. Try ``make help`` to see available targets. - ``MANIFEST.in`` is read by python setuptools, it specifies additional files
@@ -80,8 +58,7 @@ Files in this directory - ``Pipfile`` is used by Pipenv to generate ``Pipfile.lock``. - ``Pipfile.lock`` is a set of pinned package dependencies that this package is tested under in our CI suite. It is used by ``make check-pipenv``. -- ``README.rst`` you are here! -- ``VERSION`` contains the PEP-440 compliant version used to describe - this package; it is referenced by ``setup.cfg``. - ``setup.cfg`` houses setuptools package configuration. - ``setup.py`` is the setuptools installer used by pip; See above. +- ``VERSION`` contains the PEP-440 compliant version used to describe + this package; it is referenced by ``setup.cfg``.
MANIFEST.in +0 -1
@@ -1,3 +1,2 @@ include VERSION include PACKAGE.rst -exclude README.rst
Signature · 1 line
2.31.1
RFC PATCH 7/24 Move PACKAGE.rst to README.rst and update
In reply to John SnowThe README here will reflect both what is shown on GitLab and on the PyPI landing page. Update it accordingly.
--- INDEX.rst | 2 +- MANIFEST.in | 2 +- PACKAGE.rst | 43 ------------------ README.rst | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 2 +- 5 files changed, 132 insertions(+), 46 deletions(-) delete mode 100644 PACKAGE.rst create mode 100644 README.rst
INDEX.rst +1 -1
@@ -54,10 +54,10 @@ Files in this directory Try ``make help`` to see available targets. - ``MANIFEST.in`` is read by python setuptools, it specifies additional files that should be included by a source distribution. -- ``PACKAGE.rst`` is used as the README file that is visible on PyPI.org. - ``Pipfile`` is used by Pipenv to generate ``Pipfile.lock``. - ``Pipfile.lock`` is a set of pinned package dependencies that this package is tested under in our CI suite. It is used by ``make check-pipenv``. +- ``README.rst`` is used as the README file that is visible on PyPI.org. - ``setup.cfg`` houses setuptools package configuration. - ``setup.py`` is the setuptools installer used by pip; See above. - ``VERSION`` contains the PEP-440 compliant version used to describe
MANIFEST.in +1 -1
@@ -1,2 +1,2 @@ include VERSION -include PACKAGE.rst +include README.rst
PACKAGE.rst deleted +0 -43
43 lines not on this page · raw message
README.rst new file +129 -0
129 lines not on this page · raw message
setup.cfg +1 -1
@@ -10,7 +10,7 @@ url = https://gitlab.com/jsnow/qemu.qmp download_url = https://gitlab.com/jsnow/qemu.qmp/-/packages # NOTE: Remember to update the commit message when changing these URLs. description = QEMU Monitor Protocol library. -long_description = file:PACKAGE.rst +long_description = file:README.rst long_description_content_type = text/x-rst classifiers = Development Status :: 3 - Alpha
Signature · 1 line
2.31.1
RFC PATCH 8/24 Update Pipfile.lock
In reply to John SnowThe name of the package has changed, and the dependencies are different now as well. Re-do the Pipfile.
This is a little annoying, but Python doesn't offer any tool that behaves in a manner that gives you the *oldest* but still adequate versions of dependencies.
So, I'm doing this manually: pin every version at the minimum that still allows the tests to succeed.
Most of these follow from just observing the minimum stated requirements for each package, manually, recursively. However, I observed that toml's stated dependency of >= 0.9.4 in pylint actually needs to be >= 0.10.0.
--- Pipfile | 37 +++++- Pipfile.lock | 314 ++++++++++++++++++++++++++++----------------------- 2 files changed, 210 insertions(+), 141 deletions(-)
Pipfile +35 -2
@@ -4,10 +4,43 @@ url = "https://pypi.org/simple" verify_ssl = true [dev-packages] -qemu = {editable = true, extras = ["devel"], path = "."} +avocado-framework = "==90.0" +isort = "==5.1.2" +tox = "==3.18.0" +toml = "==0.10.0" +six = "==1.14.0" +filelock = "==3.0.0" +virtualenv = "==16.0.0" +py = "==1.4.17" +pluggy = "==0.12.0" +pyparsing = "==2.0.2" +"backports.entry-points-selectable" = "==1.0.4" +platformdirs = "==2.0.0" +distlib = "==0.3.1" +importlib-metadata = "==0.12" +zipp = "==0.5" +pylint = "==2.8.0" +astroid = "==2.5.4" +mccabe = "==0.6" +lazy-object-proxy = "==1.4.0" +wrapt = "==1.11" +flake8 = "==3.6.0" +pycodestyle = "==2.4.0" +pyflakes = "==2.0.0" +mypy = "==0.770" +typed-ast = "==1.4.0" +typing-extensions = "==3.7.4" +mypy-extensions = "==0.4.3" +urwid = "==2.1.2" +urwid-readline = "==0.13" +Pygments = "==2.9.0" +"qemu.qmp" = {editable = true, extras = ["devel"], path = "."} [packages] -qemu = {editable = true,path = "."} +urwid = "==2.1.2" +urwid-readline = "==0.13" +Pygments = "==2.9.0" +"qemu.qmp" = {editable = true, extras = ["tui"], path = "."} [requires] python_version = "3.6"
Pipfile.lock +175 -139
457 lines not on this page · raw message
Signature · 1 line
2.31.1
RFC PATCH 9/24 Remove sub-dependency pins from Pipfile
In reply to John SnowNow that we've got a Pipfile.lock generated that works, we can remove the static pins from the Pipfile to allow various dependencies to be added or removed as necessary when updating our direct dependencies in the future.
So long as --keep-outdated is always passed to Pipenv, items that aren't absolutely necessary to update will not be, which will help keep our requirements more at the very oldest possible versions that still work.
--- Pipfile | 33 --------------------------------- 1 file changed, 33 deletions(-)
Pipfile +0 -33
@@ -4,42 +4,9 @@ url = "https://pypi.org/simple" verify_ssl = true [dev-packages] -avocado-framework = "==90.0" -isort = "==5.1.2" -tox = "==3.18.0" -toml = "==0.10.0" -six = "==1.14.0" -filelock = "==3.0.0" -virtualenv = "==16.0.0" -py = "==1.4.17" -pluggy = "==0.12.0" -pyparsing = "==2.0.2" -"backports.entry-points-selectable" = "==1.0.4" -platformdirs = "==2.0.0" -distlib = "==0.3.1" -importlib-metadata = "==0.12" -zipp = "==0.5" -pylint = "==2.8.0" -astroid = "==2.5.4" -mccabe = "==0.6" -lazy-object-proxy = "==1.4.0" -wrapt = "==1.11" -flake8 = "==3.6.0" -pycodestyle = "==2.4.0" -pyflakes = "==2.0.0" -mypy = "==0.770" -typed-ast = "==1.4.0" -typing-extensions = "==3.7.4" -mypy-extensions = "==0.4.3" -urwid = "==2.1.2" -urwid-readline = "==0.13" -Pygments = "==2.9.0" "qemu.qmp" = {editable = true, extras = ["devel"], path = "."} [packages] -urwid = "==2.1.2" -urwid-readline = "==0.13" -Pygments = "==2.9.0" "qemu.qmp" = {editable = true, extras = ["tui"], path = "."} [requires]
Signature · 1 line
2.31.1
RFC PATCH 10/24 Add build and test container to gitlab CI configuration
In reply to John SnowHeavily copy-pasted from the QEMU source tree, with bits and pieces not needed for this repository trimmed down.
--- .gitlab-ci.d/containers.yml | 28 ++++++++++++++++++++++++++++ .gitlab-ci.d/index.yml | 8 ++++++++ .gitlab-ci.d/python.Dockerfile | 31 +++++++++++++++++++++++++++++++ .gitlab-ci.yml | 3 +++ INDEX.rst | 2 ++ 5 files changed, 72 insertions(+) create mode 100644 .gitlab-ci.d/containers.yml create mode 100644 .gitlab-ci.d/index.yml create mode 100644 .gitlab-ci.d/python.Dockerfile create mode 100644 .gitlab-ci.yml
.gitlab-ci.d/containers.yml new file +28 -0
@@ -0,0 +1,28 @@ +# Heavily inspired-by/copy-pasted-from the +# container template from the QEMU source tree. + +.container_job_template: + image: docker:stable + stage: containers + services: + - docker:dind + before_script: + - export TAG="$NAME" + - export FQTAG="$CI_REGISTRY_IMAGE/$TAG:latest" + - docker info + - docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" + script: + - echo "TAG:$TAG" + - echo "FQTAG:$FQTAG" + - cd .gitlab-ci.d + - docker pull "$FQTAG" + - docker build --cache-from "$FQTAG" -t "$TAG" -f "$NAME.Dockerfile" . + - docker tag "$TAG" "$FQTAG" + - docker push "$FQTAG" + after_script: + - docker logout + +python-container: + extends: .container_job_template + variables: + NAME: python
.gitlab-ci.d/index.yml new file +8 -0
@@ -0,0 +1,8 @@ +# This file contains the set of jobs run by this project: +# https://gitlab.com/jsnow/qemu.qmp/-/pipelines + +stages: + - containers + +include: + - local: '/.gitlab-ci.d/containers.yml'
.gitlab-ci.d/python.Dockerfile new file +31 -0
@@ -0,0 +1,31 @@ +# Python library build & testing environment. + +# Fedora is convenient, as it allows us to easily access multiple +# versions of the python interpreter, which is great for tox testing. +FROM fedora:latest + +# 「はじめまして!」 +MAINTAINER John Snow <[email protected]> + +# Please keep the packages sorted alphabetically. +RUN dnf --setopt=install_weak_deps=False install -y \ + gcc \ + git \ + make \ + pipenv \ + python3 \ + python3-pip \ + python3-tox \ + python3-virtualenv \ + python3.10 \ + python3.6 \ + python3.7 \ + python3.8 \ + python3.9 \ + && python3 -m pip install --upgrade \ + build \ + pip \ + && dnf clean all \ + && rm -rf ~/.cache/pip \ + && rm -rf /var/cache/dnf \ + ;
.gitlab-ci.yml new file +3 -0
@@ -0,0 +1,3 @@ +# Hello, is it me you're looking for? +include: + - local: '/.gitlab-ci.d/index.yml'
INDEX.rst +2 -0
@@ -47,6 +47,8 @@ Files in this directory - ``qemu/`` Python 'qemu' namespace package source directory. - ``tests/`` Python package tests directory. +- ``.gitlab-ci.d/`` Files used for GitLab CI configuration. +- ``.gitlab-ci.yml`` Primary GitLab CI configuration file. - ``avocado.cfg`` Configuration for the Avocado test-runner. Used by ``make check`` et al. - ``INDEX.rst`` you are here!
Signature · 1 line
2.31.1
RFC PATCH 11/24 Add package build step to GitLab CI
In reply to John Snow--- .gitlab-ci.d/build.yml | 13 +++++++++++++ .gitlab-ci.d/index.yml | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 .gitlab-ci.d/build.yml
.gitlab-ci.d/build.yml new file +13 -0
@@ -0,0 +1,13 @@ +build-package: + stage: build + image: $CI_REGISTRY_IMAGE/python:latest + needs: + job: python-container + script: + - python3 -m build + artifacts: + name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA" + paths: + - dist/* + variables: + GIT_DEPTH: 1
.gitlab-ci.d/index.yml +2 -0
@@ -3,6 +3,8 @@ stages: - containers + - build include: - local: '/.gitlab-ci.d/containers.yml' + - local: '/.gitlab-ci.d/build.yml'
Signature · 1 line
2.31.1
RFC PATCH 12/24 GitLab CI: Add check-dco script
In reply to John SnowBorrowed with minor modifications from qemu.git.
--- .gitlab-ci.d/check-dco.py | 98 +++++++++++++++++++++++++++++++++++++++ .gitlab-ci.d/index.yml | 2 + .gitlab-ci.d/test.yml | 15 ++++++ 3 files changed, 115 insertions(+) create mode 100755 .gitlab-ci.d/check-dco.py create mode 100644 .gitlab-ci.d/test.yml
.gitlab-ci.d/check-dco.py new file +98 -0
@@ -0,0 +1,98 @@ +#!/usr/bin/env python3 +# +# check-dco.py: validate all commits are signed off +# +# Copyright (C) 2020 Red Hat, Inc. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import argparse +import os +import os.path +import sys +import subprocess + +parser = argparse.ArgumentParser("check-dco") +parser.add_argument( + "repourl", + help="upstream repo URL" +) +parser.add_argument( + "refspec", + help="upstream's default branch (or other refspec)" +) +args = parser.parse_args() + + +subprocess.check_call(["git", "remote", "add", "check-dco", args.repourl]) +subprocess.check_call(["git", "fetch", "check-dco", args.refspec], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL) + +ancestor = subprocess.check_output( + ["git", "merge-base", f"check-dco/{args.refspec}", "HEAD"], + universal_newlines=True) +ancestor = ancestor.strip() + +subprocess.check_call(["git", "remote", "rm", "check-dco"]) + +errors = False + +print("\nChecking for 'Signed-off-by: NAME <EMAIL>' " + + "on all commits since %s...\n" % ancestor) + +log = subprocess.check_output(["git", "log", "--format=%H %s", + ancestor + "..."], + universal_newlines=True) + +if log == "": + commits = [] +else: + commits = [[c[0:40], c[41:]] for c in log.strip().split("\n")] + +for sha, subject in commits: + + msg = subprocess.check_output(["git", "show", "-s", sha], + universal_newlines=True) + lines = msg.strip().split("\n") + + print("🔍 %s %s" % (sha, subject)) + sob = False + for line in lines: + if "Signed-off-by:" in line: + sob = True + if "localhost" in line: + print(" ❌ FAIL: bad email in %s" % line) + errors = True + + if not sob: + print(" ❌ FAIL missing Signed-off-by tag") + errors = True + +if errors: + print(""" + +❌ ERROR: One or more commits are missing a valid Signed-off-By tag. + + +This project requires all contributors to assert that their contributions +are provided in compliance with the terms of the Developer's Certificate +of Origin 1.1 (DCO): + + https://developercertificate.org/ + +To indicate acceptance of the DCO every commit must have a tag + + Signed-off-by: REAL NAME <EMAIL> + +This can be achieved by passing the "-s" flag to the "git commit" command. + +To bulk update all commits on current branch "git rebase" can be used: + + git rebase -i master -x 'git commit --amend --no-edit -s' + +""") + + sys.exit(1) + +sys.exit(0)
.gitlab-ci.d/index.yml +2 -0
@@ -4,7 +4,9 @@ stages: - containers - build + - test include: - local: '/.gitlab-ci.d/containers.yml' - local: '/.gitlab-ci.d/build.yml' + - local: '/.gitlab-ci.d/test.yml'
.gitlab-ci.d/test.yml new file +15 -0
@@ -0,0 +1,15 @@ +check-dco: + stage: test + image: $CI_REGISTRY_IMAGE/python:latest + needs: + job: python-container + script: + - .gitlab-ci.d/check-dco.py + "https://gitlab.com/jsnow/qemu.qmp.git" + "main" + variables: + GIT_DEPTH: 1000 + rules: + - if: '$CI_PROJECT_NAMESPACE == "jsnow" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + when: never + - when: on_success
Signature · 1 line
2.31.1
RFC PATCH 13/24 GitLab CI: Add pipenv and tox tests
In reply to John SnowFIXME: For testing purposes, this patch is still using my personal GitLab URLs, which will have to be changed before this is pushed to production.
--- .gitlab-ci.d/test.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
.gitlab-ci.d/test.yml +43 -0
@@ -13,3 +13,46 @@ check-dco: - if: '$CI_PROJECT_NAMESPACE == "jsnow" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' when: never - when: on_success + +.python_test: + stage: test + image: $CI_REGISTRY_IMAGE/python:latest + variables: + GIT_DEPTH: 1 + needs: + job: python-container + +check-python-pipenv: + extends: .python_test + script: + - make check-pipenv + +check-python-36: + extends: .python_test + script: + - QEMU_TOX_EXTRA_ARGS="-e py36" make check-tox + allow_failure: true + +check-python-37: + extends: .python_test + script: + - QEMU_TOX_EXTRA_ARGS="-e py37" make check-tox + allow_failure: true + +check-python-38: + extends: .python_test + script: + - QEMU_TOX_EXTRA_ARGS="-e py38" make check-tox + allow_failure: true + +check-python-39: + extends: .python_test + script: + - QEMU_TOX_EXTRA_ARGS="-e py39" make check-tox + allow_failure: true + +check-python-310: + extends: .python_test + script: + - QEMU_TOX_EXTRA_ARGS="-e py310" make check-tox + allow_failure: true
Signature · 1 line
2.31.1
RFC PATCH 14/24 GitLab CI: Add avocado junit XML output to tests
In reply to John Snow--- .gitlab-ci.d/test.yml | 16 ++++++++++++++++ Makefile | 1 + avocado.cfg | 7 +++++++ 3 files changed, 24 insertions(+)
.gitlab-ci.d/test.yml +16 -0
@@ -14,7 +14,23 @@ check-dco: when: never - when: on_success +.avocado: + before_script: + - echo "" >> avocado.cfg + - echo "[datadir.paths]" >> avocado.cfg + - echo "logs_dir = ./test-results/" >> avocado.cfg + artifacts: + name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA" + when: always + expire_in: 7 days + paths: + - test-results/latest/results.xml + - test-results/latest/test-results + reports: + junit: test-results/latest/results.xml + .python_test: + extends: .avocado stage: test image: $CI_REGISTRY_IMAGE/python:latest variables:
Makefile +1 -0
@@ -109,3 +109,4 @@ distclean: clean rm -rf qemu.qmp.egg-info/ .venv/ .tox/ $(QEMU_VENV_DIR) dist/ rm -f .coverage .coverage.* rm -rf htmlcov/ + rm -rf test-results/
avocado.cfg +7 -0
@@ -11,3 +11,10 @@ output.testlogs.logfiles = ['stdout', 'stderr'] # Show full stdout/stderr only on tests that FAIL output.testlogs.statuses = ['FAIL'] + +# NOTE: Various gitlab CI jobs will append configuration +# similar to the following, in order to keep test output +# inside of the project root: +# +# [datadir.paths] +# logs_dir = ./test-results/
Signature · 1 line
2.31.1
RFC PATCH 15/24 GitLab CI: Publish python packages to GitLab package repo
In reply to John Snow--- .gitlab-ci.d/index.yml | 2 ++ .gitlab-ci.d/publish.yml | 11 +++++++++++ .gitlab-ci.d/python.Dockerfile | 1 + 3 files changed, 14 insertions(+) create mode 100644 .gitlab-ci.d/publish.yml
.gitlab-ci.d/index.yml +2 -0
@@ -5,8 +5,10 @@ stages: - containers - build - test + - publish include: - local: '/.gitlab-ci.d/containers.yml' - local: '/.gitlab-ci.d/build.yml' - local: '/.gitlab-ci.d/test.yml' + - local: '/.gitlab-ci.d/publish.yml'
.gitlab-ci.d/publish.yml new file +11 -0
@@ -0,0 +1,11 @@ +publish-package: + stage: publish + image: $CI_REGISTRY_IMAGE/python:latest + needs: + job: build-package + script: + - TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token + python3 -m twine upload + --verbose + --repository-url "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi" + dist/*
.gitlab-ci.d/python.Dockerfile +1 -0
@@ -25,6 +25,7 @@ RUN dnf --setopt=install_weak_deps=False install -y \ && python3 -m pip install --upgrade \ build \ pip \ + twine \ && dnf clean all \ && rm -rf ~/.cache/pip \ && rm -rf /var/cache/dnf \
Signature · 1 line
2.31.1
RFC PATCH 16/24 Add setuptools_scm package versioning
In reply to John SnowThe version number will now be generated using the setuptools_scm package, which pulls the version number from git tags.
As PEP660 is not yet usable with pyproject.toml style packages, we will be sticking to setup.py style installation for now.
"version = 0.0.0" exists as a fallback in the event that the build/installation environment does not have setuptools_scm installed. Further, if setuptools_scm *is* installed but we are trying to install directly from a source tarball (instead of from a python source distribution), 'fallback_version': '0.0.0' will be utilized as the fallback.
Lastly, tag this release as v0.0.0 to give setuptools_scm something to work with and establish precedent for future releases.
--- .gitlab-ci.d/build.yml | 2 +- .gitlab-ci.d/python.Dockerfile | 1 + INDEX.rst | 2 -- MANIFEST.in | 1 - VERSION | 1 - setup.cfg | 3 ++- setup.py | 11 ++++++++++- 7 files changed, 14 insertions(+), 7 deletions(-) delete mode 100644 VERSION
.gitlab-ci.d/build.yml +1 -1
@@ -10,4 +10,4 @@ build-package: paths: - dist/* variables: - GIT_DEPTH: 1 + GIT_DEPTH: 0
.gitlab-ci.d/python.Dockerfile +1 -0
@@ -25,6 +25,7 @@ RUN dnf --setopt=install_weak_deps=False install -y \ && python3 -m pip install --upgrade \ build \ pip \ + setuptools_scm \ twine \ && dnf clean all \ && rm -rf ~/.cache/pip \
INDEX.rst +0 -2
@@ -62,5 +62,3 @@ Files in this directory - ``README.rst`` is used as the README file that is visible on PyPI.org. - ``setup.cfg`` houses setuptools package configuration. - ``setup.py`` is the setuptools installer used by pip; See above. -- ``VERSION`` contains the PEP-440 compliant version used to describe - this package; it is referenced by ``setup.cfg``.
MANIFEST.in +0 -1
@@ -1,2 +1 @@ -include VERSION include README.rst
VERSION deleted +0 -1
@@ -1 +0,0 @@ -0.0.0a1
setup.cfg +2 -1
@@ -1,6 +1,6 @@ [metadata] name = qemu.qmp -version = file:VERSION +version = 0.0.0 author = John Snow author_email = [email protected] maintainer = QEMU Project
@@ -26,6 +26,7 @@ classifiers = Typing :: Typed [options] +setup_requires = setuptools_scm python_requires = >= 3.6 packages = qemu.qmp
setup.py +10 -1
@@ -7,6 +7,12 @@ Copyright (c) 2020-2021 John Snow for Red Hat, Inc. import setuptools import pkg_resources +try: + import setuptools_scm + _HAVE_SCM = True +except ModuleNotFoundError: + _HAVE_SCM = False + def main(): """
@@ -16,7 +22,10 @@ def main(): # https://medium.com/@daveshawley/safely-using-setup-cfg-for-metadata-1babbe54c108 pkg_resources.require('setuptools>=39.2') - setuptools.setup() + if _HAVE_SCM: + setuptools.setup(use_scm_version={'fallback_version': '0.0.0'}) + else: + setuptools.setup() if __name__ == '__main__':
Signature · 1 line
2.31.1
RFC PATCH 17/24 Makefile: add build and publish targets
In reply to John Snow--- Makefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
Makefile +32 -0
@@ -110,3 +110,35 @@ distclean: clean rm -f .coverage .coverage.* rm -rf htmlcov/ rm -rf test-results/ + +.PHONY: pristine +pristine: + @git diff-files --quiet --ignore-submodules -- || \ + (echo "You have unstaged changes."; exit 1) + @git diff-index --cached --quiet HEAD --ignore-submodules -- || \ + (echo "Your index contains uncommitted changes."; exit 1) + @[ -z "$(shell git ls-files -o)" ] || \ + (echo "You have untracked files: $(shell git ls-files -o)"; exit 1) + +dist: setup.cfg setup.py Makefile README.rst + python3 -m build + @touch dist + +.PHONY: pre-publish +pre-publish: pristine dist + @git describe --exact-match 2>/dev/null || \ + (echo -e "\033[0;31mThere is no annotated tag for this commit.\033[0m"; exit 1) + python3 -m twine check --strict dist/* + git push -v --atomic --follow-tags --dry-run + +.PHONY: publish +publish: pre-publish + # Set the username via TWINE_USERNAME. + # Set the password via TWINE_PASSWORD. + # Set the pkg repository via TWINE_REPOSITORY. + python3 -m twine upload --verbose dist/* + git push -v --atomic --follow-tags + +.PHONY: publish-test +publish-test: pre-publish + python3 -m twine upload --verbose -r testpypi dist/*
Signature · 1 line
2.31.1
Re: [RFC qemu.qmp PATCH 17/24] Makefile: add build and publish targets
Quoted 35 lines · John Snow
Signed-off-by John Snow <[email protected]>--- Makefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)Makefile +22
-0@@ -110,3 +110,35 @@ distclean: clean rm -f .coverage .coverage.* rm -rf htmlcov/ rm -rf test-results/ + +.PHONY: pristine +pristine: + @git diff-files --quiet --ignore-submodules -- || \ + (echo "You have unstaged changes."; exit 1) + @git diff-index --cached --quiet HEAD --ignore-submodules -- || \ + (echo "Your index contains uncommitted changes."; exit 1) + @[ -z "$(shell git ls-files -o)" ] || \ + (echo "You have untracked files: $(shell git ls-files -o)"; exit 1) + +dist: setup.cfg setup.py Makefile README.rst + python3 -m build + @touch dist + +.PHONY: pre-publish +pre-publish: pristine dist + @git describe --exact-match 2>/dev/null || \ + (echo -e "\033[0;31mThere is no annotated tag for this commit.\033[0m"; exit 1) + python3 -m twine check --strict dist/* + git push -v --atomic --follow-tags --dry-run + +.PHONY: publish
Makefile distclean: clean · line 144
Quoted 10 lines
Makefile +10
-0+publish: pre-publish + # Set the username via TWINE_USERNAME. + # Set the password via TWINE_PASSWORD. + # Set the pkg repository via TWINE_REPOSITORY. + python3 -m twine upload --verbose dist/* + git push -v --atomic --follow-tags + +.PHONY: publish-test +publish-test: pre-publish + python3 -m twine upload --verbose -r testpypi dist/*
It doesn't feel very pythonic to have a makefile in the project.
If we want some helpers for publishing releases, I would have expected to see a python script eg scripts/publish.py
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [RFC qemu.qmp PATCH 17/24] Makefile: add build and publish targets
Quoted 51 lines · Daniel P. Berrangé
Quoted 12 lines · John Snow
Signed-off-by John Snow <[email protected]>--- Makefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)Makefile +0
-0@@ -110,3 +110,35 @@ distclean: clean rm -f .coverage .coverage.* rm -rf htmlcov/Makefile distclean: clean · line 121
Quoted 10 lines
Makefile +9
-0rm -rf test-results/ + +.PHONY: pristine +pristine: + @git diff-files --quiet --ignore-submodules -- || \ + (echo "You have unstaged changes."; exit 1) + @git diff-index --cached --quiet HEAD --ignore-submodules -- || \ + (echo "Your index contains uncommitted changes."; exit 1) + @[ -z "$(shell git ls-files -o)" ] || \ + (echo "You have untracked files: $(shell git ls-files-o)"; exit 1)
Makefile distclean: clean
Quoted 9 lines
Makefile +9
-0+ +dist: setup.cfg setup.py Makefile README.rst + python3 -m build + @touch dist + +.PHONY: pre-publish +pre-publish: pristine dist + @git describe --exact-match 2>/dev/null || \ + (echo -e "\033[0;31mThere is no annotated tag for thiscommit.\033[0m"; exit 1)
Quoted 4 lines
Makefile +4
-0+ python3 -m twine check --strict dist/* + git push -v --atomic --follow-tags --dry-run + +.PHONY: publishMakefile distclean: clean · line 144
Quoted 10 lines
Makefile +10
-0+publish: pre-publish + # Set the username via TWINE_USERNAME. + # Set the password via TWINE_PASSWORD. + # Set the pkg repository via TWINE_REPOSITORY. + python3 -m twine upload --verbose dist/* + git push -v --atomic --follow-tags + +.PHONY: publish-test +publish-test: pre-publish + python3 -m twine upload --verbose -r testpypi dist/*It doesn't feel very pythonic to have a makefile in the project.
Quoted 4 lines
If we want some helpers for publishing releases, I would have expected to see a python script eg
scripts/publish.py
Eh, Python folks use Makefiles too. I've been using these little Makefile targets for hobby things for a while and I had them laying around and ready to go. I have no strong need to "upgrade" to python scripts for these right now, unless there's some extra features you want to see.
--js
Re: [RFC qemu.qmp PATCH 17/24] Makefile: add build and publish targets
Quoted 54 lines · John Snow
Quoted 51 lines · Daniel P. Berrangé
Quoted 12 lines · John Snow
Signed-off-by John Snow <[email protected]>--- Makefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)Makefile +0
-0@@ -110,3 +110,35 @@ distclean: clean rm -f .coverage .coverage.* rm -rf htmlcov/Makefile distclean: clean · line 121
Quoted 10 lines
Makefile +9
-0rm -rf test-results/ + +.PHONY: pristine +pristine: + @git diff-files --quiet --ignore-submodules -- || \ + (echo "You have unstaged changes."; exit 1) + @git diff-index --cached --quiet HEAD --ignore-submodules -- || \ + (echo "Your index contains uncommitted changes."; exit 1) + @[ -z "$(shell git ls-files -o)" ] || \ + (echo "You have untracked files: $(shell git ls-files-o)"; exit 1)
Makefile distclean: clean
Quoted 9 lines
Makefile +9
-0+ +dist: setup.cfg setup.py Makefile README.rst + python3 -m build + @touch dist + +.PHONY: pre-publish +pre-publish: pristine dist + @git describe --exact-match 2>/dev/null || \ + (echo -e "\033[0;31mThere is no annotated tag for thiscommit.\033[0m"; exit 1)
Quoted 4 lines
Makefile +4
-0+ python3 -m twine check --strict dist/* + git push -v --atomic --follow-tags --dry-run + +.PHONY: publishMakefile distclean: clean · line 144
Quoted 10 lines
Makefile +10
-0+publish: pre-publish + # Set the username via TWINE_USERNAME. + # Set the password via TWINE_PASSWORD. + # Set the pkg repository via TWINE_REPOSITORY. + python3 -m twine upload --verbose dist/* + git push -v --atomic --follow-tags + +.PHONY: publish-test +publish-test: pre-publish + python3 -m twine upload --verbose -r testpypi dist/*It doesn't feel very pythonic to have a makefile in the project.
Quoted 8 lines
Quoted 4 lines
If we want some helpers for publishing releases, I would have expected to see a python script eg
scripts/publish.pyEh, Python folks use Makefiles too. I've been using these little
Makefiletargets for hobby things for a while and I had them laying around and ready to go. I have no strong need to "upgrade" to python scripts for these right now, unless there's some extra features you want to see.
Using make means you have to worry about portability across different impls of make and different impls of shell. Using python means your python project is portable to anywhere that python runs.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [RFC qemu.qmp PATCH 17/24] Makefile: add build and publish targets
Quoted 63 lines · Daniel P. Berrangé
Quoted 9 lines · John Snow
Quoted 6 lines · Daniel P. Berrangé
Quoted 5 lines · John Snow
Signed-off-by John Snow <[email protected]>--- Makefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Makefile +0
-0@@ -110,3 +110,35 @@ distclean: clean rm -f .coverage .coverage.*Quoted 8 lines
Makefile distclean: clean
Quoted 8 lines
Makefile +6
-0rm -rf htmlcov/ rm -rf test-results/ + +.PHONY: pristine +pristine: + @git diff-files --quiet --ignore-submodules -- || \ + (echo "You have unstaged changes."; exit 1) + @git diff-index --cached --quiet HEAD --ignore-submodules --|| \ > > > + (echo "Your index contains uncommitted changes."; exit1)
Quoted 30 lines
Quoted 30 lines
Makefile distclean: clean · line 120
Quoted 2 lines
Makefile +2
-0+ @[ -z "$(shell git ls-files -o)" ] || \ + (echo "You have untracked files: $(shell git ls-files-o)"; exit 1)
Makefile distclean: clean
Quoted 9 lines
Makefile +9
-0+ +dist: setup.cfg setup.py Makefile README.rst + python3 -m build + @touch dist + +.PHONY: pre-publish +pre-publish: pristine dist + @git describe --exact-match 2>/dev/null || \ + (echo -e "\033[0;31mThere is no annotated tag for thiscommit.\033[0m"; exit 1)
Quoted 4 lines
Makefile +4
-0+ python3 -m twine check --strict dist/* + git push -v --atomic --follow-tags --dry-run + +.PHONY: publishMakefile distclean: clean · line 144
Quoted 10 lines
Makefile +10
-0+publish: pre-publish + # Set the username via TWINE_USERNAME. + # Set the password via TWINE_PASSWORD. + # Set the pkg repository via TWINE_REPOSITORY. + python3 -m twine upload --verbose dist/* + git push -v --atomic --follow-tags + +.PHONY: publish-test +publish-test: pre-publish + python3 -m twine upload --verbose -r testpypi dist/*It doesn't feel very pythonic to have a makefile in the project.
Quoted 6 lines
Quoted 4 lines
If we want some helpers for publishing releases, I would have expected to see a python script eg
scripts/publish.pyEh, Python folks use Makefiles too. I've been using these little
Makefiletargets for hobby things for a while and I had them laying around and
Quoted 8 lines
ready
Quoted 1 line
to go. I have no strong need to "upgrade" to python scripts for these
right
Quoted 1 line
now, unless there's some extra features you want to see.
Using make means you have to worry about portability across different impls of make and different impls of shell. Using python means your python project is portable to anywhere that python runs.
I still like the idea of using a Makefile as a "canonical menu of things you can do in this directory", but there's probably room for interactive error checking and so on with the TWINE_USERNAME / TWINE_PASSWORD / TWINE_REPOSITORY environment variables in a python script. I'll look into it as a follow-up, if that's fine. (I'm worried it's a lot of polish and effort on a maintainers-only interface that only I will likely use for at least the next year or two.)
Ultimately, what's likely to happen here is that I will generate some oauth tokens with publish permissions and a hypothetical user would set e.g. TWINE_USERNAME to "__token__", and the password would be "pypi-tokengoeshere". Using the "keyring" python package, we could attempt to fetch stored values from a session keyring, falling back to an interactive prompt if they're unset.
--js
Re: [RFC qemu.qmp PATCH 17/24] Makefile: add build and publish targets
Quoted 84 lines · John Snow
Quoted 63 lines · Daniel P. Berrangé
Quoted 9 lines · John Snow
Quoted 6 lines · Daniel P. Berrangé
Quoted 5 lines · John Snow
Signed-off-by John Snow <[email protected]>--- Makefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Makefile +0
-0@@ -110,3 +110,35 @@ distclean: clean rm -f .coverage .coverage.*Quoted 8 lines
Makefile distclean: clean
Quoted 8 lines
Makefile +6
-0rm -rf htmlcov/ rm -rf test-results/ + +.PHONY: pristine +pristine: + @git diff-files --quiet --ignore-submodules -- || \ + (echo "You have unstaged changes."; exit 1) + @git diff-index --cached --quiet HEAD --ignore-submodules --|| \ > > > + (echo "Your index contains uncommitted changes."; exit1)
Quoted 30 lines
Quoted 30 lines
Makefile distclean: clean · line 120
Quoted 2 lines
Makefile +2
-0+ @[ -z "$(shell git ls-files -o)" ] || \ + (echo "You have untracked files: $(shell git ls-files-o)"; exit 1)
Makefile distclean: clean
Quoted 9 lines
Makefile +9
-0+ +dist: setup.cfg setup.py Makefile README.rst + python3 -m build + @touch dist + +.PHONY: pre-publish +pre-publish: pristine dist + @git describe --exact-match 2>/dev/null || \ + (echo -e "\033[0;31mThere is no annotated tag for thiscommit.\033[0m"; exit 1)
Quoted 4 lines
Makefile +4
-0+ python3 -m twine check --strict dist/* + git push -v --atomic --follow-tags --dry-run + +.PHONY: publishMakefile distclean: clean · line 144
Quoted 10 lines
Makefile +10
-0+publish: pre-publish + # Set the username via TWINE_USERNAME. + # Set the password via TWINE_PASSWORD. + # Set the pkg repository via TWINE_REPOSITORY. + python3 -m twine upload --verbose dist/* + git push -v --atomic --follow-tags + +.PHONY: publish-test +publish-test: pre-publish + python3 -m twine upload --verbose -r testpypi dist/*It doesn't feel very pythonic to have a makefile in the project.
Quoted 6 lines
Quoted 4 lines
If we want some helpers for publishing releases, I would have expected to see a python script eg
scripts/publish.pyEh, Python folks use Makefiles too. I've been using these little
Makefiletargets for hobby things for a while and I had them laying around andQuoted 8 lines
ready
Quoted 1 line
to go. I have no strong need to "upgrade" to python scripts for these
right
Quoted 1 line
now, unless there's some extra features you want to see.
Using make means you have to worry about portability across different impls of make and different impls of shell. Using python means your python project is portable to anywhere that python runs.
I still like the idea of using a
Makefileas a "canonical menu of things you can do in this directory", but there's probably room for interactive error checking and so on with theTWINE_USERNAME/TWINE_PASSWORD/TWINE_REPOSITORYenvironment variables in a python script. I'll look into it as a follow-up, if that's fine. (I'm worried it's a lot of polish and effort on a maintainers-only interface that only I will likely use for at least the next year or two.)
Quoted 6 lines
Ultimately, what's likely to happen here is that I will generate some oauth tokens with publish permissions and a hypothetical user would set e.g.
TWINE_USERNAMEto "__token__", and the password would be "pypi-tokengoeshere". Using the "keyring" python package, we could attempt to fetch stored values from a session keyring, falling back to an interactive prompt if they're unset.
FWIW, don't consider this original comment of mine to be a technical blocker, rather it is more of a conceptual observation. If you don't think it matters, I won't mind.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [RFC qemu.qmp PATCH 17/24] Makefile: add build and publish targets
Quoted 93 lines · Daniel P. Berrangé
Quoted 84 lines · John Snow
Quoted 63 lines · Daniel P. Berrangé
Quoted 9 lines · John Snow
Quoted 6 lines · Daniel P. Berrangé
Quoted 5 lines · John Snow
Signed-off-by John Snow <[email protected]>--- Makefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Makefile +0
-0@@ -110,3 +110,35 @@ distclean: clean rm -f .coverage .coverage.*Quoted 8 lines
Makefile distclean: clean
Quoted 8 lines
Makefile +6
-0rm -rf htmlcov/ rm -rf test-results/ + +.PHONY: pristine +pristine: + @git diff-files --quiet --ignore-submodules -- || \ + (echo "You have unstaged changes."; exit 1) + @git diff-index --cached --quiet HEAD --ignore-submodules --|| \ > > > + (echo "Your index contains uncommitted changes."; exit1)
Quoted 30 lines
Quoted 30 lines
Makefile distclean: clean · line 120
Quoted 2 lines
Makefile +2
-0+ @[ -z "$(shell git ls-files -o)" ] || \ + (echo "You have untracked files: $(shell git ls-files-o)"; exit 1)
Makefile distclean: clean
Quoted 9 lines
Makefile +9
-0+ +dist: setup.cfg setup.py Makefile README.rst + python3 -m build + @touch dist + +.PHONY: pre-publish +pre-publish: pristine dist + @git describe --exact-match 2>/dev/null || \ + (echo -e "\033[0;31mThere is no annotated tag for thiscommit.\033[0m"; exit 1)
Quoted 4 lines
Makefile +4
-0+ python3 -m twine check --strict dist/* + git push -v --atomic --follow-tags --dry-run + +.PHONY: publishMakefile distclean: clean · line 144
Quoted 10 lines
Makefile +10
-0+publish: pre-publish + # Set the username via TWINE_USERNAME. + # Set the password via TWINE_PASSWORD. + # Set the pkg repository via TWINE_REPOSITORY. + python3 -m twine upload --verbose dist/* + git push -v --atomic --follow-tags + +.PHONY: publish-test +publish-test: pre-publish + python3 -m twine upload --verbose -r testpypi dist/*It doesn't feel very pythonic to have a makefile in the project.
Quoted 6 lines
Quoted 4 lines
If we want some helpers for publishing releases, I would have expected to see a python script eg
scripts/publish.pyEh, Python folks use Makefiles too. I've been using these little
Makefiletargets for hobby things for a while and I had them laying around andQuoted 8 lines
ready
Quoted 1 line
to go. I have no strong need to "upgrade" to python scripts for these
right
Quoted 1 line
now, unless there's some extra features you want to see.
Using make means you have to worry about portability across different impls of make and different impls of shell. Using python means your python project is portable to anywhere that python runs.
I still like the idea of using a
Makefileas a "canonical menu of things you can do in this directory", but there's probably room for interactive error checking and so on with theTWINE_USERNAME/TWINE_PASSWORD/TWINE_REPOSITORYenvironment variables in a python script. I'll look into it as a follow-up, if that's fine. (I'm worried it's a lot of polish and effort on a maintainers-only interface that only I will likely use for at least the next year or two.)Quoted 6 lines
Ultimately, what's likely to happen here is that I will generate some oauth tokens with publish permissions and a hypothetical user would set e.g.
TWINE_USERNAMEto "__token__", and the password would be "pypi-tokengoeshere". Using the "keyring" python package, we could attempt to fetch stored values from a session keyring, falling back to an interactive prompt if they're unset.
Quoted 4 lines
FWIW, don't consider this original comment of mine to be a technical blocker, rather it is more of a conceptual observation. If you don't think it matters, I won't mind.
OK, thanks -- just didn't want to give the impression I was just simply ignoring it, since I appreciate the look-over.
--js
RFC PATCH 18/24 add Sphinx documentation config stub
In reply to John SnowThis is the result of this command:
sphinx-apidoc --separate \
--no-toc \
--module-first \
--implicit-namespaces \
--full \
--ext-intersphinx \
--ext-coverage \
--ext-viewcode \
-o docs/ \
qemu/(And touch docs/_static/.gitignore, to create an "empty" directory.)
This configuration is not yet functional, but I wanted to distinguish between automatically generated boilerplate and intentional configuration changes so as to document the entire process of getting sphinx doc generation up, running, and fully configured.
--- docs/Makefile | 20 +++++++++ docs/conf.py | 80 ++++++++++++++++++++++++++++++++++++ docs/index.rst | 21 ++++++++++ docs/make.bat | 35 ++++++++++++++++ docs/qemu.qmp.aqmp_tui.rst | 7 ++++ docs/qemu.qmp.error.rst | 7 ++++ docs/qemu.qmp.events.rst | 7 ++++ docs/qemu.qmp.legacy.rst | 7 ++++ docs/qemu.qmp.message.rst | 7 ++++ docs/qemu.qmp.models.rst | 7 ++++ docs/qemu.qmp.protocol.rst | 7 ++++ docs/qemu.qmp.qmp_client.rst | 7 ++++ docs/qemu.qmp.qmp_shell.rst | 7 ++++ docs/qemu.qmp.rst | 24 +++++++++++ docs/qemu.qmp.util.rst | 7 ++++ docs/qemu.rst | 10 +++++ 16 files changed, 260 insertions(+) create mode 100644 docs/Makefile create mode 100644 docs/conf.py create mode 100644 docs/index.rst create mode 100644 docs/make.bat create mode 100644 docs/qemu.qmp.aqmp_tui.rst create mode 100644 docs/qemu.qmp.error.rst create mode 100644 docs/qemu.qmp.events.rst create mode 100644 docs/qemu.qmp.legacy.rst create mode 100644 docs/qemu.qmp.message.rst create mode 100644 docs/qemu.qmp.models.rst create mode 100644 docs/qemu.qmp.protocol.rst create mode 100644 docs/qemu.qmp.qmp_client.rst create mode 100644 docs/qemu.qmp.qmp_shell.rst create mode 100644 docs/qemu.qmp.rst create mode 100644 docs/qemu.qmp.util.rst create mode 100644 docs/qemu.rst
docs/Makefile new file +20 -0
@@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
docs/conf.py new file +80 -0
81 lines not on this page · raw message
docs/index.rst new file +21 -0
@@ -0,0 +1,21 @@ +.. qemu documentation master file, created by + sphinx-quickstart on Mon Dec 13 16:50:29 2021. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to qemu's documentation! +================================ + +.. toctree:: + :maxdepth: 4 + :caption: Contents: + + qemu + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search`
docs/make.bat new file +35 -0
@@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd
docs/qemu.qmp.aqmp_tui.rst new file +7 -0
@@ -0,0 +1,7 @@ +qemu.qmp.aqmp\_tui module +========================= + +.. automodule:: qemu.qmp.aqmp_tui + :members: + :undoc-members: + :show-inheritance:
docs/qemu.qmp.error.rst new file +7 -0
@@ -0,0 +1,7 @@ +qemu.qmp.error module +===================== + +.. automodule:: qemu.qmp.error + :members: + :undoc-members: + :show-inheritance:
docs/qemu.qmp.events.rst new file +7 -0
@@ -0,0 +1,7 @@ +qemu.qmp.events module +====================== + +.. automodule:: qemu.qmp.events + :members: + :undoc-members: + :show-inheritance:
docs/qemu.qmp.legacy.rst new file +7 -0
@@ -0,0 +1,7 @@ +qemu.qmp.legacy module +====================== + +.. automodule:: qemu.qmp.legacy + :members: + :undoc-members: + :show-inheritance:
docs/qemu.qmp.message.rst new file +7 -0
@@ -0,0 +1,7 @@ +qemu.qmp.message module +======================= + +.. automodule:: qemu.qmp.message + :members: + :undoc-members: + :show-inheritance:
docs/qemu.qmp.models.rst new file +7 -0
@@ -0,0 +1,7 @@ +qemu.qmp.models module +====================== + +.. automodule:: qemu.qmp.models + :members: + :undoc-members: + :show-inheritance:
docs/qemu.qmp.protocol.rst new file +7 -0
@@ -0,0 +1,7 @@ +qemu.qmp.protocol module +======================== + +.. automodule:: qemu.qmp.protocol + :members: + :undoc-members: + :show-inheritance:
docs/qemu.qmp.qmp_client.rst new file +7 -0
@@ -0,0 +1,7 @@ +qemu.qmp.qmp\_client module +=========================== + +.. automodule:: qemu.qmp.qmp_client + :members: + :undoc-members: + :show-inheritance:
docs/qemu.qmp.qmp_shell.rst new file +7 -0
@@ -0,0 +1,7 @@ +qemu.qmp.qmp\_shell module +========================== + +.. automodule:: qemu.qmp.qmp_shell + :members: + :undoc-members: + :show-inheritance:
docs/qemu.qmp.rst new file +24 -0
@@ -0,0 +1,24 @@ +qemu.qmp package +================ + +.. automodule:: qemu.qmp + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +.. toctree:: + :maxdepth: 4 + + qemu.qmp.aqmp_tui + qemu.qmp.error + qemu.qmp.events + qemu.qmp.legacy + qemu.qmp.message + qemu.qmp.models + qemu.qmp.protocol + qemu.qmp.qmp_client + qemu.qmp.qmp_shell + qemu.qmp.util
docs/qemu.qmp.util.rst new file +7 -0
@@ -0,0 +1,7 @@ +qemu.qmp.util module +==================== + +.. automodule:: qemu.qmp.util + :members: + :undoc-members: + :show-inheritance:
docs/qemu.rst new file +10 -0
@@ -0,0 +1,10 @@ +qemu namespace +============== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + qemu.qmp
Signature · 1 line
2.31.1
RFC PATCH 19/24 python: configure sphinx
In reply to John SnowWith a Sphinx project auto-generated, configure it to be something a bit more useful. And pretty.
--- docs/conf.py | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-)
docs/conf.py +36 -9
@@ -9,18 +9,28 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, '/home/jsnow/src/tmp/qemu.qmp/qemu') + +import os +import sys +sys.path.insert(0, os.path.abspath('../')) # -- Project information ----------------------------------------------------- -project = 'qemu' -copyright = '2021, Author' -author = 'Author' +project = 'QEMU Monitor Protocol (QMP) Library' +copyright = '2009-2021, QEMU Project' +author = 'John Snow' +try: + import setuptools_scm + extracted_version = setuptools_scm.get_version() +except: + extracted_version = None +finally: + if extracted_version: + version = release = extracted_version + else: + version = release = "unknown version" # -- General configuration ---------------------------------------------------
@@ -51,13 +61,30 @@ language = 'en' # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +# Interpret `this` to be a cross-reference to "anything". +default_role = 'any' # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = 'sphinx_rtd_theme' + +# https://sphinx-rtd-theme.readthedocs.io/en/stable/configuring.html#theme-options +html_theme_options = { + 'collapse_navigation': False, + 'display_version': True, + 'prev_next_buttons_location': 'both', +} + +html_context = { + "display_gitlab": True, + "gitlab_user": "jsnow", + "gitlab_repo": "qemu.qmp", + "gitlab_version": "main", + "conf_py_path": "/docs/", +} # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files,
@@ -77,4 +104,4 @@ intersphinx_mapping = { # -- Options for todo extension ---------------------------------------------- # If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True +todo_include_todos = True
Signature · 1 line
2.31.1
RFC PATCH 20/24 python: adjust apidoc stubs
In reply to John SnowChange the configuration for the generated apidoc stubs.
Some of the changes, as a summary:
- Collapse the hierarchy to omit the QEMU namespace page
- Add more meaningful titles to the subpackages
- Prefer source ordering in most places
- Do not index pages that do not define their own symbols (via __all__)
- Show hidden members for qemu.aqmp.protocol, since this interface is designed to be extended.
--- docs/index.rst | 6 +++--- docs/qemu.qmp.aqmp_tui.rst | 7 ------- docs/qemu.qmp.error.rst | 1 + docs/qemu.qmp.message.rst | 1 + docs/qemu.qmp.models.rst | 1 + docs/qemu.qmp.protocol.rst | 2 ++ docs/qemu.qmp.qmp_client.rst | 1 + docs/qemu.qmp.qmp_shell.rst | 7 ------- docs/qemu.qmp.rst | 8 ++++---- docs/qemu.qmp.util.rst | 1 + docs/qemu.rst | 10 ---------- 11 files changed, 14 insertions(+), 31 deletions(-) delete mode 100644 docs/qemu.qmp.aqmp_tui.rst delete mode 100644 docs/qemu.qmp.qmp_shell.rst delete mode 100644 docs/qemu.rst
docs/index.rst +3 -3
@@ -3,14 +3,14 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to qemu's documentation! -================================ +qemu.qmp library documentation +============================== .. toctree:: :maxdepth: 4 :caption: Contents: - qemu + qemu.qmp Indices and tables
docs/qemu.qmp.aqmp_tui.rst deleted +0 -7
@@ -1,7 +0,0 @@ -qemu.qmp.aqmp\_tui module -========================= - -.. automodule:: qemu.qmp.aqmp_tui - :members: - :undoc-members: - :show-inheritance:
docs/qemu.qmp.error.rst +1 -0
@@ -5,3 +5,4 @@ qemu.qmp.error module :members: :undoc-members: :show-inheritance: + :member-order: bysource
docs/qemu.qmp.message.rst +1 -0
@@ -5,3 +5,4 @@ qemu.qmp.message module :members: :undoc-members: :show-inheritance: + :member-order: bysource
docs/qemu.qmp.models.rst +1 -0
@@ -5,3 +5,4 @@ qemu.qmp.models module :members: :undoc-members: :show-inheritance: + :member-order: bysource
docs/qemu.qmp.protocol.rst +2 -0
@@ -5,3 +5,5 @@ qemu.qmp.protocol module :members: :undoc-members: :show-inheritance: + :private-members: + :member-order: bysource
docs/qemu.qmp.qmp_client.rst +1 -0
@@ -5,3 +5,4 @@ qemu.qmp.qmp\_client module :members: :undoc-members: :show-inheritance: + :member-order: bysource
docs/qemu.qmp.qmp_shell.rst deleted +0 -7
@@ -1,7 +0,0 @@ -qemu.qmp.qmp\_shell module -========================== - -.. automodule:: qemu.qmp.qmp_shell - :members: - :undoc-members: - :show-inheritance:
docs/qemu.qmp.rst +4 -4
@@ -1,10 +1,12 @@ -qemu.qmp package -================ +qemu.qmp - Asynchronous QEMU Monitor Protocol (QMP) library +=========================================================== .. automodule:: qemu.qmp :members: :undoc-members: :show-inheritance: + :noindex: + :member-order: bysource Submodules ----------
@@ -12,7 +14,6 @@ Submodules .. toctree:: :maxdepth: 4 - qemu.qmp.aqmp_tui qemu.qmp.error qemu.qmp.events qemu.qmp.legacy
@@ -20,5 +21,4 @@ Submodules qemu.qmp.models qemu.qmp.protocol qemu.qmp.qmp_client - qemu.qmp.qmp_shell qemu.qmp.util
docs/qemu.qmp.util.rst +1 -0
@@ -5,3 +5,4 @@ qemu.qmp.util module :members: :undoc-members: :show-inheritance: + :member-order: bysource
docs/qemu.rst deleted +0 -10
@@ -1,10 +0,0 @@ -qemu namespace -============== - -Subpackages ------------ - -.. toctree:: - :maxdepth: 4 - - qemu.qmp
Signature · 1 line
2.31.1
RFC PATCH 21/24 Fix doc cross-reference regressions
In reply to John SnowBefore enabling docs building as a CI step, lingering cross-reference failures need to be addressed.
--- qemu/qmp/legacy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
qemu/qmp/legacy.py +2 -2
@@ -71,7 +71,7 @@ class QEMUMonitorProtocol: :param nickname: Optional nickname used for logging. ..note:: - No connection is established during `__init__`, this is done by + No connection is established during ``__init__``, this is done by the `connect()` or `accept()` methods. """
@@ -287,7 +287,7 @@ class QEMUMonitorProtocol: Set the timeout for QMP RPC execution. This timeout affects the `cmd`, `cmd_obj`, and `command` methods. - The `accept`, `pull_event` and `get_event` methods have their + The `accept`, `pull_event` and `get_events` methods have their own configurable timeouts. :param timeout:
Signature · 1 line
2.31.1
RFC PATCH 22/24 docs: add Makefile target
In reply to John Snow--- Makefile | 5 +++++ 1 file changed, 5 insertions(+)
Makefile +5 -0
@@ -103,6 +103,7 @@ check-coverage: clean: python3 setup.py clean --all rm -f pyproject.toml + make -C docs clean .PHONY: distclean distclean: clean
@@ -142,3 +143,7 @@ publish: pre-publish .PHONY: publish-test publish-test: pre-publish python3 -m twine upload --verbose -r testpypi dist/* + +.PHONY: docs +docs: + make -C docs html
Signature · 1 line
2.31.1
RFC PATCH 23/24 docs: add doc build to GitLab CI build step
In reply to John Snow--- .gitlab-ci.d/build.yml | 1 + .gitlab-ci.d/python.Dockerfile | 2 ++ 2 files changed, 3 insertions(+)
.gitlab-ci.d/build.yml +1 -0
@@ -4,6 +4,7 @@ build-package: needs: job: python-container script: + - make docs - python3 -m build artifacts: name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA"
.gitlab-ci.d/python.Dockerfile +2 -0
@@ -15,6 +15,8 @@ RUN dnf --setopt=install_weak_deps=False install -y \ pipenv \ python3 \ python3-pip \ + python3-sphinx \ + python3-sphinx_rtd_theme \ python3-tox \ python3-virtualenv \ python3.10 \
Signature · 1 line
2.31.1
RFC PATCH 24/24 v0.0.1
In reply to John SnowAdd v0.0.1 tag, marking the first public alpha release of the qemu.qmp package.
--- README.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
README.rst +4 -1
@@ -126,4 +126,7 @@ locally before submitting to GitLab CI as my due diligence.) Changelog --------- -- No public release yet. +0.0.1 (2022-xx-xx) +^^^^^^^^^^^^^^^^^^ + +- Initial public release.
Signature · 1 line
2.31.1
Quoted 12 lines · John Snow
Hi, this series is part of an effort to publish the qemu.qmp package on PyPI. It is the second of three series to complete this work:
(1) Switch the new Async QMP library in to python/qemu/qmp
--> (2) Fork python/qemu/qmp out into its own repository,
with updated GitLab CI/CD targets to build packages.
(3) Update qemu.git to install qemu.qmp from PyPI, and then delete python/qemu/qmp.This series is not meant to apply to qemu.git, rather -- it's the series that performs the split and would apply to a brand new repository.
Quoted 8 lines
I am submitting it to the QEMU mailing list for these reasons:
(1) To more broadly announce my intentions, and as reference alongside series #1 and #3 detailed above.
(2) To ask for permission to become the maintainer of a 'qemu-project/qemu.qmp' repository, where I would like to host this subproject.
I'd say we need 3 designated maintainers as a minimum for redundancy.
Quoted 8 lines
(3) To ask for review on the
README.rstfile which details my intended contribution guidelines for this subproject.(4) To ask for review on the .gitlab-ci.d/ files and other repo-level CI/CD ephemera, including and especially the docs-building process. I think the generated docs are still ugly, and I'd like to upload them to readthedocs, among other things -- hence the RFC quality of this series.
Quoted 7 lines
Some review/RFC notes:
- I use jsnow/qemu.qmp as the repo name throughout the series; that will have to be changed eventually, but for the purposes of prototyping, it was nicer to have a fully working series.
- I'm planning on using gitlab issues and MRs for the subproject.
Great !
Quoted 5 lines
- I plan to version this lib independently, starting at 0.0.1 for the initial public release and bumping only the micro version for every last release. I plan to bump the minor version once it hits a "beta" state. There will be no cross-versioning against QEMU. I don't plan to publish new releases during QEMU freezes.
IMHO if we're saying that QEMU is going to use this library straight from PyPI from the start, then we're defacto considering it staable from the start too. We can't accept changes published to PyPI that are going to be incompatible with existing QEMU.
If that isn't acceptable, then QEMU is going to have to be pinned to a very specific version from PyPi, and explicitly not pull the latest.
Quoted 1 line
- Docs are not yet uploaded anywhere (GitLab pages, readthedocs?)
Since we're already using gitlab, personally I'd just setup a 'pages' job and assign a qemu.org sub-domain to gitlab pages service.
Quoted 3 lines
- Tags on a commit trigger two pipelines; this causes one of the package builds to fail as the version number will be duplicated in this case. Not entirely sure how I want to fix this yet ...
If you dont have any 'rules:' stanza gitlab creates a pipeline for any 'push' event - this means pushes of branch commits or pushes of tags.
To remove the duplicates we need to filter based on certain standard variables - CI_COMMIT_BRANCH or CI_COMMIT_TAG
rules:
- if '$CI_PIPELINE_SOURCE != "push"'
when: never
- if '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH'
when: never
- if '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH'
when: on_success
- when: never
will cull jobs for pushes of branch commit, leaving pipelines for tag pushes. It can get arbitrarily more complicated depending on what you need to achieve.
Since we're going to use merge requests, we should be aiming to *NOT* run pipelines on branch commit pushes for forks. We only want pipelines attached to the merge request.
You'll need pipelines on pushes of tags for the post-merge publishing jobs potentially, unless you want todo that on a nightly schedule
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 15 lines · Daniel P. Berrangé
Quoted 14 lines · John Snow
Hi, this series is part of an effort to publish the qemu.qmp package on PyPI. It is the second of three series to complete this work:
(1) Switch the new Async QMP library in to python/qemu/qmp
--> (2) Fork python/qemu/qmp out into its own repository,
with updated GitLab CI/CD targets to build packages.
(3) Update qemu.git to install qemu.qmp from PyPI, and then delete python/qemu/qmp.This series is not meant to apply to qemu.git, rather -- it's the series that performs the split and would apply to a brand new repository.
I am submitting it to the QEMU mailing list for these reasons:
Quoted 9 lines
Quoted 6 lines
(1) To more broadly announce my intentions, and as reference alongside series #1 and #3 detailed above.
(2) To ask for permission to become the maintainer of a 'qemu-project/qemu.qmp' repository, where I would like to host this subproject.
I'd say we need 3 designated maintainers as a minimum for redundancy.
Fine by me -- I'd like to nominate Cleber as my current co-maintainer of python/, but that leaves a third spot open. Cleber may decide to nominate someone else who is working on Avocado, too -- that'd be good too. If there was a third person who wasn't @redhat.com, that'd be nice, but nobody comes to mind right away. Any volunteers?
Also, I can hand over control of the PyPI project(s) to the conservancy and use revocable auth tokens to perform releases. We'll cross that bridge when we get there, but I've looked into it.
Quoted 11 lines
Quoted 11 lines
(3) To ask for review on the
README.rstfile which details my intended contribution guidelines for this subproject.(4) To ask for review on the .gitlab-ci.d/ files and other repo-level CI/CD ephemera, including and especially the docs-building process. I think the generated docs are still ugly, and I'd like to upload them to readthedocs, among other things -- hence the RFC quality of this series.
Some review/RFC notes:
Quoted 9 lines
Quoted 5 lines
- I use jsnow/qemu.qmp as the repo name throughout the series; that will have to be changed eventually, but for the purposes of prototyping, it was nicer to have a fully working series.
- I'm planning on using gitlab issues and MRs for the subproject.
Great !
It's just easier for me, and I suspect it would be easier for non-QEMU contributors to use. I'm starting to try and target people that sit a little further out from our core project, so it seemed like it'd make the most sense.
I'll have to work out how to announce changes to the list, though ... maybe I'll have a bot announce merge requests to the mailing list, I'm not sure.
Quoted 6 lines
Quoted 5 lines
- I plan to version this lib independently, starting at 0.0.1 for the initial public release and bumping only the micro version for every last release. I plan to bump the minor version once it hits a "beta" state. There will be no cross-versioning against QEMU. I don't plan to publish new releases during QEMU freezes.
Quoted 10 lines
IMHO if we're saying that QEMU is going to use this library straight from PyPI from the start, then we're defacto considering it staable from the start too. We can't accept changes published to PyPI that are going to be incompatible with existing QEMU.
If that isn't acceptable, then QEMU is going to have to be pinned to a very specific version from PyPi, and explicitly not pull the latest.
Right, I was thinking of pinning against a specific version. I want to retain the freedom to change the API for a little while. I was worried that if I tried to make it perfect before publishing it, that I'd never actually make it perfect OR publish it.
My plan is something like this:
- Increment the micro version for any change during the "alpha" period
- Once I remove legacy.py and add a proper sync layer (Which may involve some rework of how the event listeners are factored) I want to version at 0.1.0 and call it "beta". From there, compatible changes and extensions will bump the micro and incompatible changes will bump the minor.
- After a QEMU release or two with the beta version and no major problems, I'll probably bump it to 1.0.0, call it stable, and then use semver "as normal" for all future releases.
Quoted 6 lines
Quoted 1 line
- Docs are not yet uploaded anywhere (GitLab pages, readthedocs?)
Since we're already using gitlab, personally I'd just setup a 'pages' job and assign a qemu.org sub-domain to gitlab pages service.
I'll work on a pages job at least, then. I'll look at what you've written for qemu and qemu-web and do some copy-pasting.
Quoted 21 lines
Quoted 3 lines
- Tags on a commit trigger two pipelines; this causes one of the package builds to fail as the version number will be duplicated in this case. Not entirely sure how I want to fix this yet ...
If you dont have any 'rules:' stanza gitlab creates a pipeline for any 'push' event - this means pushes of branch commits or pushes of tags.
To remove the duplicates we need to filter based on certain standard variables -
CI_COMMIT_BRANCHorCI_COMMIT_TAGrules:
- if '$CI_PIPELINE_SOURCE != "push"'
when: never
- if '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH'
when: never
- if '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH'
when:on_success
- when: never
Quoted 4 lines
will cull jobs for pushes of branch commit, leaving pipelines for tag pushes. It can get arbitrarily more complicated depending on what you need to achieve.
OK, I'll play around with it -- thanks
Quoted 11 lines
Since we're going to use merge requests, we should be aiming to *NOT* run pipelines on branch commit pushes for forks. We only want pipelines attached to the merge request.
You'll need pipelines on pushes of tags for the post-merge publishing jobs potentially, unless you want todo that on a nightly schedule
Regards,
Daniel
Thanks for taking a peek!
(looks at email inbox ... well, this is gonna take a second to unpack ...!)
Quoted 8 lines · Daniel P. Berrangé
Quoted 3 lines · John Snow
(2) To ask for permission to become the maintainer of a 'qemu-project/qemu.qmp' repository, where I would like to host this subproject.
I'd say we need 3 designated maintainers as a minimum for redundancy.
Let's see how many people we can get to volunteer. If it's part of the qemu-project umbrella, I assume anyone with access to the entire project as a whole can step in and re-assign permissions and do emergency actions as needed, including stsquad, stefanha, etc. That ought to be enough to get moving. If we want to add anyone for operational redundancy, I'd be happy to add as many people that volunteer :)
So: any volunteers? Cleber, Beraldo, Wainer? Anyone else?
I anticipate this to be extremely low traffic after the churn of splitting it out is done with, it shouldn't be a big daily cost -- but having some familiarity with the code would be good in case you need to accept some urgent patches here and there.
--js