qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 00376d: python/qom: Do not use 'err' name at


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 00376d: python/qom: Do not use 'err' name at module scope
Date: Thu, 01 Jul 2021 12:29:34 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 00376d1345475fb3613a0d58584f161cd870ea90
      
https://github.com/qemu/qemu/commit/00376d1345475fb3613a0d58584f161cd870ea90
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M python/qemu/qmp/qom.py

  Log Message:
  -----------
  python/qom: Do not use 'err' name at module scope

Pylint updated to 2.9.0 upstream, adding new warnings for things that
re-use the 'err' variable. Luckily, this only breaks the
python-check-tox job, which is allowed to fail as a warning.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Message-id: 20210629214323.1329806-2-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 7f179082638efe920748b5243423bdcaed3d42ef
      
https://github.com/qemu/qemu/commit/7f179082638efe920748b5243423bdcaed3d42ef
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    A python/qemu/machine/py.typed
    A python/qemu/qmp/py.typed
    A python/qemu/utils/py.typed
    M python/setup.cfg

  Log Message:
  -----------
  python: expose typing information via PEP 561

https://www.python.org/dev/peps/pep-0561/#specification

Create 'py.typed' files in each subpackage that indicate to mypy that
this is a typed module, so that users of any of these packages can use
mypy to check their code as well.

Note: Theoretically it's possible to ditch MANIFEST.in in favor of using
package_data in setup.cfg, but I genuinely could not figure out how to
get it to include things from the *source root* into the *package root*;
only how to include things from each subpackage. I tried!

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-id: 20210629214323.1329806-3-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 82e6517d9d0a1ce9fdc09919af26775a5127a5ec
      
https://github.com/qemu/qemu/commit/82e6517d9d0a1ce9fdc09919af26775a5127a5ec
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M python/qemu/machine/machine.py
    M python/qemu/machine/qtest.py
    M python/setup.cfg

  Log Message:
  -----------
  python: Remove global pylint suppressions

These suppressions only apply to a small handful of places. Instead of
disabling them globally, disable them just in the cases where we
need. The design of the machine class grew quite organically with tons
of constructor and class instance variables -- there's little chance of
meaningfully refactoring it in the near term, so just suppress the
warnings for that class.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-id: 20210629214323.1329806-4-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 3afa3501cbd2598a4b7b79d6bfffb36033abc37c
      
https://github.com/qemu/qemu/commit/3afa3501cbd2598a4b7b79d6bfffb36033abc37c
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M python/Pipfile.lock
    M python/setup.cfg

  Log Message:
  -----------
  python: Re-lock pipenv at *oldest* supported versions

tox is already testing the most recent versions. Let's use pipenv to
test the oldest versions we claim to support. This matches the stylistic
choice to have pipenv always test our oldest supported Python version, 3.6.

The effect of this is that the python-check-pipenv CI job on gitlab will
now test against much older versions of these linters, which will help
highlight incompatible changes that might otherwise go unnoticed.

Update instructions for adding and bumping versions in setup.cfg. The
reason for deleting the line that gets added to Pipfile is largely just
to avoid having the version minimums specified in multiple places in
config checked into the tree.

(This patch was written by deleting Pipfile and Pipfile.lock, then
explicitly installing each dependency manually at a specific
version. Then, I restored the prior Pipfile and re-ran `pipenv lock
--dev --keep-outdated` to re-add the qemu dependency back to the pipenv
environment while keeping the "old" packages. It's annoying, yes, but I
think the improvement to test coverage is worthwhile.)

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-id: 20210629214323.1329806-5-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 4176dbd8b5f8d5e38dfe11db58a806749649debf
      
https://github.com/qemu/qemu/commit/4176dbd8b5f8d5e38dfe11db58a806749649debf
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M python/README.rst

  Log Message:
  -----------
  python: README.rst touchups

Clarifying a few points; removing the reference to 'setuptools' because
it isn't referenced anywhere else in this document and doesn't really
provide any useful information to a Python newcomer.

Adjusting the language elsewhere to be less ambiguous and have fewer
run-on sentences.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-id: 20210629214323.1329806-6-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: d2ae942984ef6bee864e4cfddc1adcc3d4a31e42
      
https://github.com/qemu/qemu/commit/d2ae942984ef6bee864e4cfddc1adcc3d4a31e42
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M python/README.rst

  Log Message:
  -----------
  python: Add no-install usage instructions

It's not encouraged, but it's legitimate to want to know how to do.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-id: 20210629214323.1329806-7-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 6f84d726f3fe5e0f8c3b8dd36100ed9ab446ce1e
      
https://github.com/qemu/qemu/commit/6f84d726f3fe5e0f8c3b8dd36100ed9ab446ce1e
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M .gitlab-ci.d/static_checks.yml
    M python/Makefile
    M python/README.rst

  Log Message:
  -----------
  python: rename 'venv-check' target to 'check-pipenv'

Well, Cleber was right, this is a better name.

In preparation for adding a different kind of virtual environment check
(One that simply uses whichever version of Python you happen to have),
rename this test 'check-pipenv' so that it matches the CI job
'check-python-pipenv'.

Remove the "If you don't know which test to run" hint, because it's not
actually likely you have Python 3.6 installed to be able to run the
test. It's still the test I'd most prefer you to run, but it's not the
test you are most likely to be able to run.

Rename the 'venv' target to 'pipenv' as well, and move the more
pertinent help text under the 'check-pipenv' target.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-id: 20210629214323.1329806-8-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 8c95d0fc7f905fb952818e934169a8abcc9a4c56
      
https://github.com/qemu/qemu/commit/8c95d0fc7f905fb952818e934169a8abcc9a4c56
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M python/Makefile

  Log Message:
  -----------
  python: update help text for check-tox

Move it up near the check-pipenv help text, and update it to suggest parity.

(At the time I first added it, I wasn't sure if I would be keeping it,
but I've come to appreciate it as it has actually helped uncover bugs I
would not have noticed without it. It should stay.)

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-id: 20210629214323.1329806-9-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 205d7219f3ba9971149b6fa45a155866d9e889db
      
https://github.com/qemu/qemu/commit/205d7219f3ba9971149b6fa45a155866d9e889db
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M python/Makefile

  Log Message:
  -----------
  python: Fix .PHONY Make specifiers

I missed the 'check-tox' target. Add that, but split the large .PHONY
specifier at the top into its component pieces and move them near the
targets they describe so that they're much harder to forget to update.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Message-id: 20210629214323.1329806-10-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 0d52c19a599a45c800fb58f3ad359f6472a18e3f
      
https://github.com/qemu/qemu/commit/0d52c19a599a45c800fb58f3ad359f6472a18e3f
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M python/setup.cfg
    M python/tests/flake8.sh

  Log Message:
  -----------
  python: only check qemu/ subdir with flake8

flake8 is a little eager to check everything it can. Limit it to
checking inside the qemu namespace directory only. Update setup.cfg now
that the exclude patterns are no longer necessary.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-id: 20210629214323.1329806-11-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 2c24d52d06af855a9b2a69c38cd4b747c848b1e1
      
https://github.com/qemu/qemu/commit/2c24d52d06af855a9b2a69c38cd4b747c848b1e1
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M python/.gitignore
    M python/Makefile

  Log Message:
  -----------
  python: add 'make check-dev' invocation

This is a *third* way to run the Python tests. Unlike the first two
(check-pipenv, check-tox), this version does not require any specific
interpreter version -- making it a lot easier to tell people to run it
as a quick smoketest prior to submission to GitLab CI.

Summary:

  Checked via GitLab CI:
    - check-pipenv: tests our oldest python & dependencies
    - check-tox: tests newest dependencies on all non-EOL python versions
  Executed only incidentally:
    - check-dev: tests newest dependencies on whichever python version

('make check' does not set up any environment at all, it just runs the
tests in your current environment. All four invocations perform the
exact same tests, just in different execution environments.)

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-id: 20210629214323.1329806-12-jsnow@redhat.com
[Maintainer edit: added .dev-venv/ to .gitignore. --js]
Acked-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Acked-by: Willian Rampazzo <willianr@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 28cd32fb7bcd4ff3f987e9cd59186b18e810d73d
      
https://github.com/qemu/qemu/commit/28cd32fb7bcd4ff3f987e9cd59186b18e810d73d
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M python/Makefile

  Log Message:
  -----------
  python: Update help text on 'make check', 'make develop'

Update for visual parity with the other targets.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-id: 20210629214323.1329806-13-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 50d0fba8272a5ccc2821e8ca66a5932281b1ca2d
      
https://github.com/qemu/qemu/commit/50d0fba8272a5ccc2821e8ca66a5932281b1ca2d
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M python/Makefile

  Log Message:
  -----------
  python: Update help text on 'make clean', 'make distclean'

Update for visual parity with all the remaining targets.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-id: 20210629214323.1329806-14-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 19cf0031e438374045aab8e5db0a03fb3b3070e4
      
https://github.com/qemu/qemu/commit/19cf0031e438374045aab8e5db0a03fb3b3070e4
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M python/Makefile

  Log Message:
  -----------
  python: remove auto-generated pyproject.toml file

For reasons that at-present escape me, pipenv insists on creating a stub
pyproject.toml file. This file is a nuisance, because its mere presence
changes the behavior of various tools.

For instance, this stub file will cause "pip install --user -e ." to
fail in spectacular fashion with misleading errors. "pip install -e ."
works okay, but for some reason pip does not support editable installs
to the user directory when using PEP517.

References:
  https://github.com/pypa/pip/pull/9990
  https://github.com/pypa/pip/issues/7953

As outlined in ea1213b7ccc, it is still too early for us to consider
moving to a PEP-517 exclusive package. We must support older
distributions, so squash the annoyance for now. (Python 3.6 shipped Dec
2016, PEP517 support showed up in pip sometime in 2019 or so.)

Add 'pyproject.toml' to the 'make clean' target, and also delete it
after every pipenv invocation issued by the Makefile.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-id: 20210629214323.1329806-15-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: 5c02c865866fdd2d17e8f5507deb4aa1f74bf59f
      
https://github.com/qemu/qemu/commit/5c02c865866fdd2d17e8f5507deb4aa1f74bf59f
  Author: John Snow <jsnow@redhat.com>
  Date:   2021-06-30 (Wed, 30 Jun 2021)

  Changed paths:
    M python/qemu/machine/__init__.py
    M python/qemu/machine/machine.py
    M python/qemu/qmp/__init__.py
    M python/qemu/qmp/qom_common.py
    M python/qemu/utils/accel.py

  Log Message:
  -----------
  python: Fix broken ReST docstrings

This patch *doesn't* update all of the docstring standards across the
QEMU package directory to make our docstring usage consistent. It
*doesn't* fix the formatting to make it look pretty or reasonable in
generated output. It *does* fix a few small instances where Sphinx would
emit a build warning because of malformed ReST -- If we built our Python
docs with Sphinx.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-id: 20210629214323.1329806-16-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>


  Commit: dd62bf14b756821fa293e3465955a41e9d460deb
      
https://github.com/qemu/qemu/commit/dd62bf14b756821fa293e3465955a41e9d460deb
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-07-01 (Thu, 01 Jul 2021)

  Changed paths:
    M .gitlab-ci.d/static_checks.yml
    M python/.gitignore
    M python/Makefile
    M python/Pipfile.lock
    M python/README.rst
    M python/qemu/machine/__init__.py
    M python/qemu/machine/machine.py
    A python/qemu/machine/py.typed
    M python/qemu/machine/qtest.py
    M python/qemu/qmp/__init__.py
    A python/qemu/qmp/py.typed
    M python/qemu/qmp/qom.py
    M python/qemu/qmp/qom_common.py
    M python/qemu/utils/accel.py
    A python/qemu/utils/py.typed
    M python/setup.cfg
    M python/tests/flake8.sh

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/jsnow-gitlab/tags/python-pull-request' 
into staging

Pull request

Patch 01/15 fixes the check-python-tox test.

# gpg: Signature made Thu 01 Jul 2021 03:01:20 BST
# gpg:                using RSA key F9B7ABDBBCACDF95BE76CBD07DEF8106AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>" [full]
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jsnow-gitlab/tags/python-pull-request:
  python: Fix broken ReST docstrings
  python: remove auto-generated pyproject.toml file
  python: Update help text on 'make clean', 'make distclean'
  python: Update help text on 'make check', 'make develop'
  python: add 'make check-dev' invocation
  python: only check qemu/ subdir with flake8
  python: Fix .PHONY Make specifiers
  python: update help text for check-tox
  python: rename 'venv-check' target to 'check-pipenv'
  python: Add no-install usage instructions
  python: README.rst touchups
  python: Re-lock pipenv at *oldest* supported versions
  python: Remove global pylint suppressions
  python: expose typing information via PEP 561
  python/qom: Do not use 'err' name at module scope

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/1ec2cd0ce2ca...dd62bf14b756



reply via email to

[Prev in Thread] Current Thread [Next in Thread]