Skip to content

python: add linters to gitlab CI

John Snow qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5python: add pytest and testspython/Pipfile.lock python/setup.cfg python/tests/test_lint.py+99 -55 replies
2/5python: add excluded dirs to flake8 configpython/setup.cfg+2 -02 replies
3/5python: add Makefile for some common taskspython/Makefile+35 -00 replies
4/5python: add .gitignorepython/.gitignore+9 -07 replies
5/5gitlab: add python linters to CI.gitlab-ci.yml tests/docker/dockerfiles/fedora.docker+12 -00 replies

Reviews trailers per patch

2 of 5 patches have a Reviewed-by or Acked-by.

PatchPhilippe Mathieu-Daudé
1/5R-b
2/5R-b
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] python: add linters to gitlab CI

based-on: <[email protected]>
[PATCH v3 00/15] python: create installable package

This series serves as an addendum to the python package series; it adds easy invocations for running the linters with the correct options for the purposes of preventing regressions in our python libraries and tools.

It adds (to ./python):

- make venv: Use pipenv to recreate a venv as laid out precisely by Pipfile.lock; this requires *precisely* Python 3.6.

- make check: Run linters using pytest framework using user's current environment (Which may well be their own venv, their OS environment, whatever.) It only requires *a* python; at the moment, 3.6, 3.7, and 3.8 are supported. There are some known problems with 3.9 as of yet.

- make venv-check: Run the linters using the venv laid out by Pipfile.lock specifically.

Then, it adds a very simple gitlab test to run this on top of the Fedora32 build. I chose Fedora as the host for this test only because Fedora's package ecosystem makes it very easy to install multiple versions of Python, which allows us to test against our minimum required version explicitly to detect against any accidental breakages that slip in from developers coding against 3.7, 3.8, 3.9, etc.

This is the simplest thing I could come up with that fulfilled a few design goals I had in mind:

1. It can be run locally with an arbitrary environment

2. It can be run locally with a precise environment, matching how it will be executed in the CI environment

3. It can be invoked from the python directory in a standalone manner.

4. It runs on our CI infrastructure, preventing regressions in the python code.

John Snow (5):
python: add pytest and tests
python: add excluded dirs to flake8 config
python: add Makefile for some common tasks
python: add .gitignore
gitlab: add python linters to CI

 .gitlab-ci.yml                         | 10 ++++
 python/.gitignore                      |  9 ++++
 python/Makefile                        | 35 +++++++++++++
 python/Pipfile.lock                    | 71 ++++++++++++++++++++++++--
 python/setup.cfg                       |  7 +++
 python/tests/test_lint.py              | 28 ++++++++++
 tests/docker/dockerfiles/fedora.docker |  2 +
 7 files changed, 157 insertions(+), 5 deletions(-)
 create mode 100644 python/.gitignore
 create mode 100644 python/Makefile
 create mode 100644 python/tests/test_lint.py
Signature · 1 line
2.26.2