Skip to content

Conversation

@kotborealis
Copy link
Contributor

For pip plugins installed in editable mode, via pip install -e ..., buildstream failed to resolve the actual location of source files of a plugin.

locate_file resolved location to site-packages/<module-name>/elements/<element.py>, while site-packages contained only the pth file pointing to the another directory.

This patch updates pluginoriginpip.py to use find_spec to find files. It works properly with editable packages and pth files.

@kotborealis
Copy link
Contributor Author

kotborealis commented Dec 2, 2025

@gtristan Any chance this could be merged?

@abderrahim
Copy link
Contributor

Can you please rebase it?

@kotborealis
Copy link
Contributor Author

Rebased it cleanly, without any merge commits.

Also wanted to ask a question related to plugins: it's hard-coded that plugins search for a .yaml file for the default configuration. Should .yml files be considered valid as well?

@kotborealis
Copy link
Contributor Author

Accidentally closed this while messing with git rebases, reopening.

@kotborealis kotborealis reopened this Dec 10, 2025
@abderrahim abderrahim force-pushed the master branch 2 times, most recently from 5323c39 to fb3186d Compare December 14, 2025 10:53
For pip plugins installed in editable mode, via `pip install -e ...`,
buildstream failed to resolve the actual location of source files of a
plugin.
This is caused because `importlib.metadata` does not honor editable
packages with `pth` files.

This patch updates `pluginoriginpip.py` to use `find_spec` to find
files. This works for editable packages.
Copy link
Contributor

@abderrahim abderrahim left a comment

Choose a reason for hiding this comment

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

I moved the importlib import together with the others (inside the function). I don't know whether that's still needed or if it was just something specific to pkg_resources, but it's better to do that in a separate commit/PR.

Let's merge this.

@abderrahim abderrahim merged commit 86a950a into apache:master Dec 14, 2025
18 checks passed
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