Registry / ai-ml / dtlpymetrics

dtlpymetrics

JSON →
library1.2.32pypypi✓ verified 23d ago

Dataloop Metrics (dtlpymetrics) is a Python library that provides scoring and metrics functionality specifically for Dataloop AI projects. It allows users to define, calculate, and report custom metrics on datasets and annotation sets within the Dataloop platform. The current version is 1.2.32. Its release cadence is tied to the Dataloop platform and SDK updates, typically receiving frequent minor updates.

pip install dtlpymetrics
INSTALL
IMPORT
SIG · DTLPYMETRICS
D
dtlpymetrics
ai-mlpythonv1.2.32
Install
20.5s avg
Import
Disk
324MB
Pass rate
9/ 10
Env Coverage9 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.32 · 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
glibc
py 3.10
✓ —
✓ 21.2s
py 3.11
✓ —
✓ 19.1s
py 3.12
✓ —
✓ 18.4s
py 3.13
✓ —
✓ 19.2s
py 3.9
✕ build_error
✓ 24.6s
324MB installed
● package 324MB
Code
Verified usage

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

DataloopMetrics
from dtlpymetrics.dtlpm import DataloopMetrics

Initializes the DataloopMetrics client, ensures Dataloop SDK login, and reports a sample score to a specific project and dataset. Requires an active Dataloop account, `dtlpy` SDK, and a pre-defined metric on the Dataloop platform.

import dtlpy as dl from dtlpymetrics.dtlpm import DataloopMetrics import os # Ensure Dataloop SDK is logged in or configured try: if not dl.token_expired(): print("Already logged into Dataloop SDK.") else: # Replace with your actual Dataloop token or ensure `dl.login()` is called elsewhere dl.login(token=os.environ.get('DATALOOP_API_TOKEN', '')) except Exception as e: print(f"Failed to login to Dataloop SDK. Please ensure 'dtlpy' is installed and you are logged in or DATALOOP_API_TOKEN is set. Error: {e}") exit(1) # 1. Initialize the metrics client metrics_client = DataloopMetrics() # 2. Define your target Dataloop Project and Dataset IDs # Replace 'YOUR_PROJECT_ID' and 'YOUR_DATASET_ID' with actual IDs or set environment variables. project_id = os.environ.get('DATALOOP_PROJECT_ID', 'YOUR_PROJECT_ID') dataset_id = os.environ.get('DATALOOP_DATASET_ID', 'YOUR_DATASET_ID') # Check if placeholder IDs are still present to guide the user if project_id == 'YOUR_PROJECT_ID' or dataset_id == 'YOUR_DATASET_ID': print("Warning: Please replace 'YOUR_PROJECT_ID' and 'YOUR_DATASET_ID' with actual Dataloop IDs or set the DATALOOP_PROJECT_ID/DATALOOP_DATASET_ID environment variables.") exit(1) # For demonstration, use a placeholder metric_id and score metric_id = "example_accuracy_score" score_value = 0.85 # 3. Report a score try: # Before reporting, ensure the metric_id exists in your Dataloop project/dataset. # You can create metrics using metrics_client.metrics_create() if needed. metrics_client.metrics_report_score( metric_id=metric_id, score=score_value, project_id=project_id, dataset_id=dataset_id # Optional: Link to specific entities with filters or entity_id/entity_type # filters=dl.Filters(resource=dl.FiltersResource.ITEM).add(field='filename', values=['my_image.jpg']), # entity_id='your-item-id', # entity_type='item' ) print(f"Successfully reported score {score_value} for metric '{metric_id}' to Dataloop.") except Exception as e: print(f"Failed to report score: {e}. Make sure the metric_id exists and you have correct permissions for project '{project_id}' and dataset '{dataset_id}'.")
Debug
Known issues
breakingThe `dtlpymetrics` library is tightly coupled with the `dtlpy` SDK. Breaking changes or version mismatches in `dtlpy` (especially major versions or specific `~=` ranges) can lead to unexpected behavior or API errors in `dtlpymetrics`.
fix
Always install `dtlpymetrics` alongside a compatible `dtlpy` version, paying attention to the `~=` dependency specified in `dtlpymetrics`'s `setup.py`. Upgrade both libraries in tandem to maintain compatibility.
affects: All versions
gotchaBefore reporting scores, the specified `metric_id` must be pre-defined within the Dataloop platform (associated with your project/dataset). Attempting to report to a non-existent metric will result in a `DLServerError`.
fix
Use `metrics_client.metrics_create()` to programmatically define new metrics, or ensure they are configured manually through the Dataloop platform UI, before attempting `metrics_report_score()`.
affects: All versions
gotchaAll operations in `dtlpymetrics` require active authentication with the Dataloop platform via the `dtlpy` SDK. Additionally, providing correct Dataloop entity IDs (project_id, dataset_id, item_id, annotation_id, etc.) is crucial for successful metric operations.
fix
Ensure `dtlpy.login()` is successfully called prior to using `DataloopMetrics`. Double-check all Dataloop entity IDs to ensure they are valid and belong to the correct context (e.g., project_id for dataset_id) and that the authenticated user has the necessary permissions.
affects: All versions
Upgrade
Version history
1.2.32latest on PyPI · released Feb 26, 2026
Audit
Dependencies
dtlpyrequiredRequired for all Dataloop API interactions (authentication, project/dataset management, entity IDs). Version `~=1.x.x` is typically required based on `dtlpymetrics` setup.
numpyrequiredNumerical operations within the library.
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources