Registry / devops / sentry-cli

sentry-cli

JSON →
library3.5.0pypypiunverified

sentry-cli is a powerful command-line utility for interacting with Sentry, enabling tasks like creating releases, uploading source maps, managing projects, and configuring your Sentry instance. The Python package primarily serves as a convenient wrapper to install and execute the Rust-based binary. It is actively maintained with frequent snapshot builds and regular stable releases.

pip install sentry-cli
INSTALL
IMPORT
SIG · SENTRY-CLI
S
sentry-cli
devopspythonv3.5.0
Install
1.9s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.5.0 · 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.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.9s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

sentry_cli
This package is not intended for direct Python import as a library with an API.
import sentry_cli
sentry-cli is a command-line tool (a binary), not a Python library with an importable API. Its Python package primarily manages the binary installation. For Python application error reporting, use the `sentry-sdk` library. To run `sentry-cli` from Python, use `subprocess`.

This quickstart demonstrates how to programmatically interact with `sentry-cli` from Python using the `subprocess` module. It includes examples for checking the version, creating, and finalizing a Sentry release. Ensure you have `SENTRY_AUTH_TOKEN`, `SENTRY_ORG`, and `SENTRY_PROJECT` environment variables configured or set `sentry-cli login` interactively. Replace placeholder slugs with your actual Sentry organization and project details.

import os import subprocess # Ensure SENTRY_AUTH_TOKEN is set for non-interactive use (e.g., CI/CD) # It can be obtained from your Sentry 'API Keys' settings. # For interactive use, run 'sentry-cli login' once in your terminal. os.environ['SENTRY_AUTH_TOKEN'] = os.environ.get('SENTRY_AUTH_TOKEN', '') os.environ['SENTRY_ORG'] = os.environ.get('SENTRY_ORG', 'your-org-slug') # Replace with your Sentry organization slug os.environ['SENTRY_PROJECT'] = os.environ.get('SENTRY_PROJECT', 'your-project-slug') # Replace with your Sentry project slug def run_sentry_cli_command(command_args): full_command = ['sentry-cli'] + command_args print(f"\nRunning: {' '.join(full_command)}") try: result = subprocess.run( full_command, capture_output=True, text=True, check=True, # Raises CalledProcessError for non-zero exit codes env=os.environ # Pass current environment including SENTRY_AUTH_TOKEN ) print("STDOUT:\n" + result.stdout) if result.stderr: print("STDERR:\n" + result.stderr) return result.stdout except subprocess.CalledProcessError as e: print(f"Error executing command: {e.cmd}") print(f"Return Code: {e.returncode}") print(f"STDOUT:\n{e.stdout}") print(f"STDERR:\n{e.stderr}") raise # Re-raise the error to stop execution except FileNotFoundError: print("Error: 'sentry-cli' command not found. Please ensure it's installed and in your system PATH.") print("You can install it via 'pip install sentry-cli' or by following instructions at https://docs.sentry.io/product/cli/installation/") raise if __name__ == "__main__": try: # 1. Check the Sentry CLI version run_sentry_cli_command(['--version']) # 2. Get the current organization's status run_sentry_cli_command(['info']) # 3. Create a Sentry release (replace with your actual release name) release_name = f"my-app@{os.getenv('BUILD_VERSION', '1.0.0-test')}" run_sentry_cli_command(['releases', 'new', release_name]) # 4. Set the release to committed (optional, for connecting to SCM) # run_sentry_cli_command(['releases', 'set-commits', release_name, '--auto']) # 5. Finalize the release run_sentry_cli_command(['releases', 'finalize', release_name]) print("\nSentry CLI commands executed successfully!") except Exception as e: print(f"\nAn error occurred during quickstart execution: {e}")
sentry-cli --version
Debug
Known issues
gotchasentry-cli is not a Python library meant for direct `import` statements. The Python `sentry-cli` package is a wrapper to install the `sentry-cli` binary. Attempting to `import sentry_cli` will likely fail or lead to confusion.
fix
Use `sentry-cli` directly from your shell or invoke it via Python's `subprocess` module for programmatic control. For Python application integration, use `sentry-sdk`.
affects: All versions
breakingSentry CLI versions 2.x and earlier relied on an older authentication method (API keys). Versions 3.x strongly recommend using Auth Tokens for better security and granular permissions.
fix
Upgrade to `sentry-cli` version 3.x and ensure you are using a Sentry Auth Token. Set it as `SENTRY_AUTH_TOKEN` environment variable or use `sentry-cli login`.
affects: <3.0.0
gotchaSourcemap uploading can be tricky if paths or release names don't match exactly between your build process and Sentry. Incorrect configurations lead to un-minified stack traces.
fix
Ensure `sentry-cli upload-sourcemaps` commands correctly specify the `--url-prefix` to match how your assets are served, and that the `--release` parameter matches the release ID associated with your reported events. Validate sourcemaps in Sentry's developer tools after uploading.
affects: All versions
gotchaMany `sentry-cli` commands require specifying the Sentry organization and project. Forgetting these, or providing incorrect values, often leads to authentication or permissions errors.
fix
Always include `--org <ORG_SLUG>` and `--project <PROJECT_SLUG>` arguments, or configure them globally via environment variables (`SENTRY_ORG`, `SENTRY_PROJECT`) or a `.sentryclirc` file.
affects: All versions
Upgrade
Version history
3.5.0latest on PyPI · released Jun 2, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
sentry-cli — pip install sentry-cli · libregistry