Browse Source

Merge pull request #184 from JoeyHwong-gk/common

Fix install issues about lib
tags/v0.4.2
KubeEdge Bot GitHub 4 years ago
parent
commit
1c5c53784e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 110 additions and 26 deletions
  1. +1
    -1
      lib/MANIFEST.in
  2. +4
    -0
      lib/requirements.dev.txt
  3. +3
    -4
      lib/requirements.txt
  4. +4
    -0
      lib/sedna/README.md
  5. +7
    -1
      lib/sedna/__version__.py
  6. +0
    -1
      lib/sedna/service/server/base.py
  7. +91
    -19
      lib/setup.py

+ 1
- 1
lib/MANIFEST.in View File

@@ -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

+ 4
- 0
lib/requirements.dev.txt View File

@@ -0,0 +1,4 @@
# federated_learning
plato-learn~=0.26 # Apache-2.0
# lifelong_learning
scikit-learn~=0.24.1 # BSD

+ 3
- 4
lib/requirements.txt View File

@@ -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

+ 4
- 0
lib/sedna/README.md View File

@@ -29,6 +29,10 @@ pip install dist/sedna*.whl
Install via Setuptools

```bash
# Install dependence
pip install -r requirements.txt

# Install sedna
python setup.py install --user
```



+ 7
- 1
lib/sedna/__version__.py View File

@@ -13,5 +13,11 @@
# limitations under the License.

"""sedna version information."""
import os

__version__ = '0.3.1'

_VERSION = os.path.join(os.path.dirname(__file__), "VERSION")

with open(_VERSION, "r", encoding="utf-8") as fin:
tmp = [line.strip() for line in fin if line.strip()]
__version__ = "-".join(tmp) if tmp else "dev"

+ 0
- 1
lib/sedna/service/server/base.py View File

@@ -15,7 +15,6 @@
import contextlib
import time
import threading
import asyncio

import uvicorn
from fastapi.middleware.cors import CORSMiddleware


+ 91
- 19
lib/setup.py View File

@@ -19,32 +19,105 @@ import os

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="pujie2@huawei.com",
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 @@ setup(
"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")
},
)

Loading…
Cancel
Save