Skip to content

Make site-packages implementation configurable #103708

Description

@itsankitkp

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions