Skip to content

pkg_resources removed in python 3.12 #103

Closed
@2bndy5

Description

@2bndy5

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

if "TRAVIS" in os.environ:
mpy_cross = pkg_resources.resource_filename(

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


pkg = pkg_resources.get_distribution("circuitpython-build-tools")
build_tools_version = "devel"
if pkg:
build_tools_version = pkg.version

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions