Skip to content

Make site-packages implementation configurable #103708

Closed
@itsankitkp

Description

Enhancement

It is confusing for different implementations of python (eg pypy and rustpython) to specify correct layout of site-packages, whether they should include their own implementation (by making huge diffs in sysconfig.py) or use same as cpython's implementation viz pythonX.Y. Pypy has good solution of this problem where sysconfig _INSTALL_SCHEMES has term implementation_lower (lower counterpart of implementation). Definition of implementation is up to different flavours of python to decide. This can reduce lot of diffs in sysconfig.py in various implementations and make layout of site-packages more uniform.

Example (taken from Pypi implementation)

    'posix_prefix': {
        'stdlib': '{base}/lib/{implementation_lower}{py_version_short}',
        'platstdlib': '{platbase}/lib/{implementation_lower}{py_version_short}',
        'purelib': '{base}/lib/{implementation_lower}{py_version_short}/site-packages',
        'platlib': '{platbase}/lib/{implementation_lower}{py_version_short}/site-packages',
        'include': '{base}/include/{implementation_lower}{py_version_short}',
        'platinclude': '{platbase}/include/{implementation_lower}{py_version_short}',
        'scripts': '{base}/bin',
        'data': '{base}',
        }
def _get_implementation():
    if sys.implementation.name == 'pypy':
        return 'PyPy'
    return 'Python'

Related discussions

RustPython/RustPython#4925

Reference: https://github.com/mozillazg/pypy/blob/master/lib-python/2.7/sysconfig.py

Linked PRs

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions