Skip to content
Snippets Groups Projects
  1. Apr 21, 2022
  2. Jun 01, 2021
    • John Snow's avatar
      python: add Makefile for some common tasks · 6560379f
      John Snow authored
      
      Add "make venv" to create the pipenv-managed virtual environment that
      contains our explicitly pinned dependencies.
      
      Add "make check" to run the python linters [in the host execution
      environment].
      
      Add "make venv-check" which combines the above two: create/update the
      venv, then run the linters in that explicitly managed environment.
      
      Add "make develop" which canonizes the runes needed to get both the
      linting pre-requisites (the "[devel]" part), and the editable
      live-install (the "-e" part) of these python libraries.
      
      make clean: delete miscellaneous python packaging output possibly
      created by pipenv, pip, or other python packaging utilities
      
      make distclean: delete the above, the .venv, and the editable "qemu"
      package forwarder (qemu.egg-info) if there is one.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Reviewed-by: default avatarCleber Rosa <crosa@redhat.com>
      Tested-by: default avatarCleber Rosa <crosa@redhat.com>
      Message-id: 20210527211715.394144-29-jsnow@redhat.com
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      6560379f
    • John Snow's avatar
      python: add devel package requirements to setuptools · dbe75f55
      John Snow authored
      
      setuptools doesn't have a formal understanding of development requires,
      but it has an optional feataures section. Fine; add a "devel" feature
      and add the requirements to it.
      
      To avoid duplication, we can modify pipenv to install qemu[devel]
      instead. This enables us to run invocations like "pip install -e
      .[devel]" and test the package on bleeding-edge packages beyond those
      specified in Pipfile.lock.
      
      Importantly, this also allows us to install the qemu development
      packages in a non-networked mode: `pip3 install --no-index -e .[devel]`
      will now fail if the proper development dependencies are not already
      met. This can be useful for automated build scripts where fetching
      network packages may be undesirable.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Reviewed-by: default avatarCleber Rosa <crosa@redhat.com>
      Message-id: 20210527211715.394144-27-jsnow@redhat.com
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      dbe75f55
    • John Snow's avatar
      python: add qemu package installer · ea1213b7
      John Snow authored
      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: default avatarJohn Snow <jsnow@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Reviewed-by: default avatarCleber Rosa <crosa@redhat.com>
      Message-id: 20210527211715.394144-11-jsnow@redhat.com
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      ea1213b7
Loading