-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from JoeyHwong-gk/common
Fix install issues about lib
- Loading branch information
Showing
7 changed files
with
110 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
include OWNERS requirements.txt sedna/VERSION README.md | ||
include OWNERS requirements.txt requirements.dev.txt sedna/VERSION sedna/README.md | ||
recursive-include examples *.txt *.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# federated_learning | ||
plato-learn~=0.26 # Apache-2.0 | ||
# lifelong_learning | ||
scikit-learn~=0.24.1 # BSD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
numpy>=1.13.3 # BSD | ||
colorlog~=4.7.2 # MIT | ||
websockets~=9.1 # BSD | ||
requests==2.24.0 # Apache-2.0 | ||
requests>=2.24.0 # Apache-2.0 | ||
PyYAML~=5.4.1 # MIT | ||
setuptools~=54.2.0 | ||
fastapi~=0.68.1 # MIT | ||
starlette~=0.14.2 # BSD | ||
pydantic~=1.8.1 # MIT | ||
pydantic>=1.8.1 # MIT | ||
tenacity~=8.0.1 # Apache-2.0 | ||
joblib~=1.0.1 # BSD | ||
pandas~=1.1.5 # BSD | ||
six~=1.15.0 # MIT | ||
minio~=7.0.3 # Apache-2.0 | ||
uvicorn~=0.14.0 # BSD | ||
uvicorn>=0.14.0 # BSD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,32 +19,105 @@ | |
|
||
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( | ||
name='sedna', | ||
version=__version__, | ||
version=_infos.version, | ||
description="The sedna package is designed to help developers \ | ||
better use open source frameworks such as tensorflow \ | ||
on Sedna project", | ||
packages=find_packages(exclude=["tests", "*.tests", | ||
"*.tests.*", "tests.*"]), | ||
author="", | ||
author_email="", | ||
maintainer="", | ||
author=_infos.owners, | ||
author_email="[email protected]", | ||
maintainer=_infos.owners, | ||
maintainer_email="", | ||
include_package_data=True, | ||
python_requires=">=3.6", | ||
long_description=long_desc, | ||
long_description=_infos.long_desc, | ||
long_description_content_type="text/markdown", | ||
license="Apache License 2.0", | ||
url="https://github.com/kubeedge/sedna", | ||
|
@@ -53,12 +126,11 @@ | |
"License :: OSI Approved :: Apache Software License", | ||
"Operating System :: POSIX :: Linux", | ||
], | ||
install_requires=install_requires, | ||
install_requires=_infos.basic_dependencies, | ||
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") | ||
}, | ||
) |