Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update package version to v3 #195

Merged
merged 3 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions .github/workflows/deploy_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,18 @@ jobs:
pip3 install setuptools wheel twine
pip install .
pip install -r requirements/dev.txt
- name: Test with pytest
run: |
docker-compose up -d
sleep 45
pytest -s -v -k "not TestSSLConnection and not TestSSLConnectionSelfSigned"
docker-compose down -v
working-directory: tests
- name: Test SSL connection with pytest
run: |
enable_ssl=true docker-compose up -d
sleep 45
pytest -s -v test_ssl_connection.py::TestSSLConnection
working-directory: tests
- name: Test self-signed SSL connection with pytest
run: |
enable_ssl=true docker-compose up -d
sleep 45
pytest -s -v test_ssl_connection.py::TestSSLConnectionSelfSigned
working-directory: tests
- name: Test with pytest
run: |
docker-compose -f docker-compose.yaml up -d
sleep 45
pytest -s -v -k "not SSL"
working-directory: tests
- name: Test SSL connection with pytest
run: |
enable_ssl=true docker-compose -f docker-compose-ssl.yaml up -d
sleep 45
pytest -s -v -k "SSL"
working-directory: tests

- name: Build and publish
env:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Compatible with the v2.5.0 version of nebula-graph
- fix get offline host info from list_hosts https://github.com/vesoft-inc/nebula-python/pull/104
- fix fbthrift timeout bug https://github.com/vesoft-inc/nebula-python/pull/126
- incompatible
- the ErrorCode define is changed, all ErrorCode is defined in nebula2.common.ttypes.ErrorCode
- the ErrorCode define is changed, all ErrorCode is defined in nebula3.common.ttypes.ErrorCode

## v2.0.0(2021-03-23)
Compatible with the v2.0.0 version of nebula-graph
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

LINUX_BLACK = ~/.local/bin/black
MAC_BLACK = black
FMT_EXCLUDE = --extend-exclude nebula2/common/\|nebula2/storage/\|nebula2/graph/\|nebula2/meta\|nebula2/common\|nebula2/fbthrift/
FMT_EXCLUDE = --extend-exclude nebula3/common/\|nebula3/storage/\|nebula3/graph/\|nebula3/meta\|nebula3/common\|nebula3/fbthrift/

fmt:
pip install --user black
Expand Down
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# nebula-python

This directory holds the Python API for Nebula Graph. It is used to connect with Nebula Graph 2.0.
This directory holds the Python API for Nebula Graph. It is used to connect with Nebula Graph 3.0.

## Before you start

Before you start, please read this section to choose the right branch for you. In branch v1.0, the API works only for Nebula Graph 1.0. In the master branch, the API works only for Nebula Graph 2.0.
Before you start, please read this section to choose the right branch for you. In branch v1.0, the API works only for Nebula Graph 1.0. In the master branch, the API works only for Nebula Graph 3.0.

## The directory structure

```text
|--nebula-python
|
|-- nebula2 // client code
|-- nebula3 // client code
| |-- fbthrift // the fbthrift lib code
| |-- common
| |-- data
Expand All @@ -31,16 +31,16 @@ Before you start, please read this section to choose the right branch for you. I
|
|-- setup.py // used to install or package
|
|__ README.md // the introduction of nebula2-python
|__ README.md // the introduction of nebula3-python

```

## How to get nebula2-python
## How to get nebula3-python

### Option one: install with pip

```python
pip install nebula2-python==$version
pip install nebula3-python==$version
```

### Option two: install from the source code
Expand All @@ -61,8 +61,8 @@ pip install .
## Quick example to use graph-client to connect graphd

```python
from nebula2.gclient.net import ConnectionPool
from nebula2.Config import Config
from nebula3.gclient.net import ConnectionPool
from nebula3.Config import Config

# define a config
config = Config()
Expand Down Expand Up @@ -101,8 +101,8 @@ connection_pool.close()
You should make sure the scan client can connect to the address of storage which see from `SHOW HOSTS`

```python
from nebula2.mclient import MetaCache, HostAddr
from nebula2.sclient.GraphStorageClient import GraphStorageClient
from nebula3.mclient import MetaCache, HostAddr
from nebula3.sclient.GraphStorageClient import GraphStorageClient

# the metad servers's address
meta_cache = MetaCache([('172.28.1.1', 9559),
Expand Down Expand Up @@ -138,13 +138,14 @@ while resp.has_next():

## How to choose nebula-python

| Nebula2-Python Version | NebulaGraph Version |
| Nebula3-Python Version | NebulaGraph Version |
|---|---|
| 2.0.0b1 | 2.0.0beta |
| 2.0.0rc1 | 2.0.0-rc1 |
| 2.0.0 | 2.0.0/2.0.1 |
| 2.5.0 | 2.5.0 |
| 2.6.0 | 2.6.0/2.6.1 |
| 3.0.0 | 3.0.0 |

## How to contribute to nebula-python

Expand Down
4 changes: 2 additions & 2 deletions example/GraphClientMultiThreadExample.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
sys.path.insert(0, '../')


from nebula2.gclient.net import ConnectionPool
from nebula2.Config import Config
from nebula3.gclient.net import ConnectionPool
from nebula3.Config import Config
from FormatResp import print_resp


Expand Down
8 changes: 5 additions & 3 deletions example/GraphClientSimpleExample.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import time
import json

from nebula2.gclient.net import ConnectionPool
from nebula3.gclient.net import ConnectionPool

from nebula2.Config import Config
from nebula2.common import *
from nebula3.Config import Config
from nebula3.common import *
from FormatResp import print_resp

if __name__ == '__main__':
Expand Down Expand Up @@ -64,6 +64,8 @@
resp = client.execute('DROP SPACE test')
assert resp.is_succeeded(), resp.error_msg()

print("Example finished")

except Exception as x:
import traceback

Expand Down
8 changes: 4 additions & 4 deletions example/ScanVertexEdgeExample.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

sys.path.insert(0, '../')

from nebula2.Config import Config
from nebula2.gclient.net import ConnectionPool
from nebula2.mclient import MetaCache
from nebula2.sclient.GraphStorageClient import GraphStorageClient
from nebula3.Config import Config
from nebula3.gclient.net import ConnectionPool
from nebula3.mclient import MetaCache
from nebula3.sclient.GraphStorageClient import GraphStorageClient


def prepare_data():
Expand Down
22 changes: 0 additions & 22 deletions nebula2/gclient/net/__init__.py

This file was deleted.

File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion nebula2/__init__.py → nebula3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
# This source code is licensed under Apache 2.0 License.


from nebula2.common.ttypes import Value
from nebula3.common.ttypes import Value

Value.__hash__ = lambda self: self.value.__hash__()
File renamed without changes.
8 changes: 4 additions & 4 deletions nebula2/common/constants.py → nebula3/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

from __future__ import absolute_import
import sys
from nebula2.fbthrift.util.Recursive import fix_spec
from nebula2.fbthrift.Thrift import TType, TMessageType, TPriority, TRequestContext, TProcessorEventHandler, TServerInterface, TProcessor, TException, TApplicationException, UnimplementedTypedef
from nebula2.fbthrift.protocol.TProtocol import TProtocolException
from nebula3.fbthrift.util.Recursive import fix_spec
from nebula3.fbthrift.Thrift import TType, TMessageType, TPriority, TRequestContext, TProcessorEventHandler, TServerInterface, TProcessor, TException, TApplicationException, UnimplementedTypedef
from nebula3.fbthrift.protocol.TProtocol import TProtocolException



from .ttypes import UTF8STRINGS, NullType, PropertyType, ErrorCode, SchemaID, Date, Time, DateTime, Value, NList, NMap, NSet, Row, DataSet, Coordinate, Point, LineString, Polygon, Geography, Tag, Vertex, Edge, Step, Path, HostAddr, KeyValue, Duration, LogInfo, DirInfo, CheckpointInfo, LogEntry, ClusterID, GraphSpaceID, PartitionID, TagID, EdgeType, EdgeRanking, LogID, TermID, Timestamp, IndexID, Port, SessionID, ExecutionPlanID

version = "2.6.0"
version = "3.0.0"

18 changes: 9 additions & 9 deletions nebula2/common/ttypes.py → nebula3/common/ttypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@

from __future__ import absolute_import
import sys
from nebula2.fbthrift.util.Recursive import fix_spec
from nebula2.fbthrift.Thrift import TType, TMessageType, TPriority, TRequestContext, TProcessorEventHandler, TServerInterface, TProcessor, TException, TApplicationException, UnimplementedTypedef
from nebula2.fbthrift.protocol.TProtocol import TProtocolException
from nebula3.fbthrift.util.Recursive import fix_spec
from nebula3.fbthrift.Thrift import TType, TMessageType, TPriority, TRequestContext, TProcessorEventHandler, TServerInterface, TProcessor, TException, TApplicationException, UnimplementedTypedef
from nebula3.fbthrift.protocol.TProtocol import TProtocolException



import pprint
import warnings
from nebula2.fbthrift import Thrift
from nebula2.fbthrift.transport import TTransport
from nebula2.fbthrift.protocol import TBinaryProtocol
from nebula2.fbthrift.protocol import TCompactProtocol
from nebula2.fbthrift.protocol import THeaderProtocol
from nebula3.fbthrift import Thrift
from nebula3.fbthrift.transport import TTransport
from nebula3.fbthrift.protocol import TBinaryProtocol
from nebula3.fbthrift.protocol import TCompactProtocol
from nebula3.fbthrift.protocol import THeaderProtocol
fastproto = None
try:
from nebula2.fbthrift.protocol import fastproto
from nebula3.fbthrift.protocol import fastproto
except ImportError:
pass
all_structs = []
Expand Down
4 changes: 2 additions & 2 deletions nebula2/data/DataObject.py → nebula3/data/DataObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

import pytz
from datetime import datetime, timezone, timedelta
from nebula2.Exception import (
from nebula3.Exception import (
InvalidValueTypeException,
InvalidKeyException,
OutOfRangeException,
)

from nebula2.common.ttypes import (
from nebula3.common.ttypes import (
Geography,
Value,
Vertex,
Expand Down
6 changes: 3 additions & 3 deletions nebula2/data/ResultSet.py → nebula3/data/ResultSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# This source code is licensed under Apache 2.0 License.


from nebula2.common.ttypes import ErrorCode
from nebula3.common.ttypes import ErrorCode

from nebula2.data.DataObject import DataSetWrapper
from nebula3.data.DataObject import DataSetWrapper


class ResultSet(object):
Expand Down Expand Up @@ -47,7 +47,7 @@ def is_succeeded(self):
def error_code(self):
"""if the response is failed, the service return the error code

:return: nebula2.common.ttypes.ErrorCode
:return: nebula3.common.ttypes.ErrorCode
"""
return self._resp.error_code

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

import sys

from nebula2.fbthrift.Thrift import TProcessor, TMessageType, TException
from nebula2.fbthrift.protocol import TProtocolDecorator, TMultiplexedProtocol
from nebula3.fbthrift.Thrift import TProcessor, TMessageType, TException
from nebula3.fbthrift.protocol import TProtocolDecorator, TMultiplexedProtocol

class TMultiplexedProcessor(TProcessor):
def __init__(self):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from __future__ import print_function
from __future__ import unicode_literals

from nebula2.fbthrift.protocol.TProtocol import *
from nebula3.fbthrift.protocol.TProtocol import *
from struct import pack, unpack

class TBinaryProtocol(TProtocolBase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from __future__ import unicode_literals

import sys
from nebula2.fbthrift.protocol.TProtocol import *
from nebula3.fbthrift.protocol.TProtocol import *
from struct import pack, unpack

__all__ = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
from __future__ import print_function
from __future__ import unicode_literals

from nebula2.fbthrift.protocol.TProtocol import TProtocolBase, TProtocolException
from nebula2.fbthrift.Thrift import TApplicationException, TMessageType
from nebula2.fbthrift.protocol.TBinaryProtocol import TBinaryProtocolAccelerated
from nebula2.fbthrift.protocol.TCompactProtocol import TCompactProtocolAccelerated
from nebula2.fbthrift.transport.THeaderTransport import THeaderTransport, CLIENT_TYPE
from nebula3.fbthrift.protocol.TProtocol import TProtocolBase, TProtocolException
from nebula3.fbthrift.Thrift import TApplicationException, TMessageType
from nebula3.fbthrift.protocol.TBinaryProtocol import TBinaryProtocolAccelerated
from nebula3.fbthrift.protocol.TCompactProtocol import TCompactProtocolAccelerated
from nebula3.fbthrift.transport.THeaderTransport import THeaderTransport, CLIENT_TYPE


class THeaderProtocolAccelerate(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
from __future__ import print_function
from __future__ import unicode_literals

from nebula2.fbthrift.protocol.TProtocol import TProtocolBase, TProtocolException
from nebula2.fbthrift.Thrift import TType
from nebula3.fbthrift.protocol.TProtocol import TProtocolBase, TProtocolException
from nebula3.fbthrift.Thrift import TType
import json, base64, sys

__all__ = ['TJSONProtocol', 'TJSONProtocolFactory']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
from __future__ import print_function
from __future__ import unicode_literals

from nebula2.fbthrift.Thrift import TMessageType
from nebula2.fbthrift.protocol import TProtocolDecorator
from nebula3.fbthrift.Thrift import TMessageType
from nebula3.fbthrift.protocol import TProtocolDecorator

SEPARATOR = ":"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from __future__ import print_function
from __future__ import unicode_literals

from nebula2.fbthrift.Thrift import *
from nebula3.fbthrift.Thrift import *

class TProtocolException(TException):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from __future__ import print_function
from __future__ import unicode_literals

from nebula2.fbthrift.protocol.TProtocol import TProtocolBase
from nebula3.fbthrift.protocol.TProtocol import TProtocolBase
from types import *

class TProtocolDecorator():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import json
import sys

from nebula2.fbthrift.protocol.TProtocol import TProtocolBase, TProtocolException
from nebula2.fbthrift.Thrift import TType
from nebula3.fbthrift.protocol.TProtocol import TProtocolBase, TProtocolException
from nebula3.fbthrift.Thrift import TType

JSON_OBJECT_START = b'{'
JSON_OBJECT_END = b'}'
Expand Down
Loading