feat: add initial implementation of Dragonfly Dfcache Python SDK with client and error handling #4448
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces an initial implementation of a lightweight, unofficial Python SDK for Dragonfly's
dfcacheoperations, targeting AI and data workflows. The SDK wraps the existingdfcacheCLI to provide a simple Python interface for common cache operations (stat, import, export, delete) and includes basic error handling and health checks. It also sets up the project structure, documentation, and basic testing.Key changes are as follows:
SDK Implementation and API:
DfCacheClientclass indragonfly_dfcache/client.py, providing methods for stat, import, export, delete, and health check operations by shelling out to thedfcacheCLI. Includes error handling and binary auto-detection logic.DfCacheError,NotFoundError,DaemonUnavailableError) for SDK error handling indragonfly_dfcache/errors.py.__init__.pyfor easy import.Project Structure and Documentation:
README.mddescribing features, usage examples, design, installation, and roadmap for the SDK.dfdaemon_cache.protodocumenting the subset of the Dragonfly daemon API relevant to dfcache operations, as a reference for future gRPC implementation.Packaging and Testing:
pyproject.tomlfor packaging, dependencies, development tools, and test configuration.test_client_basic.py) that uses a fake CLI binary to verify the main client operations and error handling.Related Issue
Types of changes
Checklist