adafruit / circuitpython-build-tools

Build scripts for CircuitPython libraries and the bundle
MIT License
28 stars 18 forks source link

pkg_resources removed in python 3.12 #103

Closed 2bndy5 closed 9 months ago

2bndy5 commented 9 months ago

Using python 3.12 to build bundles results in the following error:

  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/circuitpython_build_tools/scripts/build_bundles.py", line 40, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

setuptools has a migration guide (from pkg_resources to importlib.resources).

Possible replacements

https://github.com/adafruit/circuitpython-build-tools/blob/9f02e3a1c9d017e6b76aac106efebf7d2b0c0b6d/circuitpython_build_tools/scripts/build_bundles.py#L271-L272 could be replaced with the suggestion from the aforementioned migration guide.

[!NOTE] The above snippet seems to specifically support using Travis CI. Travis CI isn't used in CirPy CI workflows anymore, and they no longer have a free tier (maybe some customers were grandfathered into current pricing?).

And then there's this (seemingly antiquated) statement in the README:

These build tools are intended for use with Travis CI


https://github.com/adafruit/circuitpython-build-tools/blob/9f02e3a1c9d017e6b76aac106efebf7d2b0c0b6d/circuitpython_build_tools/scripts/build_bundles.py#L247-L250 could be replaced with importlib_metadata.version()

TBC

I haven't delved into the impact of these changes, but I figure d I'd better open an issue to track this for future support of python 3.12.

jepler commented 9 months ago

can you put this in as a PR so that we can see what the CI thinks about the proposed change?

2bndy5 commented 9 months ago

I can draft up something. But I can't test anything in Travis CI anymore.

jepler commented 9 months ago

we don't use travis anymore for anything circuitpython related

2bndy5 commented 9 months ago

Should I remove that travis-specific code block? If so, I think the README should also be adjusted accordingly.

jepler commented 9 months ago

Correcting the README with current info would be good, but let's handle the pkg_resources problem separately from that.