This repository has been archived by the owner on May 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.py
73 lines (62 loc) · 2.23 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from setuptools import setup
from setuptools.command.install import install
from os.path import join, dirname
import shutil
import json
import os
import sys
from michelson_kernel import __version__
kernel_json = {
"argv": [sys.executable, "-m", "michelson_kernel", "-f", "{connection_file}"],
"display_name": "Michelson",
"language": "michelson",
"codemirror_mode": "michelson"
}
kernel_js_path = join(dirname(__file__), 'michelson_kernel', 'kernel.js')
class install_with_kernelspec(install):
def run(self):
install.run(self)
from jupyter_client.kernelspec import KernelSpecManager
from tempfile import TemporaryDirectory
kernel_spec = KernelSpecManager()
with TemporaryDirectory() as td:
os.chmod(td, 0o755) # Starts off as 700, not user readable
shutil.copy(kernel_js_path, join(td, 'kernel.js'))
with open(os.path.join(td, 'kernel.json'), 'w') as f:
json.dump(kernel_json, f, sort_keys=True)
kernel_spec.install_kernel_spec(td, 'michelson', user=self.user)
with open('README.md') 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='michelson-kernel',
version=__version__,
license='MIT',
description='Jupyter kernel for the Michelson language',
long_description=readme,
long_description_content_type='text/markdown',
author='Michael Zaikin (Baking Bad)',
author_email='[email protected]',
url='https://github.com/baking-bad/michelson-kernel',
packages=['michelson_kernel'],
cmdclass={'install': install_with_kernelspec},
keywords=['Tezos', 'Michelson', 'Jupyter'],
package_data={
'michelson_kernel': ['kernel.js'],
'': ['README.md']
},
install_requires=[
'pytezos>=2.3.5',
'tabulate>=0.7.5',
'jupyter-client',
'ipykernel'
],
classifiers=[
'Intended Audience :: Developers',
'Topic :: System :: Shells',
'Framework :: IPython',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3'
])