<commit_before>from distutils.command.install import install
from distutils.core import setup
from distutils import log
import os
import json
import sys

PY3 = sys.version_info[0] >= 3

kernel_json = {
    "argv": [sys.executable, 
	     "-m", "metakernel_python", 
	     "-f", "{connection_file}"],
    "display_name": "MetaKernel Python %i" % (3 if PY3 else 2),
    "language": "python",
    "name": "metakernel_python"
}

class install_with_kernelspec(install):
    def run(self):
        install.run(self)
        from IPython.kernel.kernelspec import install_kernel_spec
        from IPython.utils.tempdir import TemporaryDirectory
        from metakernel.utils.kernel import install_kernel_resources
        with TemporaryDirectory() as td:
            os.chmod(td, 0o755) # Starts off as 700, not user readable
            with open(os.path.join(td, 'kernel.json'), 'w') as f:
                json.dump(kernel_json, f, sort_keys=True)
            install_kernel_resources(td)
            log.info('Installing kernel spec')
            try:
                install_kernel_spec(td, 'metakernel_python', user=self.user,
                                    replace=True)
            except:
                install_kernel_spec(td, 'metakernel_python', user=not self.user,
                                    replace=True)


svem_flag = '--single-version-externally-managed'
if svem_flag in sys.argv:
    # Die, setuptools, die.
    sys.argv.remove(svem_flag)

setup(name='metakernel_python',
      version='0.5.1',
      description='A Python kernel for Jupyter/IPython',
      long_description="A Python kernel for Jupyter/IPython, based on MetaKernel",
      url="https://github.com/calysto/metakernel/tree/master/metakernel_python",
      author='<NAME>',
      author_email='<EMAIL>',
      py_modules=['metakernel_python'],
      install_requires=["metakernel", "jedi"],
      cmdclass={'install': install_with_kernelspec},
      classifiers = [
          'Framework :: IPython',
          'License :: OSI Approved :: BSD License',
          'Programming Language :: Python :: 3',
          'Programming Language :: Python :: 2',
          'Topic :: System :: Shells',<commit_msg>MetaKernel Python uses whatever Python the server is running, because it is the server python magic that does all of the processing<commit_after>from distutils.command.install import install
from distutils.core import setup
from distutils import log
import os
import json
import sys

kernel_json = {
    "argv": [sys.executable, 
	     "-m", "metakernel_python", 
	     "-f", "{connection_file}"],
    "display_name": "MetaKernel Python",
    "language": "python",
    "name": "metakernel_python"
}

class install_with_kernelspec(install):
    def run(self):
        install.run(self)
        from IPython.kernel.kernelspec import install_kernel_spec
        from IPython.utils.tempdir import TemporaryDirectory
        from metakernel.utils.kernel import install_kernel_resources
        with TemporaryDirectory() as td:
            os.chmod(td, 0o755) # Starts off as 700, not user readable
            with open(os.path.join(td, 'kernel.json'), 'w') as f:
                json.dump(kernel_json, f, sort_keys=True)
            install_kernel_resources(td)
            log.info('Installing kernel spec')
            try:
                install_kernel_spec(td, 'metakernel_python', 
                                    user=self.user, replace=True)
            except:
                install_kernel_spec(td, 'metakernel_python', 
                                    user=not self.user, replace=True)


svem_flag = '--single-version-externally-managed'
if svem_flag in sys.argv:
    # Die, setuptools, die.
    sys.argv.remove(svem_flag)

setup(name='metakernel_python', 
      version='0.5.1',
      description='A Python kernel for Jupyter/IPython',
      long_description="A Python kernel for Jupyter/IPython, based on MetaKernel",
      url="https://github.com/calysto/metakernel/tree/master/metakernel_python",
      author='<NAME>',
      author_email='<EMAIL>',
      py_modules=['metakernel_python'],
      install_requires=["metakernel", "jedi"],
      cmdclass={'install': install_with_kernelspec},
      classifiers = [
          'Framework :: IPython',
          'License :: OSI Approved :: BSD License',
          'Programming Language :: Python :: 3',
          'Programming Language :: Python :: 2',
          'Topic :: System :: Shells',
{'fraction_non_alphanumeric': 0.11233678523187754, 'fraction_numerical': 0.00675371454299865, 'mean_word_length': 2.674937965260546, 'pattern_counts': {'":': 8, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3919746', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1304, 'n_words': 305}