{"id":10222,"library":"sentry-protos","title":"Sentry Protobuf Definitions (Generated Python Code)","description":"sentry-protos provides the auto-generated Python code for Sentry's internal Protobuf definitions. It encapsulates the data structures used across various Sentry services, allowing Python applications to interact with Sentry's protobuf-based APIs. The library is actively maintained with frequent minor releases to incorporate new or updated protobuf schemas.","status":"active","version":"0.8.12","language":"python","source_language":"en","source_url":"https://github.com/getsentry/sentry-protos","tags":["protobuf","sentry","generated-code","serialization"],"install":[{"cmd":"pip install sentry-protos","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required runtime dependency for all generated protobuf code.","package":"protobuf","optional":false}],"imports":[{"wrong":"from sentry_protos.snuba.v1 import snuba_pb2","symbol":"snuba_pb2","correct":"from sentry_protos.snuba.v1 import snuba_pb2"}],"quickstart":{"code":"from sentry_protos.snuba.v1 import snuba_pb2\n\n# Create a QueryRequest message\nquery_request = snuba_pb2.QueryRequest(\n    dataset='events',\n    query=\"MATCH (event) SELECT event.id\"\n)\n\nprint(f\"Successfully created Snuba QueryRequest:\")\nprint(f\"  Dataset: {query_request.dataset}\")\nprint(f\"  Query: {query_request.query}\")\n\n# You can also set fields dynamically\nanother_query = snuba_pb2.QueryRequest()\nanother_query.dataset = 'transactions'\nanother_query.query = 'MATCH (transaction) SELECT transaction.duration'\n\nprint(f\"\\nAnother QueryRequest: {another_query.query}\")","lang":"python","description":"This quickstart demonstrates how to import a specific generated protobuf message (Snuba QueryRequest) and instantiate it, setting its fields. Remember to replace `snuba.v1` and `snuba_pb2` with the actual service and version you intend to use."},"warnings":[{"fix":"Pin your `sentry-protos` dependency to a specific minor version (e.g., `sentry-protos~=0.8.0`) and carefully test upgrades.","message":"As `sentry-protos` is a pre-1.0 library (version 0.x.y), minor version bumps (e.g., 0.8.x to 0.9.x) can introduce breaking changes to message definitions or removal of fields/services. Always review the changelog when upgrading.","severity":"breaking","affected_versions":"0.x.y (all versions)"},{"fix":"For gRPC client/server code, use `grpcio` and `grpcio-tools` with the original `.proto` files to generate service stubs. `sentry-protos` is strictly for data serialization/deserialization.","message":"This package contains only the generated Python message definitions (`_pb2.py` files). It does not include gRPC service stubs or client/server code (`_pb2_grpc.py` files). If you need to implement gRPC services or clients based on these protos, you will need `grpcio` and `grpcio-tools` and will have to generate those stubs yourself.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your `sentry-protos` package is kept up-to-date (`pip install --upgrade sentry-protos`) to access the latest protobuf definitions. If you encounter missing fields or messages, an upgrade is often the first step.","message":"Due to Sentry's continuous development, upstream `.proto` definitions are frequently updated. This means `sentry-protos` receives regular updates to reflect new fields, messages, or services. Older versions of `sentry-protos` may lack definitions for newer features or services, leading to `AttributeError` or unexpected behavior.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'across':29 'activ':48 'allow':33 'api':44 'applic':35 'auto':13 'auto-gener':12 'base':43 'code':6,16,65 'data':26 'definit':3,22 'encapsul':24 'frequent':51 'generat':4,14,64 'generated-cod':63 'incorpor':55 'interact':37 'intern':20 'librari':46 'maintain':49 'minor':52 'new':56 'proto':9 'protobuf':2,21,42,59,61 'protobuf-bas':41 'provid':10 'python':5,15,34 'releas':53 'schema':60 'sentri':1,8,18,31,39,62 'sentry-proto':7 'serial':66 'servic':32 'structur':27 'updat':58 'use':28 'various':30","created_at":"2026-04-17T01:23:00.448192+00:00","updated_at":"2026-04-17T01:23:00.448192+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'snuba_pb2' from 'sentry_protos.snuba.v1' (/tmp/tmpo8zi54ed/venv/lib/python3.12/site-packages/sentry_protos/snuba/v1/__init__.py)"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.31.2","cli_name":"","cli_version":null,"type":"library","homepage":"https://sentry.io","github":"https://github.com/getsentry/sentry-protos","docs":null,"changelog":"https://github.com/getsentry/sentry-protos/tree/main/CHANGELOG.md","pypi":"https://pypi.org/project/sentry-protos/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization","observability"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}