[Python-Dev] PEP about sys.implementation and implementation specific user site directory (original) (raw)

Benjamin Peterson benjamin at python.org
Sat Oct 10 01:51:33 CEST 2009


2009/10/9 Christian Heimes <lists at cheimes.de>:

Fellow Python developers!

In the light of our recent discussion about implementation specific information and user site directory I like to start a new PEP. Much to my regret I wasn't able to contribute to Python core development over the past months. I hope I can find some free time over the next weeks.

Glad to have you back!

Before I start with the PEP I like to reach consensus over the goal. Alternative implementations of our beloved programming languages are becoming more important every day. Although IronPython, Jython and PyPy are trying hard to get as compatible to CPython as possible there are numerous reasons for conditional code. General Python unit tests vs. CPython specific unit tests are one reasons, implementation specific module search paths are another. At the moment Python has no easy way to inspect the implementation besides some code in the platform module. I'm proposing two new attributes in the sys module: sys.implementation and sys.userdirsuffix.

Overall, +1.

sys.implementation ------------------ (Proposed by Nick, MAL and others.) sys.implementation is a PyStructSequence that contains various information about the current implementation. Some fields are required to be present on every implementation. Implementations may choose to add additional fields as they see fit. Some fields like compiler are useful for introspection and are already part of sys.version. I like to include them for the sake of completeness.

Can we generate sys.version from sys.implementation then?

id (required):  lower case identifier, for example "cpython", "ironpython", "jython", "pypy" name (required):  mixed case name of the implementation, for example "CPython", "IronPython", "Jython", "PyPy" platform (required):  platform or language of the implementation, for example "C", ".NET", "Java" runtime (required):  lower case runtime library of the implementation, for example "libc", "msvcrt90", "java6", ".net" compiler (required):  verbose name of the compiler, for example "GCC 4.3.3", "Java HotSpot(TM) Client VM (Apple Inc.)", "Mono JIT compiler version 2.0.1" ...

sys.userdirsuffix -----------------

Why not site.userdirsuffix?

-- Regards, Benjamin



More information about the Python-Dev mailing list