Skip to content

fix: replace pkg_resources with importlib.resources for Python 3.12+ (closes #359)#360

Open
marcm0de wants to merge 1 commit intoJaDogg:developfrom
marcm0de:fix/python313-pkg-resources
Open

fix: replace pkg_resources with importlib.resources for Python 3.12+ (closes #359)#360
marcm0de wants to merge 1 commit intoJaDogg:developfrom
marcm0de:fix/python313-pkg-resources

Conversation

@marcm0de
Copy link
Copy Markdown

Summary

Fixes #359 — pydoro fails to start on Python 3.13 with ModuleNotFoundError: No module named 'pkg_resources'.

Problem

pkg_resources (from setuptools) is no longer bundled with Python 3.12+. When pydoro tries to resolve resource paths via _from_resource(), it fails on fresh Python 3.13 installs that don't have setuptools.

Fix

Updated _from_resource() in pydoro_core/util.py to use a cascading fallback:

  1. importlib.resources.files() (Python 3.9+, stdlib) — primary
  2. pkg_resources.resource_filename() — fallback for older environments
  3. __file__-relative path — final fallback

This maintains backward compatibility while fixing the crash on modern Python.

…loses JaDogg#359)

pkg_resources (from setuptools) was removed from the Python standard
library in 3.12+. This caused a ModuleNotFoundError on Python 3.13
when setuptools wasn't explicitly installed.

Fix: Use importlib.resources.files() (available since Python 3.9) as
the primary resource lookup, with pkg_resources as fallback for older
environments, and a final fallback to __file__-relative path.
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.

[BUG] Fails to start on Win11 + Python 3.13

1 participant