Skip to content

Upgrade to modern Python packaging standards#861

Open
LukeShu wants to merge 3 commits intoyaqwsx:masterfrom
LukeShu:lukeshu/modern-pkg
Open

Upgrade to modern Python packaging standards#861
LukeShu wants to merge 3 commits intoyaqwsx:masterfrom
LukeShu:lukeshu/modern-pkg

Conversation

@LukeShu
Copy link
Contributor

@LukeShu LukeShu commented Sep 21, 2025

This is--for hopefully obvious reasons--on top of #858, go merge that first!

I guess this needs to be done by the end of next month:

$ make package
rm -f dist/*
python3 setup.py sdist bdist_wheel
/home/lukeshu/src/github.com/yaqwsx/KiKit/venv/lib/python3.13/site-packages/setuptools/__init__.py:92: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

        ********************************************************************************
        Requirements should be satisfied by a PEP 517 installer.
        If you are using pip, you can try `pip install --use-pep517`.

        By 2025-Oct-31, you need to update your project and remove deprecated calls
        or your builds will no longer be supported.
        ********************************************************************************

!!

Go a little beyond just getting that warning to go away; get all warnings from make package to go away.

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.
I guess this needs to be done by the end of next month:

    $ make package
    rm -f dist/*
    python3 setup.py sdist bdist_wheel
    /home/lukeshu/src/github.com/yaqwsx/KiKit/venv/lib/python3.13/site-packages/setuptools/__init__.py:92: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
    !!

            ********************************************************************************
            Requirements should be satisfied by a PEP 517 installer.
            If you are using pip, you can try `pip install --use-pep517`.

            By 2025-Oct-31, you need to update your project and remove deprecated calls
            or your builds will no longer be supported.
            ********************************************************************************

    !!

Go a little beyond just getting that warning to go away; get all warnings
from `make package` to go away.
@LukeShu LukeShu force-pushed the lukeshu/modern-pkg branch from 7ec2448 to 35c689f Compare October 25, 2025 22:15
@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