Orion Python Client (Meesho)
The `orion-py-client` is a Python client library developed by Meesho, designed to interact with the Orion Feature Store. Its primary function is to facilitate the pushing and producing of model features, as well as retrieving features' metadata. It aims to integrate machine learning workflows with the Orion Feature Store platform.
Common errors
-
ModuleNotFoundError: No module named 'orion_py_client'
cause The `orion-py-client` package is not installed in the current Python environment.fixRun `pip install orion-py-client` to install the package. -
An error occurred: Authentication failed (or similar connection error)
cause The provided `ORION_API_KEY` is incorrect, expired, or the `ORION_API_URL` is inaccessible or wrong. The client could not establish a connection or authenticate with the Orion Feature Store.fixVerify that `ORION_API_URL` points to the correct endpoint and `ORION_API_KEY` is valid and active. Check network connectivity to the Orion Feature Store. Consult your Orion Feature Store administrator for valid credentials. -
AttributeError: 'OrionClient' object has no attribute 'push_feature'
cause The method name `push_feature` (or similar, like `produce_feature`) used in the quickstart example might not be the actual method name exposed by the `OrionClient` class. This could be due to inferred API names.fixRefer to the actual source code or internal documentation of the `orion-py-client` to find the correct method names for interacting with features. If no documentation is available, inspect the `OrionClient` object's methods at runtime (e.g., using `dir(client)` or an IDE's autocomplete).
Warnings
- gotcha Public documentation for `orion-py-client` is scarce, making precise API usage and potential breaking changes difficult to ascertain without access to the internal Meesho project. Information regarding detailed API methods, data models, and specific integration patterns is largely inferred from the PyPI summary.
- breaking As a client library, breaking changes in the underlying Orion Feature Store API could lead to unexpected behavior or failures, even without a new client release. Always verify compatibility if the backend service is updated.
- gotcha Authentication relies on an API key and URL. Incorrect or expired credentials will result in connection failures or unauthorized access errors, which may not always be clearly distinguished without verbose logging from the service.
Install
-
pip install orion-py-client
Imports
- OrionClient
from orion_py_client import OrionClient
- Feature
from orion_py_client.models import Feature
Quickstart
import os
from orion_py_client import OrionClient
# Placeholder for Orion Feature Store URL and API Key
ORION_API_URL = os.environ.get('ORION_API_URL', 'http://localhost:8080')
ORION_API_KEY = os.environ.get('ORION_API_KEY', 'your_api_key_here')
try:
client = OrionClient(api_url=ORION_API_URL, api_key=ORION_API_KEY)
print(f"Successfully initialized OrionClient for {ORION_API_URL}")
# Example: Push a feature (assuming a 'Feature' model exists)
# This part is illustrative as exact data model and push method are not publicly documented.
feature_data = {
"feature_name": "user_login_count",
"entity_id": "user_123",
"value": 15,
"timestamp": "2026-04-16T10:00:00Z"
}
# Assuming a method like 'push_feature' or 'produce_feature'
# response = client.push_feature(feature_data)
# print(f"Pushed feature: {response}")
# Example: Get feature metadata
# metadata = client.get_feature_metadata(feature_name="user_login_count")
# print(f"Feature metadata: {metadata}")
except Exception as e:
print(f"An error occurred: {e}")
print("Please ensure ORION_API_URL and ORION_API_KEY are correctly set.")