fix(build): replace removed SourceFileLoader.load_module() in setup.py for python 3.15 - #83
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The change correctly replaces a removed/deprecated importlib API with the supported module spec loading approach and is limited in scope.
Pull request overview
Updates the source build process to remain compatible with Python 3.15 by replacing the deprecated/removed importlib.machinery.SourceFileLoader.load_module() usage in setup.py when reading the package version.
Changes:
- Replace
SourceFileLoader(...).load_module()withimportlib.util.spec_from_file_location()+module_from_spec()+exec_module(). - Adjust imports accordingly (
import importlib.utilinstead ofimport importlib).
File summaries
| File | Description |
|---|---|
| setup.py | Modernizes the version-loading logic to avoid load_module() removal in Python 3.15. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Collaborator
|
Thanks for the patch! Could you sign off the commit? I'll approve the workflows after |
…y for upcoming python 3.15 Signed-off-by: Julien <courtes.julien@gmail.com>
Kumzy
force-pushed
the
fix/python-3.15-load-module
branch
from
August 31, 2026 10:27
8827d97 to
0fbf727
Compare
bogdanp05
approved these changes
Aug 31, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hello,
Python 3.15 will remove importlib's
load_module(), deprecated since 3.4, so every build from source failed before compilation started with:I tested it with the rc1 of python 3.15
Documentation about it there: https://docs.python.org/3/deprecations/pending-removal-in-3.15.html
I did not add the
3.15inpyproject.tomlor in the CI workflows as the3.15version is still inRC