{"id":3475,"library":"dvc-studio-client","title":"DVC Studio Client","description":"dvc-studio-client is a Python library designed to facilitate posting data from DVC (Data Version Control) and DVCLive to Iterative Studio. It provides functionalities for managing the Model Registry, sending Live Experiment updates, and handling Studio authentication. The library is currently at version 0.22.0 and maintains a regular release cadence, with recent updates focused on Python version support and Studio URL alignment.","status":"active","version":"0.22.0","language":"en","source_language":"en","source_url":"https://github.com/iterative/dvc-studio-client","tags":["dvc","dvclive","mlops","machine learning","experiment tracking","model registry","iterative studio"],"install":[{"cmd":"pip install dvc-studio-client","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Used for Git repository operations.","package":"dulwich","optional":false},{"reason":"Handles HTTP requests to the Studio API.","package":"requests","optional":false},{"reason":"Used for data validation.","package":"voluptuous","optional":false}],"imports":[{"symbol":"post_live_metrics","correct":"from dvc_studio_client import post_live_metrics"},{"symbol":"get_access_token","correct":"from dvc_studio_client import get_access_token"}],"quickstart":{"code":"import os\nfrom dvc_studio_client import post_live_metrics, get_access_token\n\n# A real token would be obtained from Iterative Studio or DVC CLI configuration\nstudio_token = os.environ.get(\"DVC_STUDIO_TOKEN\", \"your_studio_token_here\")\nif studio_token == \"your_studio_token_here\":\n    print(\"WARNING: DVC_STUDIO_TOKEN not set. Using placeholder.\")\n\n# Mock metrics and parameters for an experiment\nmetrics_data = {\n    \"exp_name\": \"my-first-studio-experiment\",\n    \"metrics\": {\"train/accuracy\": 0.88, \"val/loss\": 0.12},\n    \"params\": {\"learning_rate\": 0.005, \"batch_size\": 64, \"epochs\": 10},\n    \"step\": 50,\n    \"dvc_env\": {\"dvc_version\": \"3.0.0\"}\n}\n\ntry:\n    # Post metrics to Iterative Studio\n    # Replace 'https://github.com/iterative/example-repo.git' with your actual repository URL\n    # Replace 'abcdef0123...' with a real Git commit SHA (e.g., from your baseline experiment)\n    response = post_live_metrics(\n        token=studio_token,\n        repo_url=\"https://github.com/iterative/example-repo.git\",\n        baseline_sha=\"abcdef0123456789abcdef0123456789abcdef01\", \n        **metrics_data\n    )\n    print(f\"Successfully posted metrics. Response: {response.get('url', 'N/A')}\")\nexcept Exception as e:\n    print(f\"Failed to post metrics: {e}\")\n\n# The get_access_token function is typically used in more interactive/programmatic authentication flows.\n# For quickstart, we acknowledge its presence. Actual usage might open a browser.\n# print(f\"get_access_token function is available: {get_access_token}\")\n","lang":"python","description":"This quickstart demonstrates how to use `dvc-studio-client` to post live experiment metrics to Iterative Studio. It simulates an experiment run, capturing metrics and parameters, and then uses the `post_live_metrics` function to send this data. Ensure you have a DVC_STUDIO_TOKEN environment variable set or replace the placeholder."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Python 3.8 support was dropped in version 0.21.0. Users on Python 3.8 or older must upgrade their Python environment to 3.9 or newer to use versions 0.21.0 and later.","severity":"breaking","affected_versions":">=0.21.0"},{"fix":"Upgrade `dvc-studio-client` to the latest version to ensure it uses the correct Studio endpoint.","message":"The default Studio URL was updated in versions 0.21.0 and 0.22.0. Older client versions might attempt to connect to an outdated domain, leading to connection issues.","severity":"breaking","affected_versions":">=0.21.0"},{"fix":"Update calls from `initiate_authentication` to `get_access_token`. Review and adapt any custom authentication logic to the new `Authentication` terminology and structure.","message":"Authentication functions were renamed and refactored in versions 0.17.0 and 0.17.1. `initiate_authentication` was renamed to `get_access_token` in 0.17.0, and a broader refactoring from 'Authorization' to 'Authentication' occurred in 0.17.1.","severity":"breaking","affected_versions":">=0.17.0"},{"fix":"Consider passing the `subdir` argument to `post_live_metrics` if your project utilizes a monorepo structure and requires sub-directory context for experiments in Studio.","message":"Version 0.20.0 introduced optional `subdir` information for monorepos within the schema and `post_live_metrics`. If you are operating within a monorepo structure and need to differentiate experiments by subdirectory, you might need to update your data posting logic.","severity":"gotcha","affected_versions":">=0.20.0"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}