You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I notice that the initialization mechanism for the runtime simply calls Py_Initialize or Py_InitializeEx. There's currently no clear way to, for instance, pass the -I flag to the runtime to set up an isolated config, without controlling the process environment variables. This has some security considerations for my desired use case; the concerns are not unmanageable, but the workarounds are a little clumsy. More generally, this seems like the kind of useful option that would couple well with an embedded python environment (e.g. through Python.Deployment) which I suspect constitutes a large percentage of pythonnet use cases.
With support for Py_InitializeFromConfig and some means of generating the PyPreConfig and PyConfig objects (effectively just support for some of the security-conscious options on the runtime such as -I or -P), I think this would be a lot more straightforward. If there's some technical considerations that would make this challenging, I'm curious to hear them: since pythonnet is open-source, I may take a crack at patching in an overload to the PythonEngine.Initialize that lets me specify some of the security-conscious arguments for isolated configs, and I'd like to know if anything like this was attempted or considered in the past.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Greetings,
I notice that the initialization mechanism for the runtime simply calls Py_Initialize or Py_InitializeEx. There's currently no clear way to, for instance, pass the -I flag to the runtime to set up an isolated config, without controlling the process environment variables. This has some security considerations for my desired use case; the concerns are not unmanageable, but the workarounds are a little clumsy. More generally, this seems like the kind of useful option that would couple well with an embedded python environment (e.g. through Python.Deployment) which I suspect constitutes a large percentage of pythonnet use cases.
With support for Py_InitializeFromConfig and some means of generating the PyPreConfig and PyConfig objects (effectively just support for some of the security-conscious options on the runtime such as -I or -P), I think this would be a lot more straightforward. If there's some technical considerations that would make this challenging, I'm curious to hear them: since pythonnet is open-source, I may take a crack at patching in an overload to the PythonEngine.Initialize that lets me specify some of the security-conscious arguments for isolated configs, and I'd like to know if anything like this was attempted or considered in the past.
Beta Was this translation helpful? Give feedback.
All reactions