2024-01-20 17:34:53 -05:00
|
|
|
PEP: 739
|
|
|
|
Title: Static description file for Python installations
|
|
|
|
Author: Filipe Laíns <lains@riseup.net>
|
|
|
|
PEP-Delegate: Paul Moore <p.f.moore@gmail.com>
|
|
|
|
Status: Draft
|
|
|
|
Type: Standards Track
|
|
|
|
Topic: Packaging
|
|
|
|
Created: 19-Dec-2023
|
|
|
|
Python-Version: 3.13
|
|
|
|
|
|
|
|
|
|
|
|
Abstract
|
|
|
|
========
|
|
|
|
|
|
|
|
Introduce a standard format for a static description file to describe Python
|
|
|
|
installations.
|
|
|
|
|
|
|
|
|
|
|
|
Rationale
|
|
|
|
=========
|
|
|
|
|
|
|
|
When introspecting a Python installation, running code is often undesirable or
|
|
|
|
impossible. Having a static description file makes various of Python
|
|
|
|
installation details available without having to run the interpreter.
|
|
|
|
|
|
|
|
This is helpful for use-cases such as cross-compilation, Python launchers, etc.
|
|
|
|
|
|
|
|
|
|
|
|
Scope
|
|
|
|
=====
|
|
|
|
|
|
|
|
This PEP only defines a standard format for a file describing Python
|
|
|
|
installations, distributing such files is out of scope.
|
|
|
|
|
|
|
|
Python implementations may choose to include a self-describing file as part of
|
|
|
|
their distribution, but they are not required to, and it is out of scope for
|
|
|
|
this PEP to define how that may happen, if they decide to do so.
|
|
|
|
|
|
|
|
|
|
|
|
Specification
|
|
|
|
=============
|
|
|
|
|
|
|
|
The standard Python installation description format consists of the JSON
|
|
|
|
representation of a dictionary with the with the following keys.
|
|
|
|
|
2024-01-26 10:52:40 -05:00
|
|
|
schema_version
|
|
|
|
--------------
|
2024-01-20 17:34:53 -05:00
|
|
|
|
|
|
|
:Type: ``number``
|
|
|
|
:Description: Version of the schema to parse the file contents. It should be
|
|
|
|
``1`` for the format described in this document. Future versions
|
|
|
|
may add, remove, or change fields.
|
|
|
|
|
2024-01-26 10:52:40 -05:00
|
|
|
language
|
|
|
|
--------
|
2024-01-20 17:34:53 -05:00
|
|
|
|
|
|
|
Subsection with details related to the language specification.
|
|
|
|
|
2024-01-26 10:52:40 -05:00
|
|
|
version
|
|
|
|
~~~~~~~
|
2024-01-20 17:34:53 -05:00
|
|
|
|
|
|
|
:Type: ``string``
|
|
|
|
:Description: String representation the Python language version. Same as the
|
|
|
|
``PY_VERSION`` macro on CPython.
|
|
|
|
|
2024-01-26 10:52:40 -05:00
|
|
|
version_parts
|
|
|
|
~~~~~~~~~~~~~
|
2024-01-20 17:34:53 -05:00
|
|
|
|
|
|
|
:Type: ``object``
|
|
|
|
:Description: Equivalent to :py:data:`sys.version_info`.
|
|
|
|
|
2024-01-26 10:52:40 -05:00
|
|
|
implementation
|
|
|
|
--------------
|
2024-01-20 17:34:53 -05:00
|
|
|
|
|
|
|
Subsection with details related to Python implementation. While only the
|
|
|
|
``name`` key is required in this section, this section SHOULD be equivalent to
|
|
|
|
:py:data:`sys.implementation` on most implementations.
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
Implementation-specific keys
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Additionally to the keys defined above, implementations may choose to include
|
|
|
|
extra keys with extra implementation-specific details.
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
TODO
|
|
|
|
|
2024-01-26 10:52:40 -05:00
|
|
|
libpython
|
|
|
|
---------
|
2024-01-20 17:34:53 -05:00
|
|
|
|
|
|
|
Subsection with details related to the ``libpython``, if available. If the
|
|
|
|
Python implementation does not provide a ``libpython`` library, this section
|
|
|
|
will be missing.
|
|
|
|
|
|
|
|
TODO
|
|
|
|
|
|
|
|
Example
|
|
|
|
=======
|
|
|
|
|
|
|
|
|
|
|
|
.. code-block:: json
|
|
|
|
|
|
|
|
{
|
|
|
|
"schema_version": 1,
|
|
|
|
"language": {
|
|
|
|
"version": "3.13.1",
|
|
|
|
"version_parts": {
|
|
|
|
"major": 3,
|
|
|
|
"minor": 13,
|
|
|
|
"micro": 1,
|
|
|
|
"releaselevel": "final",
|
|
|
|
"serial": 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"implementation": {
|
|
|
|
"name": "cpython",
|
|
|
|
"hexversion": "...",
|
|
|
|
"cache_tag": "cpython-313",
|
|
|
|
"multiarch": "x86_64-linux-gnu"
|
|
|
|
},
|
|
|
|
"c_api": {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Copyright
|
|
|
|
=========
|
|
|
|
|
|
|
|
This document is placed in the public domain or under the
|
|
|
|
CC0-1.0-Universal license, whichever is more permissive.
|