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
{{ message }}
Repository navigation
[C API] PEP 741: Add PyInitConfig C API to customize the Python initialization #107954
Add a text-based configuration to Python initialization
Pitch:
An API should be added to the limited C API customize the Python initialization (PyConfig API, PEP 587).
The problem is that the PyConfig C API is excluded from the limited C API, whereas the legacy initialization API is deprecated (ex: Py_VerboseFlag in Python 3.12) and being removed in Python 3.13 (ex: PySys_SetPath()).
Hey @vstinner - IIUC then there's still no non-deprecated API in the limited C API to customize the initialization, right? Can you then please reopen this task to indicate that this? Or should I report a separate issue to track this?
Hey @vstinner - IIUC then there's still no non-deprecated API in the limited C API to customize the initialization, right? Can you then please reopen this task to indicate that this? Or should I report a separate issue to track this?
I wrote PEP 741 – Python Configuration C API. Can you please elaborate your use case to motivate the usage of the limited C API to customize the Python initialization, rather than using the non-limited PyConfig C API? I was asked for such rationale.
changed the title [-][C API] No limited C API to customize Python initialization (PyConfig, PEP 587)[/-][+][C API] PEP 741: No limited C API to customize Python initialization (PyConfig, PEP 587)[/+]on Jan 24, 2024
We have a large old code base with an embedded python/jupyter console in a graphical application.
We call Py_SetProgramName and Py_SetPythonHome - though to be frank our test suite seems to pass even without calls to these two functions, but maybe not in a packaged environment without any system python available, I have to double check that - but I believe this was the initial idea - to tell python where to look for its bundled libraries in a subfolder of our application directory.
changed the title [-][C API] PEP 741: No limited C API to customize Python initialization (PyConfig, PEP 587)[/-][+][C API] PEP 741: Add stable ABI to customize Python initialization (PyConfig, PEP 587)[/+]on Feb 15, 2024
changed the title [-][C API] PEP 741: Add stable ABI to customize Python initialization (PyConfig, PEP 587)[/-][+][C API] PEP 741: Add stable ABI to customize Python initialization[/+]on Feb 15, 2024
changed the title [-][C API] PEP 741: Add stable ABI to customize Python initialization[/-][+][C API] PEP 741: Add PyInitConfig C API to customize the Python initialization[/+]on Aug 30, 2024
Activity
pythongh-107954: Add PyInitConfig C API
pythongh-107954: Add PyInitConfig C API
pythongh-107954: Add PyInitConfig C API
pythongh-107954: Add PyInitConfig C API
pythongh-107954: Add PyInitConfig C API
pythongh-107954: Add PyConfig_Get() function
pythongh-107954: Add PyConfig_Get() function
pythongh-107954: Add PyConfig_Get() function
pythongh-107954: Add PyConfig_Get() function
pythongh-107954: Add PyConfig_Get() function
pythongh-107954: Add PyConfig_Get() function
vstinner commentedon Dec 1, 2023
I wrote PR #112609 to read configuration options such as
"verbose"or"argv"as a C int or as a Python object.pythongh-107954: Add PyInitConfig C API
pythongh-107954: Add PyInitConfig C API
vstinner commentedon Dec 20, 2023
I close the issue: #110176 (comment)
milianw commentedon Jan 16, 2024
Hey @vstinner - IIUC then there's still no non-deprecated API in the limited C API to customize the initialization, right? Can you then please reopen this task to indicate that this? Or should I report a separate issue to track this?
Thank you
vstinner commentedon Jan 16, 2024
Ok, I reopen the issue.
vstinner commentedon Jan 24, 2024
I wrote PEP 741 – Python Configuration C API. Can you please elaborate your use case to motivate the usage of the limited C API to customize the Python initialization, rather than using the non-limited PyConfig C API? I was asked for such rationale.
[-][C API] No limited C API to customize Python initialization (PyConfig, PEP 587)[/-][+][C API] PEP 741: No limited C API to customize Python initialization (PyConfig, PEP 587)[/+]milianw commentedon Jan 26, 2024
We have a large old code base with an embedded python/jupyter console in a graphical application.
We call
Py_SetProgramNameandPy_SetPythonHome- though to be frank our test suite seems to pass even without calls to these two functions, but maybe not in a packaged environment without any system python available, I have to double check that - but I believe this was the initial idea - to tell python where to look for its bundled libraries in a subfolder of our application directory.[-][C API] PEP 741: No limited C API to customize Python initialization (PyConfig, PEP 587)[/-][+][C API] PEP 741: Add stable ABI to customize Python initialization (PyConfig, PEP 587)[/+][-][C API] PEP 741: Add stable ABI to customize Python initialization (PyConfig, PEP 587)[/-][+][C API] PEP 741: Add stable ABI to customize Python initialization[/+]pythongh-107954: Add PyConfig_Get() function
pythongh-107954: Add PyConfig_MEMBER_BOOL type to PyConfigSpec
gh-107954: Add PyConfig_MEMBER_BOOL type to PyConfigSpec (#116359)
vstinner commentedon Mar 7, 2024
See also #99872 "Allow efficient read access to PyConfig options".
pythongh-107954: Add PyInitConfig C API
pythongh-107954: Add PyConfig_MEMBER_BOOL type to PyConfigSpec (pytho…
pythongh-107954: Add PyConfig_MEMBER_BOOL type to PyConfigSpec (pytho…
pythongh-107954: Add PyInitConfig C API
pythongh-107954, PEP 741: Add PyConfig_Get() function
pythongh-107954, PEP 741: Add PyInitConfig C API
[-][C API] PEP 741: Add stable ABI to customize Python initialization[/-][+][C API] PEP 741: Add PyInitConfig C API to customize the Python initialization[/+]pythongh-107954, PEP 741: Add PyInitConfig C API
pythongh-107954: Refactor initconfig.c: add CONFIG_SPEC (python#110146)
gh-107954, PEP 741: Add PyConfig_Get()/Set() functions (#123472)
gh-107954, PEP 741: Add PyInitConfig C API (#123502)
pythongh-107954, PEP 741: Adjust Python initialization config
gh-107954, PEP 741: Adjust Python initialization config (#123663)
pythongh-107954, PEP 741: Add PyInitConfig_AddModule() function
pythongh-107954, PEP 741: Add PyInitConfig_AddModule() function
pythongh-107954, PEP 741: Add PyInitConfig_AddModule() function
gh-107954, PEP 741: Add PyInitConfig_AddModule() function (#123668)
vstinner commentedon Sep 6, 2024
PEP 741 is now fully implemented, I close the issue.
pythongh-107954: Fix configuration type for the perf profiler
pythongh-107954: Fix configuration type for the perf profiler
gh-107954: Fix configuration type for the perf profiler (#124636)
pythongh-107954: Document PEP 741 in What's New 3.14
gh-107954: Document PEP 741 in What's New 3.14 (#127056)
pythongh-107954: Document PEP 741 in What's New 3.14 (python#127056)
pythongh-107954: Allow setting cpu_count in PyConfig_Set()
pythongh-107954: Allow setting cpu_count in PyConfig_Set()
pythongh-107954: Add audit event to PyConfig_Set()
gh-107954: Allow setting cpu_count in PyConfig_Set() (#132954)
gh-107954: Add audit event to PyConfig_Set() (#132958)