|
|
@@ -19,32 +19,105 @@ import os |
|
|
|
|
|
|
|
|
assert sys.version_info >= (3, 6), "Sorry, Python < 3.6 is not supported." |
|
|
assert sys.version_info >= (3, 6), "Sorry, Python < 3.6 is not supported." |
|
|
|
|
|
|
|
|
with open("README.md", "r") as fh: |
|
|
|
|
|
long_desc = fh.read() |
|
|
|
|
|
|
|
|
|
|
|
with open(os.path.join(os.path.dirname(__file__), 'sedna', 'VERSION'), |
|
|
|
|
|
"r", encoding="utf-8") as fh: |
|
|
|
|
|
__version__ = fh.read().strip() |
|
|
|
|
|
|
|
|
class InstallPrepare: |
|
|
|
|
|
""" |
|
|
|
|
|
Parsing dependencies |
|
|
|
|
|
""" |
|
|
|
|
|
|
|
|
with open("requirements.txt", "r", encoding="utf-8") as fh: |
|
|
|
|
|
install_requires = [line.strip() for line in |
|
|
|
|
|
fh.readlines() if line.strip()] |
|
|
|
|
|
|
|
|
def __init__(self): |
|
|
|
|
|
self.project = os.path.join(os.path.dirname(__file__), "sedna") |
|
|
|
|
|
self._long_desc = os.path.join(self.project, "README.md") |
|
|
|
|
|
self._version = os.path.join(self.project, "VERSION") |
|
|
|
|
|
self._owner = os.path.join(self.project, "..", "OWNERS") |
|
|
|
|
|
self._requirements = os.path.join(self.project, "..", |
|
|
|
|
|
"requirements.txt") |
|
|
|
|
|
self._dev_requirements = os.path.join(self.project, "..", |
|
|
|
|
|
"requirements.dev.txt") |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|
|
def long_desc(self): |
|
|
|
|
|
if not os.path.isfile(self._long_desc): |
|
|
|
|
|
return "" |
|
|
|
|
|
with open(self._long_desc, "r", encoding="utf-8") as fh: |
|
|
|
|
|
long_desc = fh.read() |
|
|
|
|
|
return long_desc |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|
|
def version(self): |
|
|
|
|
|
default_version = "999.dev" |
|
|
|
|
|
if not os.path.isfile(self._version): |
|
|
|
|
|
return default_version |
|
|
|
|
|
with open(self._version, "r", encoding="utf-8") as fh: |
|
|
|
|
|
__version__ = fh.read().strip() |
|
|
|
|
|
return __version__ or default_version |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|
|
def owners(self): |
|
|
|
|
|
default_owner = "sedna" |
|
|
|
|
|
if not os.path.isfile(self._owner): |
|
|
|
|
|
return default_owner |
|
|
|
|
|
with open(self._owner, "r", encoding="utf-8") as fh: |
|
|
|
|
|
check, approvers = False, set() |
|
|
|
|
|
for line in fh: |
|
|
|
|
|
if not line.strip(): |
|
|
|
|
|
continue |
|
|
|
|
|
if check: |
|
|
|
|
|
approvers.add(line.strip().split()[-1]) |
|
|
|
|
|
check = (line.startswith("approvers:") or |
|
|
|
|
|
(line.startswith(" -") and check)) |
|
|
|
|
|
return ",".join(approvers) or default_owner |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|
|
def basic_dependencies(self): |
|
|
|
|
|
return self._read_requirements(self._requirements) |
|
|
|
|
|
|
|
|
|
|
|
def feature_dependencies(self, feature): |
|
|
|
|
|
_c = os.path.join(self.project, 'core', feature, "requirements.txt") |
|
|
|
|
|
if os.path.isfile(_c): |
|
|
|
|
|
return self._read_requirements(_c) |
|
|
|
|
|
return self._read_requirements(self._dev_requirements, feature) |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def _read_requirements(file_path, section="all"): |
|
|
|
|
|
print(f"Start to install requirements of {section} " |
|
|
|
|
|
f"in sedna from {file_path}") |
|
|
|
|
|
if not os.path.isfile(file_path): |
|
|
|
|
|
return [] |
|
|
|
|
|
with open(file_path, "r", encoding="utf-8") as f: |
|
|
|
|
|
install_requires = [p.strip() for p in f.readlines() if p.strip()] |
|
|
|
|
|
if section == "all": |
|
|
|
|
|
return list(filter(lambda x: not x.startswith("#"), |
|
|
|
|
|
install_requires)) |
|
|
|
|
|
section_start = False |
|
|
|
|
|
section_requires = [] |
|
|
|
|
|
for p in install_requires: |
|
|
|
|
|
if section_start: |
|
|
|
|
|
if p.startswith("#"): |
|
|
|
|
|
return section_requires |
|
|
|
|
|
section_requires.append(p) |
|
|
|
|
|
elif p.startswith(f"# {section}"): |
|
|
|
|
|
section_start = True |
|
|
|
|
|
return section_requires |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_infos = InstallPrepare() |
|
|
|
|
|
|
|
|
setup( |
|
|
setup( |
|
|
name='sedna', |
|
|
name='sedna', |
|
|
version=__version__, |
|
|
|
|
|
|
|
|
version=_infos.version, |
|
|
description="The sedna package is designed to help developers \ |
|
|
description="The sedna package is designed to help developers \ |
|
|
better use open source frameworks such as tensorflow \ |
|
|
better use open source frameworks such as tensorflow \ |
|
|
on Sedna project", |
|
|
on Sedna project", |
|
|
packages=find_packages(exclude=["tests", "*.tests", |
|
|
packages=find_packages(exclude=["tests", "*.tests", |
|
|
"*.tests.*", "tests.*"]), |
|
|
"*.tests.*", "tests.*"]), |
|
|
author="", |
|
|
|
|
|
author_email="", |
|
|
|
|
|
maintainer="", |
|
|
|
|
|
|
|
|
author=_infos.owners, |
|
|
|
|
|
author_email="pujie2@huawei.com", |
|
|
|
|
|
maintainer=_infos.owners, |
|
|
maintainer_email="", |
|
|
maintainer_email="", |
|
|
include_package_data=True, |
|
|
include_package_data=True, |
|
|
python_requires=">=3.6", |
|
|
python_requires=">=3.6", |
|
|
long_description=long_desc, |
|
|
|
|
|
|
|
|
long_description=_infos.long_desc, |
|
|
long_description_content_type="text/markdown", |
|
|
long_description_content_type="text/markdown", |
|
|
license="Apache License 2.0", |
|
|
license="Apache License 2.0", |
|
|
url="https://github.com/kubeedge/sedna", |
|
|
url="https://github.com/kubeedge/sedna", |
|
|
@@ -53,12 +126,11 @@ setup( |
|
|
"License :: OSI Approved :: Apache Software License", |
|
|
"License :: OSI Approved :: Apache Software License", |
|
|
"Operating System :: POSIX :: Linux", |
|
|
"Operating System :: POSIX :: Linux", |
|
|
], |
|
|
], |
|
|
install_requires=install_requires, |
|
|
|
|
|
|
|
|
install_requires=_infos.basic_dependencies, |
|
|
extras_require={ |
|
|
extras_require={ |
|
|
"tf": ["tensorflow>=1.0.0,<2.0"], |
|
|
|
|
|
"tf_gpu": ["tensorflow-gpu>=1.0.0,<2.0"], |
|
|
|
|
|
"pytorch": ["torch==0.4.0", "torchvision==0.2.1"], |
|
|
|
|
|
"ms": ["mindspore==1.1.1"], |
|
|
|
|
|
"sklearn": ["pandas>=0.25.0", "scikit-learn==0.24.1"] |
|
|
|
|
|
|
|
|
"fl": _infos.feature_dependencies("federated_learning"), |
|
|
|
|
|
"il": _infos.feature_dependencies("incremental_learning"), |
|
|
|
|
|
"ji": _infos.feature_dependencies("joint_inference"), |
|
|
|
|
|
"ll": _infos.feature_dependencies("lifelong_learning") |
|
|
}, |
|
|
}, |
|
|
) |
|
|
) |