Skip to content

Conversation

@damienmarchal
Copy link
Contributor

@damienmarchal damienmarchal commented Jun 25, 2020

When we load a c++ plugin it may be packaged with additional python files
(examples, libraries, or per plugin binding). These files should be visible from the python environment.

This is done by the added code that scans the plugin's directory and register any path matching the following patterns:
pluginName/lib/site-packages
pluginName/lib/python3/site-packages

This behavior was the implemented in the previous version of SofaPython and proved to be useful.

@damienmarchal damienmarchal force-pushed the addAutomaticRegisteringOfPythonLib branch from 0e1269d to fa131e9 Compare June 25, 2020 21:31
…thon libraries.

When we load a c++ plugin it may be packaged with additional python files
(examples, libraries, or per plugin binding). These files should be visible from the python environment.

This is done by the added code that scans the plugin's directory and register any path matching the following patterns:
pluginName/lib/site-packages
pluginName/lib/python3/site-packages

This behavior was the implemented in the previous version of SofaPython and proved to be useful.
@damienmarchal damienmarchal force-pushed the addAutomaticRegisteringOfPythonLib branch from fa131e9 to cb07dac Compare June 25, 2020 21:52
@jnbrunet
Copy link
Contributor

I'm not a fan of automatically adding things to my sys.path, and I'm a little bit surprise it is coming from you ;), but at least there is an info message in SP3 when things get added to sys.path .

Looks like this will only work for plugins loaded before SofaPython3, and SofaPython3 itself.

Ok with me if you want to merge it.

@damienmarchal
Copy link
Contributor Author

You are saying the feature only work for plugin loaded before SofaPython3 and SofaPython3 itself.
The usage pattern is that it is the responsabability of a plugin to call the function

PythonEnvironment::addPythonModulePathsForPluginsByName("MyPluginName") 

so only its own python modules are registered.

The general idea is that we don't want to force per-system/per-user installation/manual setting of sys*path of the python modules that are connected to a loaded plugin.

@damienmarchal damienmarchal merged commit b7e3293 into sofa-framework:master Jun 26, 2020
@guparan guparan added this to the v20.12 milestone Oct 26, 2021
@damienmarchal damienmarchal deleted the addAutomaticRegisteringOfPythonLib branch June 8, 2022 13:15
hugtalbot pushed a commit to hugtalbot/SofaPython3 that referenced this pull request Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants