My plugin integrates with the Python Console and needs to inject environment variables before the console starts.
Until recently, I was using PyConsoleOptions:
PyConsoleOptions.getInstance(project)
.pythonConsoleSettings
.envs = envs
However, PyConsoleOptions and its getInstance(Project) method are now marked as @ApiStatus.Internal:
@ApiStatus.Internal
companion object {
@JvmStatic
fun getInstance(project: Project): PyConsoleOptions =
project.getService(PyConsoleOptions::class.java)
}
This leaves plugins without a supported way to configure environment variables for the Python Console.
Use Case
My plugin loads environment variables from external sources and injects them into the Python Console so that users can work interactively with the same environment as their application.
Example:
val envs = mapOf(
"API_KEY" to "...",
"DATABASE_URL" to "..."
)
PyConsoleOptions.getInstance(project)
.pythonConsoleSettings
.envs = envs
Request
Would it be possible to expose a stable public API to configure Python Console settings, or at least environment variables?
For example:
PythonConsoleManager.getInstance(project)
.setEnvironmentVariables(envs)
or
PythonConsoleSettings.getInstance(project)
.setEnvironmentVariables(envs)
Having a supported API would allow third-party plugins to integrate with the Python Console without relying on internal implementation details.
Additional Context
My plugin only needs to provide environment variables before the console is started. Access to the entire PyConsoleOptions implementation is not required; a minimal public API for reading/updating console environment variables would be sufficient.
If there is already another supported extension point or API intended for this use case, guidance would be greatly appreciated.