grpc_feature_client
High-performance gRPC client for BharatML Stack real-time feature operations with direct API access.
Installation
pip install grpc_feature_client
Dependencies
This package depends on:
- bharatml_commons: Common utilities and protobuf definitions
- grpcio>=1.50.0: gRPC framework
- grpcio-tools>=1.50.0: gRPC tools for protobuf
Features
- Direct gRPC API: persist, retrieve, retrieveDecoded operations
- Go SDK Compatible: Same authentication and API semantics
- Batch Processing: Automatic batching with parallel execution
- Real-time Focus: Low-latency feature persistence and retrieval
- Context Management: Timeout and metadata handling
- Connection Pooling: Efficient connection management
Quick Start
from grpc_feature_client import GRPCFeatureClient, GRPCClientConfig
# Configure for real-time operations
config = GRPCClientConfig(
server_address="localhost:50051",
job_id="realtime-service",
job_token="api-token"
)
client = GRPCFeatureClient(config)
# Direct API operations
result = client.persist_features(entity_label, keys_schema, feature_groups, data)
features = client.retrieve_decoded_features(entity_label, feature_groups, keys, entity_keys)
API Reference
GRPCFeatureClient
class GRPCFeatureClient:
def __init__(self, config: GRPCClientConfig)
def persist_features(
self,
entity_label: str,
keys_schema: List[str],
feature_group_schemas: List[Dict[str, Any]],
data_rows: List[Dict[str, Any]],
timeout: Optional[float] = None
) -> Dict[str, Any]
def retrieve_features(
self,
entity_label: str,
feature_groups: List[Dict[str, Any]],
keys_schema: List[str],
entity_keys: List[List[str]],
timeout: Optional[float] = None
) -> Dict[str, Any]
def retrieve_decoded_features(
self,
entity_label: str,
feature_groups: List[Dict[str, Any]],
keys_schema: List[str],
entity_keys: List[List[str]],
timeout: Optional[float] = None
) -> Dict[str, Any]
GRPCClientConfig
class GRPCClientConfig:
def __init__(
self,
server_address: str,
job_id: str,
job_token: str,
use_tls: bool = False,
timeout_seconds: float = 30.0,
metadata: Dict[str, str] = None,
max_receive_message_length: int = 4 * 1024 * 1024,
max_send_message_length: int = 4 * 1024 * 1024
)
Usage Examples
Persisting Features
from grpc_feature_client import GRPCFeatureClient, GRPCClientConfig
config = GRPCClientConfig(
server_address="feature-store.example.com:50051",
job_id="model-inference-service",
job_token="api-token"
)
client = GRPCFeatureClient(config)
# Persist real-time features
result = client.persist_features(
entity_label="user_interaction",
keys_schema=["user_id", "session_id"],
feature_group_schemas=[{
"label": "realtime_features",
"feature_labels": ["click_count", "page_views"]
}],
data_rows=[{
"user_id": "u123",
"session_id": "s456",
"click_count": 5,
"page_views": 3
}]
)
print(f"Persist result: {result}")
Retrieving Features
# Retrieve features for ML model inference
features = client.retrieve_decoded_features(
entity_label="user_interaction",
feature_groups=[{
"label": "user_features",
"feature_labels": ["age", "location"]
}],
keys_schema=["user_id"],
entity_keys=[["u123"], ["u456"]]
)
print(f"Retrieved features: {features}")
With Context Management
# Use client with automatic cleanup
with GRPCFeatureClient(config) as client:
result = client.persist_features(...)
features = client.retrieve_decoded_features(...)
# Connection automatically closed
When to Use
Use grpc_feature_client for:
- 🚀 Real-time Operations: Direct persist/retrieve operations
- 🔍 Interactive Queries: Low-latency feature lookups
- 🎯 API Integration: Service-to-service communication
- 💨 Single Records: Persisting individual feature records
- 🔄 Model Serving: Feature retrieval for online inference
Use spark_feature_push_client for:
- 🔄 Batch ETL Pipelines: Scheduled feature computation and publishing
- 📊 Historical Data Backfill: Loading historical features into online store
- 🏗️ Data Engineering: Spark-based feature transformations
- 📈 Large Scale Processing: Processing millions of records efficiently
Related Packages
This package is part of the BharatML Stack ecosystem:
- bharatml_commons: Common utilities and protobuf definitions (required dependency)
- spark_feature_push_client: Spark-based data pipeline client
Contributing
We welcome contributions from the community! Please see our Contributing Guide for details on how to get started.
Community & Support
- 💬 Discord: Join our community chat
- 🐛 Issues: Report bugs and request features on GitHub Issues
- 📧 Email: Contact us at ml-oss@meesho.com
License
BharatMLStack is open-source software licensed under the BharatMLStack Business Source License 1.1.
Metadata
Release files for grpc-feature-client 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| grpc_feature_client-1.0.1.tar.gz | 10.9 kB | Without provenance | Details for grpc_feature_client-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| grpc_feature_client-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for grpc_feature_client-1.0.1-py3-none-any.whl |
Total release size: 23.3 kB
Release files / grpc_feature_client-1.0.1.tar.gz
| Download URL | grpc_feature_client-1.0.1.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74abf9bff4bd5791a1818293494fe82626b8d86aba159279c7cd385aa1eecd50
|
|
BLAKE2b-256 checksum How to use checksums |
5f3ec5392829c43fb398bb4b08c4df8258323a56301fcbad59713411ba35af27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Release files / grpc_feature_client-1.0.1-py3-none-any.whl
| Download URL | grpc_feature_client-1.0.1-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6928750cce2e1ab8a50b0e9bcf2dc6574c626f07fb5d42b82a556d3c1a1966e9
|
|
BLAKE2b-256 checksum How to use checksums |
9864710b5987df32937330e91ee00de39a0ac0d0c93c65472700bdb8550edb1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Security for grpc-feature-client 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.