We currently use the a mix of several techniques to determine the Python implementation we are running on in the project's setup.py. Here is the relevant code:
if "--no_ext" in sys.argv: sys.argv.remove("--no_ext") elif (sys.platform.startswith("java") or sys.platform == "cli" or "PyPy" in sys.version): sys.stdout.write(""" *****************************************************\n The optional C extensions are currently not supported\n by this python implementation.\n *****************************************************\n """) else: extra_opts['ext_modules'] = ext_modules
Instead, we can simply use platform.python_implementation() for a much cleaner solution. The method is in the standard library since v2.6 so we can use it for all future pymongo releases.