-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat(client): Implement new api & optimize code structure #63
Conversation
…v3 support This commit introduces significant updates to the hugegraph-python-client module, focusing on GraphSpace compatibility and API v3 support. Key changes include: - Unified connection configuration via HGraphConfig to streamline parameter management. - Enhanced HGraphSession for unified HTTP calls with optimized URL handling. - Automatic GraphSpace detection based on server API version, ensuring compatibility with both old and new server versions. - Refactored HGraphContext and HGraphRouter for more structured URL definitions using a decorator approach. - Introduction of the @http decorator for simplified HTTP method and path definitions. - Extensive compatibility testing to ensure a seamless experience across different server versions. The update aims to provide a robust and flexible client module for interacting with HugeGraph servers, catering to the needs of both new and existing API versions.
TODO: replace it in the LLM module later
@@ -46,7 +48,7 @@ class CustomConsoleHandler(logging.StreamHandler): | |||
"INFO": "\033[0;32m", # Green | |||
"WARNING": "\033[0;33m", # Yellow | |||
"ERROR": "\033[0;31m", # Red | |||
"CRITICAL": "\033[0;41m" # Red background | |||
"CRITICAL": "\033[0;41m", # Red background |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra ,
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
black-formatter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
black-formatter
OK, just keep it
hugegraph-python-client/README.md
Outdated
@@ -17,7 +17,7 @@ release soon | |||
```python | |||
from pyhugegraph.client import PyHugeClient | |||
|
|||
client = PyHugeClient("127.0.0.1", "8080", user="admin", pwd="admin", graph="hugegraph") | |||
client = PyHugeClient("127.0.0.1", "8080", user="admin", pwd="admin", graph="hugegraph", gs="DEFAULT") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- add a comment for this line (like
gs
is optional) - currently
gs
compatible withgraphspace
? (set as alias)
Enhanced Naming Convention Support: Introduced support for underscore-named function calls in addition to existing camelCase naming convention. This allows for greater flexibility and compatibility with different coding styles and external libraries.
Expanded index_label Types: Augmented the index_label functionality by adding support for shard and unique types. These additional types provide enhanced indexing capabilities that enable more sophisticated data organization and retrieval scenarios, improving overall performance and scalability.
New Rank API Implementation: Implemented a new rank API to support ranking and sorting of data based on specified criteria. This feature enables applications to easily incorporate ranking logic into their workflows, enhancing user experience by presenting the most relevant or prioritized information first.
Optimized HTTP Invocation and Response Handling: Refactored HTTP client invocations to utilize a more streamlined approach. Introduced ResponseValidation for managing response checks, effectively reducing the need for explicit check_if_success calls in multiple locations. This optimization not only simplifies code but also enhances its maintainability and readability, making it easier to identify and resolve potential issues related to HTTP response handling.
TODO: