Two step install process

Python packaging is moving towards wheels; don't try to install the
kernelspec as part of pip installation.

Switch to flit for packaging
main
Thomas Kluyver 11 years ago
parent 6ddaaed59a
commit 07d5864c43

@ -1 +0,0 @@
include README.rst

@ -2,7 +2,12 @@ A simple IPython kernel for bash
This requires IPython 3.
To use it, install with ``pip install bash_kernel``, and then run one of:
To install::
pip install bash_kernel
python -m bash_kernel.install
To use it, run one of:
.. code:: shell
@ -11,7 +16,7 @@ To use it, install with ``pip install bash_kernel``, and then run one of:
ipython qtconsole --kernel bash
ipython console --kernel bash
For details of how this works, see IPython's docs on `wrapper kernels
<http://ipython.org/ipython-doc/dev/development/wrapperkernels.html>`_, and
For details of how this works, see the Jupyter docs on `wrapper kernels
<http://jupyter-client.readthedocs.org/en/latest/wrapperkernels.html>`_, and
Pexpect's docs on the `replwrap module
<http://pexpect.readthedocs.org/en/latest/api/replwrap.html>`_

@ -1 +1,3 @@
"""A bash kernel for Jupyter"""
__version__ = '0.3'

@ -0,0 +1,29 @@
import json
import os
import sys
from IPython.kernel.kernelspec import install_kernel_spec
from IPython.utils.tempdir import TemporaryDirectory
kernel_json = {"argv":[sys.executable,"-m","bash_kernel", "-f", "{connection_file}"],
"display_name":"Bash",
"language":"bash",
"codemirror_mode":"shell",
"env":{"PS1": "$"}
}
def install_my_kernel_spec(user=True):
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)
# TODO: Copy resources once they're specified
print('Installing IPython kernel spec')
install_kernel_spec(td, 'bash', user=user, replace=True)
def main(argv=None):
install_my_kernel_spec()
if __name__ == '__main__':
main()

@ -0,0 +1,11 @@
[metadata]
module = bash_kernel
author = Thomas Kluyver
author-email = thomas@kluyver.me.uk
home-page = https://github.com/takluyver/bash_kernel
requires = pexpect (>=3.3)
description-file = README.rst
classifiers = Framework :: IPython
License :: OSI Approved :: BSD License
Programming Language :: Python :: 3
Topic :: System :: Shells

@ -1,56 +0,0 @@
from distutils.core import setup
from distutils.command.install import install
from distutils import log
import json
import os
import sys
kernel_json = {"argv":[sys.executable,"-m","bash_kernel", "-f", "{connection_file}"],
"display_name":"Bash",
"language":"bash",
"codemirror_mode":"shell",
"env":{"PS1": "$"}
}
class install_with_kernelspec(install):
def run(self):
# Regular installation
install.run(self)
# Now write the kernelspec
from IPython.kernel.kernelspec import install_kernel_spec
from IPython.utils.tempdir import TemporaryDirectory
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)
# TODO: Copy resources once they're specified
log.info('Installing IPython kernel spec')
install_kernel_spec(td, 'bash', user=self.user, replace=True)
with open('README.rst') as f:
readme = f.read()
svem_flag = '--single-version-externally-managed'
if svem_flag in sys.argv:
# Die, setuptools, die.
sys.argv.remove(svem_flag)
setup(name='bash_kernel',
version='0.3',
description='A bash kernel for IPython',
long_description=readme,
author='Thomas Kluyver',
author_email='thomas@kluyver.me.uk',
url='https://github.com/takluyver/bash_kernel',
packages=['bash_kernel'],
cmdclass={'install': install_with_kernelspec},
install_requires=['pexpect>=3.3'],
classifiers = [
'Framework :: IPython',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3',
'Topic :: System :: Shells',
]
)
Loading…
Cancel
Save