Registry / observability / whylabs-client

whylabs-client

JSON →
library0.6.16pypypi✓ verified 85d ago

The `whylabs-client` is a Python client library that provides a convenient way to interact with the WhyLabs API for end-to-end AI observability. It enables users to manage models, datasets, and monitors on the WhyLabs Platform. The library is automatically generated by the OpenAPI Generator project. Current version is 0.6.16.

pip install whylabs-client
INSTALL
IMPORT
SIG · WHYLABS-CLIENT
W
whylabs-client
observabilitypythonv0.6.16
Install
2.2s avg
Import
357ms
Disk
23MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6.16 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.377s · 24.5MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.2s · import 0.336s · 25MB
23MB installed
● package 23MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Configuration
from whylabs_client import Configuration
ApiClient
from whylabs_client import ApiClient
ApiClass
from whylabs_client.api import some_api
import whylabs_client.api
Directly importing specific API modules is preferred to avoid recursion depth issues with large OpenAPI specifications.

This quickstart demonstrates how to initialize the WhyLabs API client with an API key. It uses environment variables for secure credential management and sets up the basic `Configuration` and `ApiClient` objects. Replace `api_key_api` with the specific API module you intend to use (e.g., `dataset_profile_api`, `data_api`). Ensure your `WHYLABS_API_KEY` is set as an environment variable.

import os import whylabs_client from whylabs_client.api import api_key_api # Configure API key authorization configuration = whylabs_client.Configuration( host="https://api.whylabsapp.com" ) configuration.api_key['ApiKeyAuth'] = os.environ.get('WHYLABS_API_KEY', '') # It's good practice to set discard_unknown_keys to True if you encounter parsing issues # configuration.discard_unknown_keys = True try: with whylabs_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = api_key_api.ApiKeyApi(api_client) # Example: List user API keys (requires appropriate permissions) # This call might not be available or might require specific permissions/parameters # depending on your API key scope. This is illustrative. # response = api_instance.list_user_api_keys() # print(response) print("Successfully configured WhyLabs API client.") print("Ensure WHYLABS_API_KEY environment variable is set for actual API calls.") except whylabs_client.ApiException as e: print(f"Exception when calling WhyLabs API: {e}") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingWhyLabs, Inc. officially discontinued operations. While the platform has been open-sourced, future commercial support and active development from the original company are no longer available.
fix
Users should be aware that the library and platform are now community-driven. Consider exploring the open-source platform directly or `whylogs` for profiling, which remains actively maintained.
affects: All versions
gotchaImporting the entire `whylabs_client.api` or `whylabs_client.model` modules directly can lead to a `RecursionError: maximum recursion depth exceeded` if the generated OpenAPI specification is very large.
fix
Instead of `import whylabs_client.api` or `from whylabs_client import api`, use specific imports like `from whylabs_client.api.your_api_module import YourApiClass` and `from whylabs_client.model.your_model import YourModel`.
affects: All versions
gotchaWhyLabs API enforces profile and rate limits. Exceeding these quotas will result in a `TooManyRequests` error.
fix
Review WhyLabs' API limits documentation. Implement exponential backoff and retry logic in your application. Optimize profile uploads to stay within daily/hourly limits, e.g., by merging profiles before uploading if possible.
affects: All versions
Errors
Common errors & fixes
RecursionError: maximum recursion depth exceeded
Attempting to import large portions of the auto-generated client (`whylabs_client.api` or `whylabs_client.model`) at once, which can hit Python's default recursion limit due to the complexity of the OpenAPI spec.
fix
Refactor imports to be more specific, e.g., `from whylabs_client.api.your_api_module import YourApiClass` and `from whylabs_client.model.your_model import YourModel`. Alternatively, increase Python's recursion limit with `sys.setrecursionlimit(new_limit)` (use with caution).
whylabs_client.ApiException: (429) Too Many Requests
Your application has exceeded the API rate limits or profile limits set by the WhyLabs platform.
fix
Implement retry mechanisms with exponential backoff. Review your data ingestion strategy to ensure it adheres to WhyLabs' profile and rate limits. Consider aggregating data locally before uploading or adjusting your upload frequency.
Seeing more rows in WhyLabs than I had in my dataset
This typically occurs when the same dataset is logged multiple times. WhyLabs merges profiles uploaded for the same day (or hour), rather than overwriting previous ones.
fix
If duplicate profiles are not desired, ensure your logging mechanism only uploads a unique profile for a given time granularity. To remove existing duplicates, a new model might need to be created and backfilled with correct data, or contact support for options if still available.
Upgrade
Version history
0.6.16latest on PyPI · released Jan 13, 2025
Audit
Dependencies
whylogsoptionalOften used in conjunction to generate statistical profiles for upload to WhyLabs Platform.
whylabs-toolkitoptionalA higher-level client library built on `whylabs-client` for simplified interactions.
Agent activity
37 hits · last 30 days
node
34
OpenAI (training)
1
Resources
whylabs-client — pip install whylabs-client · libregistry