Commit 1d174836 authored by Zejun Lin's avatar Zejun Lin Committed by fishyds
Browse files

Selectively install through pip (#139)

Selectively install through pip 
* update setup.py
parent 0619de20
...@@ -29,9 +29,35 @@ def read(fname): ...@@ -29,9 +29,35 @@ def read(fname):
class CustomInstallCommand(install): class CustomInstallCommand(install):
'''a customized install class in pip module''' '''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): def run(self):
super().run() super().run()
if self.sdk_only is None:
subprocess.run(['make', 'pip-install'], check=True) subprocess.run(['make', 'pip-install'], check=True)
self.install_requires()
setup( setup(
name = 'NNI', name = 'NNI',
...@@ -52,18 +78,7 @@ setup( ...@@ -52,18 +78,7 @@ setup(
}, },
package_data = {'nni': ['**/requirements.txt']}, package_data = {'nni': ['**/requirements.txt']},
python_requires = '>=3.5', python_requires = '>=3.5',
install_requires = [
'astor',
'hyperopt',
'json_tricks',
'numpy',
'psutil',
'pyyaml',
'requests',
'scipy',
'schema',
'pyhdfs'
],
cmdclass={ cmdclass={
'install': CustomInstallCommand 'install': CustomInstallCommand
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment