2024-01-20 17:34:53 -05:00
|
|
|
PEP: 739
|
2024-02-24 05:20:02 -05:00
|
|
|
Title: Static description file for build details of Python installations
|
2024-01-20 17:34:53 -05:00
|
|
|
Author: Filipe Laíns <lains@riseup.net>
|
|
|
|
PEP-Delegate: Paul Moore <p.f.moore@gmail.com>
|
2024-02-24 05:20:02 -05:00
|
|
|
Discussions-To: https://discuss.python.org/t/pep-739-static-description-file-for-build-details-of-python-installations/44572
|
2024-01-20 17:34:53 -05:00
|
|
|
Status: Draft
|
|
|
|
Type: Standards Track
|
|
|
|
Topic: Packaging
|
|
|
|
Created: 19-Dec-2023
|
|
|
|
Python-Version: 3.13
|
|
|
|
|
|
|
|
|
|
|
|
Abstract
|
|
|
|
========
|
|
|
|
|
2024-02-24 05:20:02 -05:00
|
|
|
Introduce a standard format for a static description file with build details
|
|
|
|
of Python installations.
|
2024-01-20 17:34:53 -05:00
|
|
|
|
|
|
|
|
|
|
|
Rationale
|
|
|
|
=========
|
|
|
|
|
|
|
|
When introspecting a Python installation, running code is often undesirable or
|
2024-02-24 05:20:02 -05:00
|
|
|
impossible. Having a static description file makes various of Python build
|
|
|
|
details available without having to run the interpreter.
|
2024-01-20 17:34:53 -05:00
|
|
|
|
|
|
|
This is helpful for use-cases such as cross-compilation, Python launchers, etc.
|
|
|
|
|
|
|
|
|
|
|
|
Scope
|
|
|
|
=====
|
|
|
|
|
2024-02-24 05:20:02 -05:00
|
|
|
This PEP only defines a format. Python implementations may choose to include a
|
|
|
|
build details file as part of their distribution, but they are not required to,
|
|
|
|
and the specifics of how that file is provided are completely up to them.
|
2024-01-20 17:34:53 -05:00
|
|
|
|
|
|
|
|
|
|
|
Specification
|
|
|
|
=============
|
|
|
|
|
2024-02-24 05:20:02 -05:00
|
|
|
The standard Python build description format consists of the JSON representation
|
|
|
|
of a dictionary with the with the following keys.
|
2024-01-20 17:34:53 -05:00
|
|
|
|
2024-01-26 10:52:40 -05:00
|
|
|
schema_version
|
|
|
|
--------------
|
2024-01-20 17:34:53 -05:00
|
|
|
|
|
|
|
:Type: ``number``
|
2024-02-24 05:20:02 -05:00
|
|
|
:Description: Version of the schema to parse the file contents. It SHOULD be
|
2024-01-20 17:34:53 -05:00
|
|
|
``1`` for the format described in this document. Future versions
|
2024-02-24 05:20:02 -05:00
|
|
|
MAY add, remove, or change fields. Versions that only add fields
|
|
|
|
MAY choose to only increment the schema version by a decimal
|
|
|
|
point.
|
2024-01-20 17:34:53 -05:00
|
|
|
|
2024-01-26 10:52:40 -05:00
|
|
|
language
|
|
|
|
--------
|
2024-01-20 17:34:53 -05:00
|
|
|
|
2024-02-24 05:20:02 -05:00
|
|
|
Subsection with details related to the Python language specification.
|
2024-01-20 17:34:53 -05:00
|
|
|
|
2024-01-26 10:52:40 -05:00
|
|
|
version
|
|
|
|
~~~~~~~
|
2024-01-20 17:34:53 -05:00
|
|
|
|
|
|
|
:Type: ``string``
|
2024-02-24 05:20:02 -05:00
|
|
|
:Description: String representation the Python language version — a version
|
|
|
|
string consisting only of the *major* and *minor* components (Eg.
|
|
|
|
``3.13``).
|
2024-01-20 17:34:53 -05:00
|
|
|
|
2024-01-26 10:52:40 -05:00
|
|
|
implementation
|
|
|
|
--------------
|
2024-01-20 17:34:53 -05:00
|
|
|
|
2024-02-24 05:20:02 -05:00
|
|
|
Subsection with details related to Python implementation. This section SHOULD be
|
|
|
|
equivalent to :py:data:`sys.implementation` on most implementations, but only
|
|
|
|
the ``name`` and ``version`` keys are actually required to be present.
|
2024-01-20 17:34:53 -05:00
|
|
|
|
2024-01-26 10:52:40 -05:00
|
|
|
name
|
|
|
|
~~~~
|
2024-01-20 17:34:53 -05:00
|
|
|
|
|
|
|
:Type: ``string``
|
|
|
|
:Description: Lower-case name of the Python implementation.
|
|
|
|
|
2024-02-24 05:20:02 -05:00
|
|
|
version
|
|
|
|
~~~~~~~
|
|
|
|
|
|
|
|
:Type: ``object``
|
|
|
|
:Description: Object in the format of :py:data:`sys.version_info`, containing
|
|
|
|
the implementation version.
|
|
|
|
|
2024-01-20 17:34:53 -05:00
|
|
|
Implementation-specific keys
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Additionally to the keys defined above, implementations may choose to include
|
|
|
|
extra keys with extra implementation-specific details.
|
|
|
|
|
2024-02-27 15:12:25 -05:00
|
|
|
interpreter
|
|
|
|
-----------
|
|
|
|
|
|
|
|
|
|
|
|
Subsection with details Python interpreter. If the Python installation does not
|
|
|
|
provide an interpreter, this section will be missing.
|
|
|
|
|
|
|
|
path
|
|
|
|
~~~~
|
|
|
|
|
|
|
|
:Type: ``string``
|
|
|
|
:Description: The path to the Python interprer. Either an absolute path, or a
|
|
|
|
relative path to the directory containing this file, if
|
|
|
|
applicable.
|
|
|
|
|
|
|
|
libpython
|
|
|
|
---------
|
|
|
|
|
|
|
|
Subsection with details related to the ``libpython`` library. If the Python
|
|
|
|
installation does not provide a ``libpython`` library, this section will be
|
|
|
|
missing.
|
|
|
|
|
|
|
|
dynamic
|
|
|
|
~~~~~~~
|
|
|
|
|
|
|
|
:Type: ``string``
|
|
|
|
:Description: The path to the dynamic ``libpython`` library. Either an absolute
|
|
|
|
path, or a relative path to the directory containing this file, if
|
|
|
|
applicable. If the Python installation does not provide a dynamic
|
|
|
|
``libpython`` library, this entry will be missing.
|
|
|
|
|
|
|
|
static
|
|
|
|
~~~~~~~
|
|
|
|
|
|
|
|
:Type: ``string``
|
|
|
|
:Description: The path to the static ``libpython`` library. Either an absolute
|
|
|
|
path, or a relative path to the directory containing this file, if
|
|
|
|
applicable. If the Python installation does not provide a static
|
|
|
|
``libpython`` library, this entry will be missing.
|
|
|
|
|
2024-01-26 10:52:40 -05:00
|
|
|
c_api
|
|
|
|
-----
|
2024-01-20 17:34:53 -05:00
|
|
|
|
|
|
|
Subsection with details related to the Python C API, if available. If the Python
|
|
|
|
implementation does not provide a C API, this section will be missing.
|
|
|
|
|
2024-02-27 15:12:25 -05:00
|
|
|
headers
|
|
|
|
~~~~~~~
|
2024-01-20 17:34:53 -05:00
|
|
|
|
2024-02-27 15:12:25 -05:00
|
|
|
:Type: ``string``
|
|
|
|
:Description: The path to the C API headers. Either an absolute path, or a
|
|
|
|
relative path to the directory containing this file, if
|
|
|
|
applicable.
|
2024-01-20 17:34:53 -05:00
|
|
|
|
|
|
|
|
|
|
|
Example
|
|
|
|
=======
|
|
|
|
|
|
|
|
|
|
|
|
.. code-block:: json
|
|
|
|
|
|
|
|
{
|
|
|
|
"schema_version": 1,
|
|
|
|
"language": {
|
2024-02-24 05:20:02 -05:00
|
|
|
"version": "3.13"
|
|
|
|
},
|
|
|
|
"implementation": {
|
|
|
|
"name": "cpython",
|
|
|
|
"version": {
|
2024-01-20 17:34:53 -05:00
|
|
|
"major": 3,
|
|
|
|
"minor": 13,
|
|
|
|
"micro": 1,
|
|
|
|
"releaselevel": "final",
|
|
|
|
"serial": 0
|
2024-02-24 05:20:02 -05:00
|
|
|
},
|
2024-03-13 09:01:38 -04:00
|
|
|
"hexversion": 51184112,
|
2024-01-20 17:34:53 -05:00
|
|
|
"cache_tag": "cpython-313",
|
2024-02-27 15:12:25 -05:00
|
|
|
"_multiarch": "x86_64-linux-gnu"
|
2024-02-24 05:20:02 -05:00
|
|
|
},
|
|
|
|
"libpython": {
|
2024-02-27 15:12:25 -05:00
|
|
|
"dynamic": "/usr/lib/libpython3.13.so.1.0",
|
|
|
|
"static": "/usr/lib/python3.13/config-3.13-x86_64-linux-gnu/libpython3.13.a",
|
|
|
|
},
|
|
|
|
"c_api": {
|
|
|
|
"headers": "/usr/include/python3.13"
|
2024-01-20 17:34:53 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-24 05:20:02 -05:00
|
|
|
|
|
|
|
Rejected Ideas
|
|
|
|
==============
|
|
|
|
|
|
|
|
Having a larger scope
|
|
|
|
---------------------
|
|
|
|
|
|
|
|
One of the main requests in the discussion of this PEP was the inclusion of
|
|
|
|
other kind of information, such as the ``site-packages`` path. It is the opinion
|
|
|
|
of the PEP author that information regarding the Python environment should be
|
|
|
|
provided by a separate file, creating the a clear separation between the build
|
|
|
|
details, which should be immutable accross any interpreter instance, and details
|
|
|
|
that can change, such as environment details.
|
|
|
|
|
|
|
|
|
2024-01-20 17:34:53 -05:00
|
|
|
Copyright
|
|
|
|
=========
|
|
|
|
|
|
|
|
This document is placed in the public domain or under the
|
|
|
|
CC0-1.0-Universal license, whichever is more permissive.
|