Skip to content

Commit

Permalink
Selectively install through pip (#139)
Browse files Browse the repository at this point in the history
Selectively install through pip 
* update setup.py
  • Loading branch information
Crysple authored and yds05 committed Sep 29, 2018
1 parent 0619de2 commit 1d17483
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,35 @@ def read(fname):

class CustomInstallCommand(install):
'''a customized install class in pip module'''
user_options = install.user_options + [
('sdk-only', None, '<add --sdk-only if you want to only install nni sdk')
]

def initialize_options(self):
install.initialize_options(self)
self.sdk_only = None

def install_requires(self):
self.install_requires_list = [
'astor',
'hyperopt',
'json_tricks',
'numpy',
'psutil',
'pyyaml',
'requests',
'scipy',
'schema',
'pyhdfs'
]
for pkg in self.install_requires_list:
subprocess.run(['python3', '-m', 'pip', 'install', pkg], check=True)

def run(self):
super().run()
subprocess.run(['make', 'pip-install'], check=True)
if self.sdk_only is None:
subprocess.run(['make', 'pip-install'], check=True)
self.install_requires()

setup(
name = 'NNI',
Expand All @@ -52,18 +78,7 @@ def run(self):
},
package_data = {'nni': ['**/requirements.txt']},
python_requires = '>=3.5',
install_requires = [
'astor',
'hyperopt',
'json_tricks',
'numpy',
'psutil',
'pyyaml',
'requests',
'scipy',
'schema',
'pyhdfs'
],


cmdclass={
'install': CustomInstallCommand
Expand Down

0 comments on commit 1d17483

Please sign in to comment.