### Install Tecton HTTP Client Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/docs/quickstart.rst Installs the Tecton HTTP Client library using pip. This is the first step to interact with the Tecton feature store via HTTP. ```bash pip install tecton-client ``` -------------------------------- ### Install and Configure Pre-commit Hooks Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/CONTRIBUTING.md Installs the pre-commit framework and sets up its hooks for the project. Pre-commit runs checks automatically before each commit to enforce code style and quality. ```bash pip install pre-commit pre-commit install ``` -------------------------------- ### Setup Python Virtual Environment Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/CONTRIBUTING.md Creates a new Python virtual environment named 'test_venv' and activates it. This isolates project dependencies. ```bash python -m venv test_venv . ./test_venv/bin/activate ``` -------------------------------- ### Install Tecton Python Client (Bash) Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/README.md Installs the Tecton client library for Python using pip. This is the primary method to get the library onto your system before you can import and use it in your Python projects. ```bash pip install tecton-client ``` -------------------------------- ### TectonClient Synchronous Usage Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/docs/quickstart.rst Demonstrates how to initialize and use the synchronous TectonClient to fetch features from Tecton. It shows setting up the client with URL, API key, and default workspace, then making a get_features request. ```python from tecton_client import TectonClient client = TectonClient( url="https://explore.tecton.ai/", api_key="my-api-key", default_workspace_name="prod", ) resp = client.get_features( feature_service_name="fraud_detection_feature_service:v2", join_key_map={"user_id": "user_4407104885"}, request_context_map={"amount": 500.00}, ) print(resp.result.features) ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/CONTRIBUTING.md Installs the project's Python dependencies in editable mode, including the test extras. This command is typically run after setting up the virtual environment. ```bash pip install -e ".[test]" ``` -------------------------------- ### AsyncTectonClient Usage Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/docs/quickstart.rst Illustrates the usage of the asynchronous TectonClient for non-blocking I/O operations. It includes an example of defining and running an async function to fetch features, suitable for high-performance applications. ```python import asyncio from tecton_client import AsyncTectonClient async_client = AsyncTectonClient( url="https://explore.tecton.ai/", api_key="my-api-key", default_workspace_name="prod", ) async def fetch_data(): resp = async_client.get_features( feature_service_name="fraud_detection_feature_service:v2", join_key_map={"user_id": "user_4407104885"}, request_context_map={"amount": 500.00}, ) print(resp.result.features) asyncio.run(fetch_data()) ``` -------------------------------- ### Build Project Documentation Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/CONTRIBUTING.md Installs documentation dependencies and builds the project's documentation in HTML format using Sphinx. The output is placed in the 'docs/_build' directory. ```bash pip install docs/requirements.txt sphinx-build -M html docs/ docs/_build ``` -------------------------------- ### AsyncTectonClient Usage in Jupyter Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/docs/quickstart.rst Shows how to use the AsyncTectonClient directly within a Jupyter notebook environment using the await keyword without needing asyncio.run(). ```python import asyncio from tecton_client import AsyncTectonClient async_client = AsyncTectonClient( url="https://explore.tecton.ai/", api_key="my-api-key", default_workspace_name="prod", ) print( await async_client.get_features( feature_service_name="fraud_detection_feature_service:v2", join_key_map={"user_id": "user_4407104885"}, request_context_map={"amount": 500.00}, ) ) ``` -------------------------------- ### Run Project Tests Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/CONTRIBUTING.md Executes the project's test suite using pytest. This verifies that the development setup is correct and that existing functionality is working as expected. ```bash pytest tests ``` -------------------------------- ### Use Tecton Python Client to Fetch Features (Python) Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/README.md Demonstrates how to initialize the TectonClient and retrieve online features. It shows setting up the client with the Tecton URL, default workspace, and API key, then making a `get_features` call with a specific feature service and join key mapping. ```python from tecton_client import TectonClient url = "https://explore.tecton.ai/" workspace = "prod" api_key = "my-secret-key" client = TectonClient(url=url, default_workspace_name=workspace, api_key=api_key) resp = client.get_features( feature_service_name="fraud_detection_feature_service:v2", join_key_map={"user_id": "user_4407104885"}, request_context_map={"amount": 500.00}, ) print(resp.get_features_dict()) ``` -------------------------------- ### TectonClient Class Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/docs/tecton_client.rst Represents the synchronous client for interacting with Tecton. It provides methods for fetching features and managing client configurations. The __init__ method initializes the client with optional request options. ```APIDOC TectonClient: __init__(request_options: RequestOptions = None) Initializes the synchronous Tecton client. Parameters: request_options: Optional configuration for requests, including timeouts and retry strategies. ``` -------------------------------- ### AsyncTectonClient Class Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/docs/tecton_client.rst Represents the asynchronous client for interacting with Tecton. It offers non-blocking methods for fetching features and managing client configurations. The __init__ method initializes the client with optional request options. ```APIDOC AsyncTectonClient: __init__(request_options: RequestOptions = None) Initializes the asynchronous Tecton client. Parameters: request_options: Optional configuration for requests, including timeouts and retry strategies. ``` -------------------------------- ### MetadataOptions Class Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/docs/tecton_client.rst Configuration options for metadata retrieval. This class allows specifying how metadata should be handled during client operations. It excludes the 'to_request' method from its public interface. ```APIDOC MetadataOptions: __init__(include_feature_values: bool = False, include_input_join_keys: bool = False, include_input_request_context_keys: bool = False, include_output_join_keys: bool = False) Initializes metadata options. Parameters: include_feature_values: Whether to include feature values in metadata. include_input_join_keys: Whether to include input join keys in metadata. include_input_request_context_keys: Whether to include input request context keys in metadata. include_output_join_keys: Whether to include output join keys in metadata. ``` -------------------------------- ### RequestOptions Class Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/docs/tecton_client.rst Configuration options for making HTTP requests. This class allows customization of timeouts, retries, and other request-related behaviors. It excludes the 'to_request' method. ```APIDOC RequestOptions: __init__(timeout: float = 10.0, retries: int = 3, backoff_factor: float = 0.5) Initializes request options. Parameters: timeout: The request timeout in seconds. retries: The number of times to retry a failed request. backoff_factor: The factor to use for exponential backoff between retries. ``` -------------------------------- ### GetFeaturesResponse Object Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/docs/tecton_client.rst Represents the response structure for fetching features. This object contains the results, metadata, and potentially other information related to a feature retrieval request. It excludes methods like 'result', 'metadata', and 'from_response' from direct instantiation. ```APIDOC GetFeaturesResponse: result: dict The primary data payload containing feature values. metadata: dict Additional metadata associated with the feature retrieval. ``` -------------------------------- ### GetFeatureServiceMetadataResponse Object Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/docs/tecton_client.rst Represents the response structure for fetching feature service metadata. This object encapsulates details about the feature service, including its type, join keys, and context keys. It excludes methods like 'from_response', 'input_join_keys', 'input_request_context_keys', 'feature_values', and 'feature_service_type' from direct instantiation. ```APIDOC GetFeatureServiceMetadataResponse: feature_service_type: str The type of the feature service. input_join_keys: list[str] A list of join keys required by the feature service. input_request_context_keys: list[str] A list of request context keys required by the feature service. feature_values: list[str] A list of feature names available in the service. output_join_keys: list[str] A list of join keys present in the service's output. ``` -------------------------------- ### tecton_client.exceptions Module Source: https://github.com/tecton-ai/tecton-http-client-python/blob/main/docs/tecton_client.rst Contains custom exception classes for handling errors within the tecton-client package. These exceptions provide specific error information for various failure scenarios, such as network issues or invalid requests. It includes members that show inheritance from base exception classes. ```APIDOC tecton_client.exceptions: TectonException(Exception) Base exception for all Tecton client errors. TectonClientException(TectonException) Base exception for errors originating from the Tecton client. TectonAPIException(TectonClientException) Exception raised for errors returned by the Tecton API. Attributes: status_code: The HTTP status code of the error response. response_body: The body of the error response from the API. TectonConnectionException(TectonClientException) Exception raised for network-related connection errors. TectonTimeoutException(TectonClientException) Exception raised when a request exceeds the configured timeout. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.