FullControlXYZ / fullcontrol

Python version of FullControl for toolpath design (and more) - the readme below is best source of information
GNU General Public License v3.0
672 stars 78 forks source link

Switch from pkg_resources to importlib.resources #100

Closed garyvdm closed 3 months ago

garyvdm commented 3 months ago

pkg_resources is deprecated, and was removed in the version of setuptools that comes with python 3.12. So trying to use fullcontrol in python 3.12 give this error:

Python 3.12.4 (main, Jun  7 2024, 00:00:00) [GCC 14.1.1 20240607 (Red Hat 14.1.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fullcontrol as fc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/gary/dev/fullcontrol/fullcontrol/__init__.py", line 1, in <module>
    from fullcontrol.combinations.gcode_and_visualize.common import *
  File "/home/gary/dev/fullcontrol/fullcontrol/combinations/gcode_and_visualize/common.py", line 7, in <module>
    from .classes import *
  File "/home/gary/dev/fullcontrol/fullcontrol/combinations/gcode_and_visualize/classes.py", line 3, in <module>
    import fullcontrol.gcode as gc
  File "/home/gary/dev/fullcontrol/fullcontrol/gcode/__init__.py", line 12, in <module>
    from fullcontrol.gcode.steps2gcode import gcode
  File "/home/gary/dev/fullcontrol/fullcontrol/gcode/steps2gcode.py", line 6, in <module>
    from fullcontrol.gcode.state import State
  File "/home/gary/dev/fullcontrol/fullcontrol/gcode/state.py", line 10, in <module>
    from fullcontrol.gcode.import_printer import import_printer
  File "/home/gary/dev/fullcontrol/fullcontrol/gcode/import_printer.py", line 6, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

This changes that code to use it's replacement importlib.resources

fullcontrol-xyz commented 3 months ago

You are a superstar! Thanks for helping out 🤩