You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
remove the deprecated pkg_resources fallback in projectairsim.utils.load_text_resource
always use importlib.resources.files(), with the maintained importlib-resources backport on Python <3.9
join nested resource paths with joinpath(*resource_path.split("/"))
Motivation
This is a maintenance and compatibility change. Current main already prefers importlib.resources.files() on Python >=3.9, so the pkg_resources branch is not normally reached on Python 3.14. Removing it still drops a deprecated runtime dependency on setuptools/pkg_resources and keeps schema loading working on environments that no longer ship pkg_resources by default.
Full package import was not run because this local Python 3.14 environment does not have the package runtime dependencies installed (msgpack fails first).
Thanks for contributing this improvement! Could you please share a little more information about the error you encountered, such as the full traceback, Python and Setuptools versions, and how ProjectAirSim was installed?
We ask because, on Python 3.9 and newer, the current implementation should already use importlib.resources.files(), so the pkg_resources fallback would not normally be reached on Python 3.14. We were also unable to reproduce the reported failure in that version.
That said, the proposed change is still valuable because it removes the deprecated pkg_resources dependency and improves compatibility across supported environments. If the original Python 3.14 issue cannot be reproduced, perhaps we could present the PR as a maintenance and compatibility improvement, updating the title and description to reflect that motivation.
Thanks again for taking the time to identify and address this area!
bjornrun
changed the title
Fix Python 3.14 package resource loading
Remove deprecated pkg_resources fallback from resource loading
Aug 13, 2026
Thanks for taking a look — your reading is correct.
I cannot reproduce a Python 3.14 failure of the current load_text_resource() path, and I do not have a ProjectAirSim traceback that shows that function reaching the pkg_resources fallback on 3.14. On the same interpreter I used when I opened this PR:
hasattr(importlib.resources, "files") is True, so current main already takes the files() branch
ProjectAirSim was a local git checkout, not an installed wheel
setuptools is not installed, so import pkg_resources fails immediately with ModuleNotFoundError: No module named 'pkg_resources'
That missing-module error is what prompted the change. I agree it is not evidence that the 3.9+ files() path is broken on 3.14.
The remaining reason for the patch is the one you described: drop the deprecated pkg_resources fallback entirely, keep schema loading on importlib.resources.files(), and use importlib-resources only for the declared Python <3.9 range. I have updated the title and description to present this as a maintenance/compatibility cleanup rather than a 3.14 bugfix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pkg_resourcesfallback inprojectairsim.utils.load_text_resourceimportlib.resources.files(), with the maintainedimportlib-resourcesbackport on Python <3.9joinpath(*resource_path.split("/"))Motivation
This is a maintenance and compatibility change. Current
mainalready prefersimportlib.resources.files()on Python >=3.9, so thepkg_resourcesbranch is not normally reached on Python 3.14. Removing it still drops a deprecated runtime dependency on setuptools/pkg_resourcesand keeps schema loading working on environments that no longer shippkg_resourcesby default.Verification
python3 -m compileall -q client/python/projectairsim/src/projectairsim/utils.pyschema/robot_config_schema.jsonc, confirmingpkg_resourcesis not importedgit diff --check -- client/python/projectairsim/src/projectairsim/utils.py client/python/projectairsim/pyproject.tomlFull package import was not run because this local Python 3.14 environment does not have the package runtime dependencies installed (
msgpackfails first).