-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
New sysconfig API: Build information - Compilation #103482
Copy link
Copy link
Open
Labels
Description
Feature or enhancement
sysconfig should export all the information required to build extensions.
Pitch
The new API should try to expose the information in a compiler-agnostic way.
Information to expose
- Python version
- currently:
sys.version_info
- currently:
- Interpreter version
- currently:
sys.implementation
- currently:
- Extension suffixes
- definition: See PEP 3149
- consideration: PEP 3149 only defines the names for POSIX
- Windows and other platforms still seem to follow it mostly (refer to
packaging.tags's implementation) - Windows
- Windows and other platforms still seem to follow it mostly (refer to
- design: The API should identify the different extensions types (interpreter, stable abi, none)
- consideration: PEP 3149 only defines the names for POSIX
- currently:
importlib.machinery.EXTENSION_SUFFIXES,sysconfig.get_config_var('EXT_SUFFIX'),sysconfig.get_config_var('SHLIB_SUFFIX')
- definition: See PEP 3149
- Is a shared
libpythonavailable? What's its name? Location?- definition: Yes if built with
--enable-shared - currently:
- (available?)
bool(sysconfig.get_config_var('LDLIBRARY')) - (name?)
sysconfig.get_config_var('LDLIBRARY') - (location?)
sysconfig.get_config_var('LIBDIR')
- (available?)
- definition: Yes if built with
- Is a static
libpythonavailable? What's its name? Location?- definition: Yes unless built with
--without-static-libpython - currently:
- (available?)
bool(sysconfig.get_config_var('LIBRARY')) - (name?)
sysconfig.get_config_var('LIBRARY') - (location?)
sysconfig.get_config_var('LIBDIR')
- (available?)
- definition: Yes unless built with
- Should extensions link against
libpython?- definition: Yes on Android and Cygwin, no everywhere else (see extension built with a shared python cannot be loaded with a static python #65735)
- currently:
bool(sysconfig.get_config_var('LIBPYTHON'))
- Is it a debug build?
- definition: Yes if built with
--with-pydebug - currently:
bool(sysconfig.get_config_var('Py_DEBUG'))
- definition: Yes if built with
- C flags needed when using the C API
- definition:
-fwrapv(until Enable-fstrict-overflow#96821)- Currently, we have unsafe code, and for a lack of a better option we assume it made into C macros, so extensions that use the C API should use
-fwrapv.
- Currently, we have unsafe code, and for a lack of a better option we assume it made into C macros, so extensions that use the C API should use
- definition:
- what else? please comment...
"definition" sections list the answer, if a question, or the value(s) of the item. "currently" sections list the current way of fetching the information.
This is list is a work in progress. Currently, we need to gather all the information that is required to build extensions. If you see anything that's missing, please comment!
Previous discussion
https://discuss.python.org/t/building-extensions-modules-in-a-post-distutils-world/23938
https://discuss.python.org/t/what-information-is-useful-to-know-statically-about-an-interpreter/25563
https://gregoryszorc.com/docs/python-build-standalone/20230116/distributions.html
New sysconfig API meta-issue: GH-103480
Reactions are currently unavailable