From 6de6fdfb91ddb303172e6e606950388ad1c8a12d Mon Sep 17 00:00:00 2001 From: Yang Xuan Date: Tue, 11 Jun 2019 11:57:37 +0800 Subject: [PATCH] feat(python): add setup and LICENSE, change requirements Former-commit-id: db1f39ec461cdf176671a03b9ec12db2894dda58 --- python/sdk/LICENSE | 21 +++++++++++++++++++ python/sdk/client/Abstract.py | 1 - python/sdk/client/Client.py | 9 ++++---- .../{connection_exp.py => example.py} | 4 ---- python/sdk/requirements.txt | 3 +++ python/sdk/setup.py | 18 ++++++++++++++++ 6 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 python/sdk/LICENSE rename python/sdk/examples/{connection_exp.py => example.py} (96%) create mode 100644 python/sdk/setup.py diff --git a/python/sdk/LICENSE b/python/sdk/LICENSE new file mode 100644 index 00000000..44fe606a --- /dev/null +++ b/python/sdk/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 上海赜睿信息科技有限公司(Zilliz) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/python/sdk/client/Abstract.py b/python/sdk/client/Abstract.py index 5a113d31..ce3e28e4 100644 --- a/python/sdk/client/Abstract.py +++ b/python/sdk/client/Abstract.py @@ -102,7 +102,6 @@ class TopKQueryResult(object): return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) - def _abstract(): raise NotImplementedError('You need to override this function') diff --git a/python/sdk/client/Client.py b/python/sdk/client/Client.py index 86b414a9..a3b56247 100644 --- a/python/sdk/client/Client.py +++ b/python/sdk/client/Client.py @@ -2,20 +2,19 @@ import logging, logging.config from thrift.transport import TSocket from thrift.transport import TTransport -from thrift.transport.TTransport import TTransportException -from thrift.protocol import TBinaryProtocol, TCompactProtocol, TJSONProtocol -from thrift.Thrift import TException, TApplicationException, TType +from thrift.protocol import TBinaryProtocol +from thrift.Thrift import TException, TApplicationException from megasearch.thrift import MegasearchService from megasearch.thrift import ttypes from client.Abstract import ( ConnectIntf, TableSchema, - IndexType, Range, RowRecord, QueryResult, - TopKQueryResult + TopKQueryResult, + IndexType ) from client.Status import Status diff --git a/python/sdk/examples/connection_exp.py b/python/sdk/examples/example.py similarity index 96% rename from python/sdk/examples/connection_exp.py rename to python/sdk/examples/example.py index 05c2cffd..45de4fbb 100644 --- a/python/sdk/examples/connection_exp.py +++ b/python/sdk/examples/example.py @@ -1,12 +1,8 @@ from client.Client import MegaSearch, Prepare, IndexType -from client.Status import Status -import time import random import struct from pprint import pprint -from megasearch.thrift import MegasearchService, ttypes - def main(): # Get client version diff --git a/python/sdk/requirements.txt b/python/sdk/requirements.txt index ea9b1b81..ebe47975 100644 --- a/python/sdk/requirements.txt +++ b/python/sdk/requirements.txt @@ -1,5 +1,6 @@ atomicwrites==1.3.0 attrs==19.1.0 +Faker==1.0.7 importlib-metadata==0.17 mock==3.0.5 more-itertools==7.0.0 @@ -9,7 +10,9 @@ pluggy==0.12.0 py==1.8.0 pyparsing==2.4.0 pytest==4.6.0 +python-dateutil==2.8.0 six==1.12.0 +text-unidecode==1.2 thrift==0.11.0 wcwidth==0.1.7 zipp==0.5.1 diff --git a/python/sdk/setup.py b/python/sdk/setup.py new file mode 100644 index 00000000..3d40338b --- /dev/null +++ b/python/sdk/setup.py @@ -0,0 +1,18 @@ +import setuptools + +# TODO +long_description = '' + +setuptools.setup( + name="MegaSearch", + version="0.0.1", + author="XuanYang", + author_email="xuan.yang@zilliz.com", + description="Sdk for using MegaSearch", + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], +) \ No newline at end of file -- GitLab