{"id":9698,"library":"dominodatalab","title":"Python Domino API Client","description":"The `dominodatalab` library provides official Python bindings for the Domino Data Lab API, enabling programmatic interaction with Domino projects, jobs, models, and environments. As of version 2.1.0, it supports advanced features like agentic workflow tracing and enhanced job control. The library maintains an active release cadence, with major updates and minor patches released regularly.","status":"active","version":"2.1.0","language":"en","source_language":"en","source_url":"https://github.com/dominodatalab/python-domino","tags":["api-client","data-science","mlops","domino"],"install":[{"cmd":"pip install dominodatalab","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Used for HTTP communication with the Domino API.","package":"requests"},{"reason":"Used for immutable dictionary structures, minimum version 2.3.0.","package":"frozendict"},{"reason":"Provides backports of standard library typing features. Version constraints have been relaxed for Python 3.10+ in v2.1.0.","package":"typing-extensions"},{"reason":"Used for MLflow integration with Domino. The package is pinned to `>=1.20`.","package":"mlflow"},{"reason":"HTTP client library, pinned to `>=1.25.11,<3`.","package":"urllib3"}],"imports":[{"note":"The top-level package name on PyPI is 'dominodatalab', but the primary module for import is 'domino'.","wrong":"from dominodatalab import Domino","symbol":"Domino","correct":"from domino import Domino"},{"note":"The 'aisystems' module was renamed to 'agents' in version 2.0.0.","wrong":"from domino.aisystems.logging import DominoAgentContext","symbol":"DominoAgentContext","correct":"from domino.agents.logging import DominoAgentContext"}],"quickstart":{"code":"import os\nfrom domino import Domino\n\n# Configure environment variables (replace with your actual values or ensure they are set)\n# DOMINO_API_HOST: e.g., 'https://your.domino.url'\n# DOMINO_USER_API_KEY: Your Domino API key\n# DOMINO_PROJECT_OWNER: The username of the project owner\n# DOMINO_PROJECT_NAME: The name of the project\n\ndomino = Domino(\n    host=os.environ.get(\"DOMINO_API_HOST\", \"\"),\n    api_key=os.environ.get(\"DOMINO_USER_API_KEY\", \"\"),\n    project_owner=os.environ.get(\"DOMINO_PROJECT_OWNER\", \"\"),\n    project_name=os.environ.get(\"DOMINO_PROJECT_NAME\", \"\")\n)\n\n# Example: List projects accessible by the user\ntry:\n    # Ensure required environment variables are set\n    if not all([domino.host, domino.api_key, domino.project_owner, domino.project_name]):\n        raise ValueError(\"Missing one or more required environment variables for Domino API access.\")\n\n    print(f\"Attempting to connect to Domino at {domino.host}...\")\n    projects = domino.projects_list()\n    print(f\"Successfully connected. Found {len(projects)} projects accessible by user: {domino.project_owner}.\")\n    if projects:\n        print(f\"First project: {projects[0].name}\")\nexcept Exception as e:\n    print(f\"Error connecting to Domino or listing projects: {e}\")\n    print(\"Please ensure DOMINO_API_HOST, DOMINO_USER_API_KEY, DOMINO_PROJECT_OWNER, DOMINO_PROJECT_NAME are correctly set.\")\n","lang":"python","description":"Initializes the Domino client using environment variables for host, API key, project owner, and project name, then attempts to list projects as a basic connectivity test. This pattern is recommended for secure credential management."},"warnings":[{"fix":"Update all import statements and references from `domino.aisystems` to `domino.agents`.","message":"The `domino.aisystems` module was renamed to `domino.agents` in version 2.0.0. Code using `domino.aisystems` imports or functionality will break.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Verify that `DOMINO_API_HOST`, `DOMINO_USER_API_KEY`, `DOMINO_PROJECT_OWNER`, and `DOMINO_PROJECT_NAME` environment variables are correctly set and accessible to your Python process.","message":"Incorrect or missing API credentials (host, API key, project owner, project name) are the most common cause of client initialization failures or HTTP errors (e.g., 401 Unauthorized, 404 Not Found).","severity":"gotcha","affected_versions":"All versions"},{"fix":"If encountering dependency conflicts, try upgrading to the latest `dominodatalab` version. If the issue persists, consider isolating the environment (e.g., using `venv` or Docker) or carefully reviewing dependency trees with `pip check` or `pipdeptree`.","message":"The library has historically pinned specific versions of dependencies like `typing-extensions` and `mlflow`. While `typing-extensions` constraints were relaxed in 2.1.0 for Python 3.10+, older versions or specific environments might still encounter dependency conflicts with other libraries.","severity":"gotcha","affected_versions":"<2.1.0 (for typing-extensions), All versions (for general dependency conflicts)"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Update your import statements from `from domino.aisystems import ...` to `from domino.agents import ...`.","cause":"Attempting to import from the old `domino.aisystems` module after upgrading to `dominodatalab` version 2.0.0 or newer.","error":"ModuleNotFoundError: No module named 'domino.aisystems'"},{"fix":"Verify your `DOMINO_USER_API_KEY` in the Domino UI and ensure it matches the environment variable. Check if the key has the necessary permissions (e.g., project access, API access).","cause":"The provided `DOMINO_USER_API_KEY` is either incorrect, expired, or does not have sufficient permissions for the requested operation.","error":"requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: ..."},{"fix":"Double-check the `DOMINO_API_HOST` URL, and confirm the exact spelling and case for `DOMINO_PROJECT_OWNER` and `DOMINO_PROJECT_NAME` as they appear in Domino Data Lab.","cause":"The specified `DOMINO_API_HOST`, `DOMINO_PROJECT_OWNER`, or `DOMINO_PROJECT_NAME` is incorrect, leading the API client to request a non-existent resource.","error":"requests.exceptions.HTTPError: 404 Client Error: Not Found for url: ..."},{"fix":"Ensure all necessary environment variables are properly defined and accessible before initializing the `Domino` client. Print `os.environ.get('VAR_NAME')` to confirm their values.","cause":"One or more required environment variables (e.g., `DOMINO_API_HOST`, `DOMINO_USER_API_KEY`) were not set, resulting in `None` being passed to the `Domino` client constructor, leading to subsequent errors when trying to use `None` as a string.","error":"TypeError: 'NoneType' object is not callable (or similar error during client initialization)"}]}