{"id":2453,"library":"dagster-cloud-cli","title":"Dagster Cloud CLI","description":"The `dagster-cloud-cli` provides command-line tools for interacting with Dagster Cloud, enabling operations such as deploying code, managing agents, and configuring workspaces. It is the primary interface for developers to manage their Dagster deployments in a Dagster Cloud environment. The current version is 1.13.0, with releases tightly coupled to the broader Dagster ecosystem's frequent update cadence.","status":"active","version":"1.13.0","language":"en","source_language":"en","source_url":"https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-cloud-cli","tags":["cli","dagster","cloud","orchestration","deployment"],"install":[{"cmd":"pip install dagster-cloud-cli","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core Dagster library, required for defining pipelines and assets.","package":"dagster","optional":false},{"reason":"Python SDK for programmatic interaction with Dagster Cloud.","package":"dagster-cloud","optional":false}],"imports":[],"quickstart":{"code":"import subprocess\nimport os\n\n# The dagster-cloud-cli is primarily used via the 'dg' command in the terminal.\n# This quickstart demonstrates checking its version programmatically.\n\ntry:\n    # This runs a basic 'dg --version' command to verify installation.\n    # For actual Dagster Cloud operations (e.g., 'dg deploy'), you would typically\n    # execute commands directly in your shell or CI/CD scripts.\n    print(\"Running: dg --version\")\n    result = subprocess.run([\"dg\", \"--version\"], capture_output=True, text=True, check=True)\n    print(\"\\nDagster Cloud CLI Version Information:\")\n    print(result.stdout)\n    print(\"Ensure 'dg' is in your system's PATH after installation.\")\n\nexcept FileNotFoundError:\n    print(\"Error: 'dg' command not found. Ensure dagster-cloud-cli is installed and in your PATH.\")\nexcept subprocess.CalledProcessError as e:\n    print(f\"Error running dg command: {e}\")\n    print(f\"Stdout: {e.stdout}\")\n    print(f\"Stderr: {e.stderr}\")\n","lang":"python","description":"This quickstart demonstrates how to verify the installation of `dagster-cloud-cli` by running the `dg --version` command. The `dagster-cloud-cli` is primarily a command-line interface tool, and most interactions happen directly in the terminal via the `dg` command. For programmatic interactions with Dagster Cloud itself, the `dagster-cloud` Python library is generally used."},"warnings":[{"fix":"Use `pip install dagster-cloud` and refer to its documentation for Python SDK usage.","message":"The `dagster-cloud-cli` (`dg` command) is a command-line interface. For programmatic interaction with Dagster Cloud services (e.g., fetching run metadata, launching runs from Python), you should use the `dagster-cloud` Python library (SDK) instead of attempting to import from or wrap the CLI tool.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Set `export DAGSTER_CLOUD_AGENT_TOKEN='...'` in your environment or run `dg login` to authenticate before executing commands that interact with your Dagster Cloud workspace.","message":"Authentication for `dagster-cloud-cli` typically requires setting the `DAGSTER_CLOUD_AGENT_TOKEN` environment variable or using `dg login`. Operations like `dg deploy` will fail without proper authentication.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Run `dg init` to set up a new project structure or ensure your existing project contains a valid `dagster_cloud.yaml` file and entrypoint.","message":"When deploying code using `dg plus deploy`, a `dagster_cloud.yaml` configuration file and a properly structured Dagster project are required in the current directory or specified path. Missing or misconfigured files will prevent successful deployment.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Explicitly add `pip install psycopg2-binary` to your project's dependencies if you use `dagster-postgres` and previously relied on its transitive inclusion.","message":"Beginning with Dagster core version 1.12.18 (which `dagster-cloud-cli` depends on), `psycopg2-binary` was removed as a transitive dependency from `dagster-postgres`. If your project relies on `dagster-postgres` and implicitly depended on this, you may encounter import errors.","severity":"breaking","affected_versions":">=1.12.18 (core) / >=0.28.18 (libraries)"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}