Skip to content

CI: Test on the range of supported Python versions (and supporting changes)#858

Open
LukeShu wants to merge 2 commits intoyaqwsx:masterfrom
LukeShu:lukeshu/ci
Open

CI: Test on the range of supported Python versions (and supporting changes)#858
LukeShu wants to merge 2 commits intoyaqwsx:masterfrom
LukeShu:lukeshu/ci

Conversation

@LukeShu
Copy link
Contributor

@LukeShu LukeShu commented Sep 20, 2025

I wanted to make a change, but was worried about breaking things for older Pythons, so let's adjust CI to test on all supported versions (setup.py says python_requires='>=3.7'), so I can be confident in the changes. You know, what CI is for.

Ideally, this would just be adding a dimension to the matrix and adding a call to actions/setup-python. Well, turns out:

  • setup-kicad/setup.sh needs some quite a bit of modification to work with the actions/setup-python install of Python. On the bright side, I think I managed to clean it up a bit.

    The ugly part is that we have to build wxPython for that install of Python (we use the system install of wxWidgets though, which is important because _pcbnew.so links against the system wxWidgets). This is tricky for Python >=3.12 because supporting newer Python and older wxWidgets in the same wxPython actually requires us to modify wxPython a bit. This adds maybe 15min to the run; perhaps we could improve that with caching, but if so: that is for another commit.

  • The actions/setup-python install is user-writable, so we shouldn't use sudo when pip installing things to it.

  • On several supported versions of Python, pip uses build isolation by default. This means that pcbnew.py isn't visible when setup.py is being evaluated. I opted to solve this by moving the pcbnew check from build-time:setup.py run-time:kikit/ui.py.

  • kikit/typing.py (since KiKit v1.0.3, 2022-03-01) uses typing.Protocol, which was added in Python 3.8. So I bumped setup.py's python_requires to 3.8.

  • PcbDraw doesn't support Python 3.13 yet, because it uses Pillow~=9.0 and Pillow didn't support 3.13 until 11.something. So we need to install PcbDraw to a different Python than the one we're using for KiKit.

PS: FWIW, I verified that the tests do not pass with KiCad v7, affirming the existing matrix.kicad-version to already have have the widest possible range of versions.

@LukeShu
Copy link
Contributor Author

LukeShu commented Sep 21, 2025

v2: Minor touch-up of how I install the wheel package.

The error message does not mention 'v9' or 'v9-testing', which it has
supported for some time.
I wanted to make a change, but was worried about breaking things for older
Pythons, so let's adjust CI to test on all supported versions (setup.py
says `python_requires='>=3.7'`), so I can be confident in the changes.
You know, what CI is for.

Ideally, this would just be adding a dimension to the matrix and adding
a call to `actions/setup-python`.  Well, turns out:

 - setup-kicad/setup.sh needs some quite a bit of modification to work
   with the actions/setup-python install of Python.  On the bright side,
   I think I managed to clean it up a bit.

   The ugly part is that we have to build wxPython for that install of
   Python (we use the system install of wxWidgets though, which is
   important because _pcbnew.so links against the system wxWidgets).  This
   is tricky for Python >=3.12 because supporting newer Python and older
   wxWidgets in the same wxPython actually requires us to modify wxPython
   a bit.  This adds maybe 15min to the run; perhaps we could improve that
   with caching, but if so: that is for another commit.

 - The actions/setup-python install is user-writable, so we shouldn't use
   `sudo` when `pip install`ing things to it.

 - On several supported versions of Python, pip uses build isolation by
   default.  This means that pcbnew.py isn't visible when setup.py is
   being evaluated.  I opted to solve this by moving the pcbnew check
   from build-time:setup.py run-time:kikit/ui.py.

 - kikit/typing.py (since KiKit v1.0.3, 2022-03-01) uses typing.Protocol,
   which was added in Python 3.8.  So I bumped setup.py's
   python_requires to 3.8.

 - PcbDraw doesn't support Python 3.13 yet, because it uses Pillow~=9.0
   and Pillow didn't support 3.13 until 11.something.  So we need to
   install PcbDraw to a different Python than the one we're using for
   KiKit.

PS: FWIW, I verified that the tests do not pass with KiCad v7, affirming
the existing `matrix.kicad-version` to already have have the widest
possible range of versions.
@LukeShu
Copy link
Contributor Author

LukeShu commented Oct 25, 2025

Rebased to resolve merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant