📝 Description of the feature
Currently, when started out of a Python session, OSL will use the same set of environment variables as the parent Python session sees. The Optislang class exposes the argument env_vars which can be used to add new environment variables, or to modify/overwrite existing environment variables. However, in certain configurations more control over the environment variables for the Optislang session is required. One example is the PYTHONPATH variable, which might be required for the parent session and can have unwanted effects to the OSL session (potentially resulting in dependency conflicts of different python environments).
Example: The "outside" application runs in the default Python installation on the computer and sets certain paths referring to that Python installation in the PYTHONPATH variable (required for the "outside" app to work properly). When OSL is then started through PyOSL, the PYTHONPATH from the parent app will be used to initialize the Python environment used for OSL (which is using the Ansys/OSL Python env). This scenario can lead to various dependency/version conflicts in the "inner" (OSL) Python session.
To offer more control, different approaches would be possible, e.g., for the Optislang class,
- expose an option "env_override" to fully set/overwrite all environment variables
- expose an option to clear the environment variables before OSL start (default True)
- expose an option to clear/delete selected environment variables before OSL start
💡 Steps for implementing the feature
No response
🔗 Useful links and references
No response
📝 Description of the feature
Currently, when started out of a Python session, OSL will use the same set of environment variables as the parent Python session sees. The Optislang class exposes the argument env_vars which can be used to add new environment variables, or to modify/overwrite existing environment variables. However, in certain configurations more control over the environment variables for the Optislang session is required. One example is the PYTHONPATH variable, which might be required for the parent session and can have unwanted effects to the OSL session (potentially resulting in dependency conflicts of different python environments).
Example: The "outside" application runs in the default Python installation on the computer and sets certain paths referring to that Python installation in the PYTHONPATH variable (required for the "outside" app to work properly). When OSL is then started through PyOSL, the PYTHONPATH from the parent app will be used to initialize the Python environment used for OSL (which is using the Ansys/OSL Python env). This scenario can lead to various dependency/version conflicts in the "inner" (OSL) Python session.
To offer more control, different approaches would be possible, e.g., for the Optislang class,
💡 Steps for implementing the feature
No response
🔗 Useful links and references
No response