Skip to content

Conversation

@ydirson
Copy link
Contributor

@ydirson ydirson commented Aug 25, 2025

This switches away from deprecated imp, and breaks support for python 2.7, but I expect this branch to really support only python3 now, so we likely don't care about adding backward compatibility here.

Builds on #72

Nowadays it is not very clear if "2.7" is really valid, and at least
uv flags it as an error.

Now ">=2.7" is not strictly correct as it includes the 3.0-3.5 range,
but finding a way to express that (if there is one) is likely not worth
it.

Signed-off-by: Yann Dirson <[email protected]>
There is an equivalent License tag already, and uv plainly errors out
too on this one.

Signed-off-by: Yann Dirson <[email protected]>
This switches away from deprecated `imp`, and breaks support for python
2.7, but I expect this branch to really support only python3 now, so we
likely don't care about adding backward compatibility here.

Signed-off-by: Yann Dirson <[email protected]>
@ydirson
Copy link
Contributor Author

ydirson commented Oct 31, 2025

There was no much feedback on this one, is there something I can do to move forward?

spec = importlib.util.spec_from_file_location(
importName, os.path.join(root, filename))
module = importlib.util.module_from_spec(spec)
module.__loader__.exec_module(module)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is preferred to use loader rather than __loader__ here. See https://docs.python.org/3.14/library/importlib.html#importlib.machinery.ModuleSpec.loader and the examples in that document.

Otherwise this PR looks fine to me.

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.

2 participants