python: add qemu package installer
Add setup.cfg and setup.py, necessary for installing a package via
pip. Add a ReST document (PACKAGE.rst) explaining the basics of what
this package is for and who to contact for more information. This
document will be used as the landing page for the package on PyPI.
List the subpackages we intend to package by name instead of using
find_namespace because find_namespace will naively also packages tests,
things it finds in the dist/ folder, etc. I could not figure out how to
modify this behavior; adding allow/deny lists to setuptools kept
changing the packaged hierarchy. This works, roll with it.
I am not yet using a pyproject.toml style package manifest, because
"editable" installs are not defined (yet?) by PEP-517/518.
I consider editable installs crucial for development, though they have
(apparently) always been somewhat poorly defined.
Pip now (19.2 and later) now supports editable installs for projects
using pyproject.toml manifests, but might require the use of the
--no-use-pep517 flag, which somewhat defeats the point. Full support for
setup.py-less editable installs was not introduced until pip 21.1.1:
https://github.com/pypa/pip/pull/9547/commits/7a95720e796a5e56481c1cc20b6ce6249c50f357
For now, while the dust settles, stick with the de-facto
setup.py/setup.cfg combination supported by setuptools. It will be worth
re-evaluating this point again in the future when our supported build
platforms all ship a fairly modern pip.
Additional reading on this matter:
https://github.com/pypa/packaging-problems/issues/256
https://github.com/pypa/pip/issues/6334
https://github.com/pypa/pip/issues/6375
https://github.com/pypa/pip/issues/6434
https://github.com/pypa/pip/issues/6438
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Message-id: 20210527211715.394144-11-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-05-28 00:16:54 +03:00
|
|
|
[metadata]
|
|
|
|
name = qemu
|
python: add VERSION file
Python infrastructure as it exists today is not capable reliably of
single-sourcing a package version from a parent directory. The authors
of pip are working to correct this, but as of today this is not possible.
The problem is that when using pip to build and install a python
package, it copies files over to a temporary directory and performs its
build there. This loses access to any information in the parent
directory, including git itself.
Further, Python versions have a standard (PEP 440) that may or may not
follow QEMU's versioning. In general, it does; but naturally QEMU does
not follow PEP 440. To avoid any automatically-generated conflict, a
manual version file is preferred.
I am proposing:
- Python tooling follows the QEMU version, indirectly, but with a major
version of 0 to indicate that the API is not expected to be
stable. This would mean version 0.5.2.0, 0.5.1.1, 0.5.3.0, etc.
- In the event that a Python package needs to be updated independently
of the QEMU version, a pre-release alpha version should be preferred,
but *only* after inclusion to the qemu development or stable branches.
e.g. 0.5.2.0a1, 0.5.2.0a2, and so on should be preferred prior to
5.2.0's release.
- The Python core tooling makes absolutely no version compatibility
checks or constraints. It *may* work with releases of QEMU from the
past or future, but it is not required to.
i.e., "qemu.machine" will, for now, remain in lock-step with QEMU.
- We reserve the right to split the qemu package into independently
versioned subpackages at a later date. This might allow for us to
begin versioning QMP independently from QEMU at a later date, if
we so choose.
Implement this versioning scheme by adding a VERSION file and setting it
to 0.6.0.0a1.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Message-id: 20210527211715.394144-12-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-05-28 00:16:55 +03:00
|
|
|
version = file:VERSION
|
python: add qemu package installer
Add setup.cfg and setup.py, necessary for installing a package via
pip. Add a ReST document (PACKAGE.rst) explaining the basics of what
this package is for and who to contact for more information. This
document will be used as the landing page for the package on PyPI.
List the subpackages we intend to package by name instead of using
find_namespace because find_namespace will naively also packages tests,
things it finds in the dist/ folder, etc. I could not figure out how to
modify this behavior; adding allow/deny lists to setuptools kept
changing the packaged hierarchy. This works, roll with it.
I am not yet using a pyproject.toml style package manifest, because
"editable" installs are not defined (yet?) by PEP-517/518.
I consider editable installs crucial for development, though they have
(apparently) always been somewhat poorly defined.
Pip now (19.2 and later) now supports editable installs for projects
using pyproject.toml manifests, but might require the use of the
--no-use-pep517 flag, which somewhat defeats the point. Full support for
setup.py-less editable installs was not introduced until pip 21.1.1:
https://github.com/pypa/pip/pull/9547/commits/7a95720e796a5e56481c1cc20b6ce6249c50f357
For now, while the dust settles, stick with the de-facto
setup.py/setup.cfg combination supported by setuptools. It will be worth
re-evaluating this point again in the future when our supported build
platforms all ship a fairly modern pip.
Additional reading on this matter:
https://github.com/pypa/packaging-problems/issues/256
https://github.com/pypa/pip/issues/6334
https://github.com/pypa/pip/issues/6375
https://github.com/pypa/pip/issues/6434
https://github.com/pypa/pip/issues/6438
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Message-id: 20210527211715.394144-11-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-05-28 00:16:54 +03:00
|
|
|
maintainer = QEMU Developer Team
|
|
|
|
maintainer_email = qemu-devel@nongnu.org
|
|
|
|
url = https://www.qemu.org/
|
|
|
|
download_url = https://www.qemu.org/download/
|
|
|
|
description = QEMU Python Build, Debug and SDK tooling.
|
|
|
|
long_description = file:PACKAGE.rst
|
|
|
|
long_description_content_type = text/x-rst
|
|
|
|
classifiers =
|
|
|
|
Development Status :: 3 - Alpha
|
|
|
|
License :: OSI Approved :: GNU General Public License v2 (GPLv2)
|
|
|
|
Natural Language :: English
|
|
|
|
Operating System :: OS Independent
|
|
|
|
Programming Language :: Python :: 3 :: Only
|
2021-05-28 00:17:14 +03:00
|
|
|
Programming Language :: Python :: 3.6
|
|
|
|
Programming Language :: Python :: 3.7
|
|
|
|
Programming Language :: Python :: 3.8
|
|
|
|
Programming Language :: Python :: 3.9
|
|
|
|
Programming Language :: Python :: 3.10
|
2021-06-30 00:43:10 +03:00
|
|
|
Typing :: Typed
|
python: add qemu package installer
Add setup.cfg and setup.py, necessary for installing a package via
pip. Add a ReST document (PACKAGE.rst) explaining the basics of what
this package is for and who to contact for more information. This
document will be used as the landing page for the package on PyPI.
List the subpackages we intend to package by name instead of using
find_namespace because find_namespace will naively also packages tests,
things it finds in the dist/ folder, etc. I could not figure out how to
modify this behavior; adding allow/deny lists to setuptools kept
changing the packaged hierarchy. This works, roll with it.
I am not yet using a pyproject.toml style package manifest, because
"editable" installs are not defined (yet?) by PEP-517/518.
I consider editable installs crucial for development, though they have
(apparently) always been somewhat poorly defined.
Pip now (19.2 and later) now supports editable installs for projects
using pyproject.toml manifests, but might require the use of the
--no-use-pep517 flag, which somewhat defeats the point. Full support for
setup.py-less editable installs was not introduced until pip 21.1.1:
https://github.com/pypa/pip/pull/9547/commits/7a95720e796a5e56481c1cc20b6ce6249c50f357
For now, while the dust settles, stick with the de-facto
setup.py/setup.cfg combination supported by setuptools. It will be worth
re-evaluating this point again in the future when our supported build
platforms all ship a fairly modern pip.
Additional reading on this matter:
https://github.com/pypa/packaging-problems/issues/256
https://github.com/pypa/pip/issues/6334
https://github.com/pypa/pip/issues/6375
https://github.com/pypa/pip/issues/6434
https://github.com/pypa/pip/issues/6438
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Message-id: 20210527211715.394144-11-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-05-28 00:16:54 +03:00
|
|
|
|
|
|
|
[options]
|
|
|
|
python_requires = >= 3.6
|
|
|
|
packages =
|
|
|
|
qemu.qmp
|
|
|
|
qemu.machine
|
|
|
|
qemu.utils
|
2021-09-15 19:29:29 +03:00
|
|
|
qemu.aqmp
|
2021-05-28 00:17:00 +03:00
|
|
|
|
2021-06-30 00:43:10 +03:00
|
|
|
[options.package_data]
|
|
|
|
* = py.typed
|
|
|
|
|
2021-05-28 00:17:10 +03:00
|
|
|
[options.extras_require]
|
2021-06-30 00:43:12 +03:00
|
|
|
# For the devel group, When adding new dependencies or bumping the minimum
|
|
|
|
# version, use e.g. "pipenv install --dev pylint==3.0.0".
|
|
|
|
# Subsequently, edit 'Pipfile' to remove e.g. 'pylint = "==3.0.0'.
|
2021-05-28 00:17:10 +03:00
|
|
|
devel =
|
python: add avocado-framework and tests
Try using avocado to manage our various tests; even though right now
they're only invoking shell scripts and not really running any
python-native code.
Create tests/, and add shell scripts which call out to mypy, flake8,
pylint and isort to enforce the standards in this directory.
Add avocado-framework to the setup.cfg development dependencies, and add
avocado.cfg to store some preferences for how we'd like the test output
to look.
Finally, add avocado-framework to the Pipfile environment and lock the
new dependencies. We are using avocado >= 87.0 here to take advantage of
some features that Cleber has helpfully added to make the test output
here *very* friendly and easy to read for developers that might chance
upon the output in Gitlab CI.
[Note: ALL of the dependencies get updated to the most modern versions
that exist at the time of this writing. No way around it that I have
seen. Not ideal, but so it goes.]
Provided you have the right development dependencies (mypy, flake8,
isort, pylint, and now avocado-framework) You should be able to run
"avocado --config avocado.cfg run tests/" from the python folder to run
all of these linters with the correct arguments.
(A forthcoming commit adds the much easier 'make check'.)
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Tested-by: Cleber Rosa <crosa@redhat.com>
Message-id: 20210527211715.394144-28-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-05-28 00:17:11 +03:00
|
|
|
avocado-framework >= 87.0
|
2021-05-28 00:17:10 +03:00
|
|
|
flake8 >= 3.6.0
|
2021-06-03 03:37:16 +03:00
|
|
|
fusepy >= 2.0.4
|
2021-05-28 00:17:10 +03:00
|
|
|
isort >= 5.1.2
|
|
|
|
mypy >= 0.770
|
|
|
|
pylint >= 2.8.0
|
2021-05-28 00:17:14 +03:00
|
|
|
tox >= 3.18.0
|
2021-05-28 00:17:10 +03:00
|
|
|
|
2021-06-03 03:37:16 +03:00
|
|
|
# Provides qom-fuse functionality
|
|
|
|
fuse =
|
|
|
|
fusepy >= 2.0.4
|
|
|
|
|
2021-06-03 03:37:05 +03:00
|
|
|
[options.entry_points]
|
|
|
|
console_scripts =
|
|
|
|
qom = qemu.qmp.qom:main
|
|
|
|
qom-set = qemu.qmp.qom:QOMSet.entry_point
|
|
|
|
qom-get = qemu.qmp.qom:QOMGet.entry_point
|
|
|
|
qom-list = qemu.qmp.qom:QOMList.entry_point
|
|
|
|
qom-tree = qemu.qmp.qom:QOMTree.entry_point
|
2021-06-03 03:37:19 +03:00
|
|
|
qom-fuse = qemu.qmp.qom_fuse:QOMFuse.entry_point [fuse]
|
2021-06-04 18:55:31 +03:00
|
|
|
qemu-ga-client = qemu.qmp.qemu_ga_client:main
|
2021-06-07 23:06:48 +03:00
|
|
|
qmp-shell = qemu.qmp.qmp_shell:main
|
2021-06-03 03:37:05 +03:00
|
|
|
|
2021-05-28 00:17:02 +03:00
|
|
|
[flake8]
|
|
|
|
extend-ignore = E722 # Prefer pylint's bare-except checks to flake8's
|
2021-05-28 00:17:03 +03:00
|
|
|
exclude = __pycache__,
|
2021-05-28 00:17:02 +03:00
|
|
|
|
2021-05-28 00:17:05 +03:00
|
|
|
[mypy]
|
|
|
|
strict = True
|
|
|
|
python_version = 3.6
|
|
|
|
warn_unused_configs = True
|
2021-05-28 00:17:06 +03:00
|
|
|
namespace_packages = True
|
2021-05-28 00:17:05 +03:00
|
|
|
|
2021-06-03 03:37:15 +03:00
|
|
|
[mypy-qemu.qmp.qom_fuse]
|
|
|
|
# fusepy has no type stubs:
|
|
|
|
allow_subclassing_any = True
|
|
|
|
|
|
|
|
[mypy-fuse]
|
|
|
|
# fusepy has no type stubs:
|
|
|
|
ignore_missing_imports = True
|
|
|
|
|
2021-05-28 00:17:00 +03:00
|
|
|
[pylint.messages control]
|
|
|
|
# Disable the message, report, category or checker with the given id(s). You
|
|
|
|
# can either give multiple identifiers separated by comma (,) or put this
|
|
|
|
# option multiple times (only on the command line, not in the configuration
|
|
|
|
# file where it should appear only once). You can also use "--disable=all" to
|
|
|
|
# disable everything first and then reenable specific checks. For example, if
|
|
|
|
# you want to run only the similarities checker, you can use "--disable=all
|
|
|
|
# --enable=similarities". If you want to run only the classes checker, but have
|
|
|
|
# no Warning level messages displayed, use "--disable=all --enable=classes
|
|
|
|
# --disable=W".
|
2021-09-16 21:22:48 +03:00
|
|
|
disable=consider-using-f-string,
|
2021-09-15 19:29:44 +03:00
|
|
|
too-many-function-args, # mypy handles this with less false positives.
|
2021-09-15 19:29:46 +03:00
|
|
|
no-member, # mypy also handles this better.
|
2021-05-28 00:17:00 +03:00
|
|
|
|
|
|
|
[pylint.basic]
|
|
|
|
# Good variable names which should always be accepted, separated by a comma.
|
|
|
|
good-names=i,
|
|
|
|
j,
|
|
|
|
k,
|
|
|
|
ex,
|
|
|
|
Run,
|
2021-06-03 03:37:09 +03:00
|
|
|
_, # By convention: Unused variable
|
|
|
|
fh, # fh = open(...)
|
|
|
|
fd, # fd = os.open(...)
|
|
|
|
c, # for c in string: ...
|
2021-09-15 19:29:31 +03:00
|
|
|
T, # for TypeVars. See pylint#3401
|
2021-05-28 00:17:00 +03:00
|
|
|
|
|
|
|
[pylint.similarities]
|
|
|
|
# Ignore imports when computing similarities.
|
|
|
|
ignore-imports=yes
|
2021-09-16 21:22:47 +03:00
|
|
|
ignore-signatures=yes
|
2021-05-28 00:17:07 +03:00
|
|
|
|
2021-08-09 12:01:00 +03:00
|
|
|
# Minimum lines number of a similarity.
|
|
|
|
# TODO: Remove after we opt in to Pylint 2.8.3. See commit msg.
|
|
|
|
min-similarity-lines=6
|
|
|
|
|
|
|
|
|
2021-05-28 00:17:07 +03:00
|
|
|
[isort]
|
|
|
|
force_grid_wrap=4
|
|
|
|
force_sort_within_sections=True
|
|
|
|
include_trailing_comma=True
|
|
|
|
line_length=72
|
|
|
|
lines_after_imports=2
|
|
|
|
multi_line_output=3
|
2021-05-28 00:17:14 +03:00
|
|
|
|
|
|
|
# tox (https://tox.readthedocs.io/) is a tool for running tests in
|
|
|
|
# multiple virtualenvs. This configuration file will run the test suite
|
|
|
|
# on all supported python versions. To use it, "pip install tox" and
|
|
|
|
# then run "tox" from this directory. You will need all of these versions
|
|
|
|
# of python available on your system to run this test.
|
|
|
|
|
|
|
|
[tox:tox]
|
|
|
|
envlist = py36, py37, py38, py39, py310
|
2021-06-30 21:45:46 +03:00
|
|
|
skip_missing_interpreters = true
|
2021-05-28 00:17:14 +03:00
|
|
|
|
|
|
|
[testenv]
|
|
|
|
allowlist_externals = make
|
2021-06-03 03:37:16 +03:00
|
|
|
deps =
|
|
|
|
.[devel]
|
|
|
|
.[fuse] # Workaround to trigger tox venv rebuild
|
2021-05-28 00:17:14 +03:00
|
|
|
commands =
|
|
|
|
make check
|