GispoCoding / cookiecutter-qgis-plugin

A QGIS Plugin template to be set up with Cookiecutter
MIT License
24 stars 4 forks source link

Issues with new pip infrastructure and getting a clean installation #61

Open george-silva opened 1 month ago

george-silva commented 1 month ago

Describe the bug

So, first things first! Great project. I have been trying to get something up and running easily here and lot's of small things started to fail.

I needed to do some changes to install and run the tests correctly (at least using act). We have to customize what pip does here, because the machine pip now requires virtualenvs.

The lazy thing to do is to:

  1. add PIP_IGNORE_INSTALLED=1 in the pip3 install command as a prefix. This is because wheel and some other basic python packages will most likely will be installed by default and we do list it in the requirements.
  2. add --break-system-packages as a suffix to this very same command, because pip now complaints if you try to go :cowboy_hat_face: in the system packages installations.

Also another thing! I requested to bundle plugin_tools and pytest is trying to run those tests as well. So I added tests/ to the pytest command. The result is:

      # Runs all tests
      - name: Run tests
        run: >
          docker run --rm --net=host --volume `pwd`:/app -w=/app -e QGIS_PLUGIN_IN_CI=1 qgis/qgis:${{ matrix.docker_tags }} sh -c
          "PIP_IGNORE_INSTALLED=1 pip3 install -qr requirements-dev.txt --break-system-packages && xvfb-run -s '+extension GLX -screen 0 1024x768x24'
          pytest tests/ -v --cov=verifica --cov-report=xml"

To Reproduce Steps to reproduce the behavior:

  1. create a new project using the cookiecutter
  2. install act (or just run it with github actions)
  3. run the test-and-pre-release workflow
  4. you will get the failures I mention

Expected behavior

Run perfectly.

Environment (please complete the following information):