This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathsetup.py
109 lines (93 loc) · 2.47 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
106
107
108
109
# -*- coding: utf-8 -*-
import os
from setuptools.command.sdist import sdist
from setuptools import find_packages
from setuptools import setup
import subprocess
with open('requirements.txt') as f:
required = f.read().splitlines()
with open(os.path.join('docs', 'requirements.txt')) as f:
docs_required = f.read().splitlines()
requirements = {
'install': required,
'docs': docs_required,
'stylecheck': [
'autopep8',
'hacking',
],
'doctest': [
'sphinx==1.8.2',
],
'test': [
'numpy',
'pytest>=4.0.0,<5.0.0',
'mock',
],
'test-ci-plain': [
'-r stylecheck',
'-r test',
'pytest-cov',
'coveralls',
],
'test-ci': [
'-r test-ci-plain',
'-r doctest',
'Pillow',
'matplotlib',
'scipy',
'chainer',
],
'test-ci-contrib': [
'-r test-ci',
'pytorch-ignite',
]
}
def reduce_requirements(key):
# Resolve recursive requirements notation (-r)
reqs = requirements[key]
resolved_reqs = []
for req in reqs:
if req.startswith('-r'):
depend_key = req[2:].lstrip()
reduce_requirements(depend_key)
resolved_reqs += requirements[depend_key]
else:
resolved_reqs.append(req)
requirements[key] = resolved_reqs
for k in requirements.keys():
reduce_requirements(k)
here = os.path.abspath(os.path.dirname(__file__))
# Get __version__ variable
exec(open(os.path.join(here, 'chainerui', '_version.py')).read())
class chainerui_sdist(sdist):
def run(self):
subprocess.check_call('cd frontend && npm run build', shell=True)
sdist.run(self)
setup(
name='chainerui',
version=__version__, # NOQA
description='ChainerUI: User Interface for Chainer',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
install_requires=requirements['install'],
tests_require=requirements['test'],
extras_require={k: v for k, v in requirements.items() if k != 'install'},
package_data={
'chainerui': [
'templates/*',
'static/**/*'
],
},
author='',
author_email='',
url='https://github.com/chainer/chainerui',
packages=find_packages(exclude=('tests', 'docs')),
entry_points={
"console_scripts": [
"chainerui=chainerui.app:main",
]
},
cmdclass={
'sdist': chainerui_sdist
},
)