-
Notifications
You must be signed in to change notification settings - Fork 14
feat(sdk): Add Python-available interfaces #95
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
base: master
Are you sure you want to change the base?
Conversation
## Enhance miniGU Python API with additional features This commit enhances the miniGU Python API with several new features: 1. Added performance configuration methods: - set_cache_size() - Configure query result cache size - set_thread_count() - Configure parallel execution threads - enable_query_logging() - Enable/disable query execution logging 2. Added performance statistics method: - get_performance_stats() - Retrieve database performance metrics 3. Added graph data structure creation methods: - create_node() - Create node objects - create_edge() - Create edge objects - create_path() - Create path objects 4. Improved asynchronous API support: - Fixed async context manager - Enhanced async close method 5. Translated all Chinese comments to English for better internationalization 6. Maintained full backward compatibility with existing API These enhancements provide a more complete Python API while maintaining compatibility with the Rust backend when available, and providing simulated implementations when Rust bindings are not available.
Merge pull request #25 from rick-five/master
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 an additional Markdown to describe:
- How to use the python interface
- The linking options you specified in the config.toml
- The interfaces you wrapped
minigu/python/minigu.py
Outdated
| raise ImportError("Rust bindings not available. miniGU requires Rust bindings to function.") | ||
|
|
||
|
|
||
| class Node: |
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.
use vertex instead of node
build.rs
Outdated
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.
why there are two build.rs here?
minigu/python/minigu.py
Outdated
| except (ImportError, ModuleNotFoundError): | ||
| # No longer provide simulated implementation warning, directly raise exception | ||
| HAS_RUST_BINDINGS = False | ||
| raise ImportError("Rust bindings not available. miniGU requires Rust bindings to function.") |
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.
L14-L28 is duplicate to init.py
minigu/python/minigu.py
Outdated
| metrics = result_dict.get("metrics", {}) | ||
| return QueryResult(schema, data, metrics) | ||
| except Exception as e: | ||
| # 根据具体的错误类型抛出更精确的异常 |
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.
remove the chinese comments here. And check the others
.github/workflows/ci.yml
Outdated
| else | ||
| source .venv/bin/activate | ||
| fi | ||
| echo "Running Python tests..." |
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.
prune the verbose command for debugging here.
|
|
||
| # Test that we can execute a simple query after graph creation | ||
| try: | ||
| result = self.db.execute("RETURN 'test' as result") |
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.
this query does not make sense. You should validate the schema
| try: | ||
| self.db.begin_transaction() | ||
| self.db.commit() | ||
| self.db.rollback() |
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.
this test makes no sense
| # Connection should be closed after context | ||
| self.assertFalse(db.is_connected) | ||
|
|
||
| def test_data_structures(self): |
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.
why test these functions? They did not create the objects in Rust side
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.
.node .Edge Path
Add files via upload
Title
Type
Scope
Description
Issue: #73
Key features include: