This repository has been archived by the owner on May 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
105 lines (85 loc) · 2.71 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
"""
Installation script
"""
import sys
import shlex
import subprocess
from setuptools import setup, find_packages, Command
class CleanCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
subprocess.run('rm -vrf \
./.cache ./**/.cache \
./.eggs ./**/.eggs \
./*.egg-info ./**/*.egg-info \
./build ./**/build \
./*.pyc ./**/*.pyc \
./__pycache__ ./**/__pycache__ \
./.pytest_cache ./**/.pytest_cache \
./.mypy_cache ./**/.mypy_cache', shell=True)
class LintCommand(Command):
user_options = [
('opts=', None, "Line of options to pass to the pylint runner"),
]
def initialize_options(self):
self.opts = ''
def finalize_options(self):
self.pylint_opts = shlex.split(self.opts)
def run(self):
from pylint.lint import Run
Run(self.pylint_opts)
class MypyCommand(Command):
user_options = [
('opts=', None, "Line of options to pass to the mypy runner"),
('packages=', None, "Packages that mypy should check")
]
def initialize_options(self):
self.python_version = ''
self.mypy_path = ''
self.follow_imports = ''
self.warn_unused_ignores = ''
self.opts = ''
self.packages = ''
def finalize_options(self):
if len(self.packages) > 0:
packages_list = ['--package ' + package for package in self.packages.split()]
self.packages = " ".join(packages_list)
self.mypy_opts = " ".join(shlex.split(self.opts) + shlex.split(self.packages))
def run(self):
subprocess.run('python setup.py clean', shell=True)
cmd_to_run = 'python -m mypy ' + self.mypy_opts
cmd = subprocess.run(cmd_to_run, shell=True)
if cmd.returncode != 0:
print("Mypy failed!")
sys.exit(cmd.returncode)
else:
print("Mypy succeeded!")
setup(
name='unix_micropython_kernel',
version='0.0.1',
description="Jupyter kernel for MicroPython's UNIX port",
license='MIT',
author='Łukasz Kielar',
author_email='[email protected]',
url='https://github.com/lukaszKielar/unix_micropython_kernel',
install_requires=[
'ipykernel',
'jupyterlab'
],
setup_requires=[
'mypy',
'pylint',
'pytest'
],
tests_require=['pytest'],
packages=find_packages(exclude=['tests']),
cmdclass={
'clean': CleanCommand,
'lint': LintCommand,
'mypy': MypyCommand,
}
)