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
Is your feature request related to a problem? Please describe.
I'm attempting to create an environment for Jep that mirrors that of the Python interpreter from which it was installed. This includes sys.prefix, sys.exec_prefix, sys.executable, sys._base_executable, etc. My understanding is that Python derives these and others from the path that is set via Py_SetProgramName. AFAIK Jep does not support configuring Python via Py_SetProgramName. Unfortunately I cannot rely on environment variables to determine how sys.prefix, etc. are set e.g. when running in a virtual environment.
Describe the solution you'd like
I'd like to see PyConfig extended to include protected String programName set via public PyConfig setProgramName(String programName) { ... and passed to Py_SetProgramName before Py_Initialize. This should prompt the embedded Python interpreter to properly set sys.prefix, etc.
Describe alternatives you've considered
I've considered setting sys.prefix, etc. manually from Python after Python has been initialized but it's nuanced and difficult to get the ordering correct. I'm open to suggestions here as well.
Additional context
NA
The text was updated successfully, but these errors were encountered:
I am in favor of this change. Conceptually I think the jep PyConfig class should mirror the cpython PyConfig type wherever it is useful. The code for the new configuration should be almost identical to how we handle python home so it shouldn't be hard to figure out how to pass program name around. I think we should include this in the next release.
@mike-hunhoff If you would like to submit a PR that is the best way to ensure this gets included. Otherwise I have been meaning to update some code in that area to clean up deprecation warnings in newer Python versions so if I get to that I will also add this in.
Thanks for the response @bsteffensmeier ! I'm not sure I'll be able to get to this before you but I'll keep it on my list in case I come across extra cycles. I think this would be a big win for configuring the embedded Python interpreter using Jep's API.
Is your feature request related to a problem? Please describe.
I'm attempting to create an environment for Jep that mirrors that of the Python interpreter from which it was installed. This includes
sys.prefix
,sys.exec_prefix
,sys.executable
,sys._base_executable
, etc. My understanding is that Python derives these and others from the path that is set viaPy_SetProgramName
. AFAIK Jep does not support configuring Python viaPy_SetProgramName
. Unfortunately I cannot rely on environment variables to determine howsys.prefix
, etc. are set e.g. when running in a virtual environment.Describe the solution you'd like
I'd like to see
PyConfig
extended to includeprotected String programName
set viapublic PyConfig setProgramName(String programName) { ...
and passed toPy_SetProgramName
beforePy_Initialize
. This should prompt the embedded Python interpreter to properly setsys.prefix
, etc.Describe alternatives you've considered
I've considered setting
sys.prefix
, etc. manually from Python after Python has been initialized but it's nuanced and difficult to get the ordering correct. I'm open to suggestions here as well.Additional context
NA
The text was updated successfully, but these errors were encountered: