Sentry Kafka Schemas
raw JSON → 2.1.29 verified Mon Apr 27 auth: no python
Provides Kafka topic definitions, Avro/Protobuf schemas, and versioned schema management for Sentry's event ingestion and processing pipelines. Version 2.1.29 is actively maintained with frequent releases (multiple per month).
pip install sentry-kafka-schemas Common errors
error ModuleNotFoundError: No module named 'sentry_kafka_schemas' ↓
cause Package not installed or installed as a different name (e.g., `sentry-kafka-schemas` vs `sentry_kafka_schemas`).
fix
Install via
pip install sentry-kafka-schemas and use import sentry_kafka_schemas (underscore). error sentry_kafka_schemas.exceptions.TopicNotFoundError: Topic 'some_topic' not found ↓
cause The topic name does not exist in the schemas registry.
fix
Check the list of valid topics:
from sentry_kafka_schemas import TOPICS; print(TOPICS.keys()) Warnings
breaking Version 2.0 removed the old `get_topic_with_version` function and changed how topic versions are specified. Use `get_topic(topic_name, version=...)` instead. ↓
fix Replace `get_topic_with_version(name, version)` with `get_topic(name, version=version)`.
deprecated Calling `get_schema` without a version argument will be deprecated. Always pass an explicit version to avoid defaulting to the latest. ↓
fix Use `get_schema(topic_name, version='2.0')` or similar.
gotcha The package uses `importlib.resources` internally, which may raise `FileNotFoundError` if the package is installed incorrectly (e.g., via `pip install -e` without proper metadata). ↓
fix Ensure the package is installed normally (not in editable mode) or install with `--no-use-pep517`.
Imports
- get_topic wrong
from sentry_kafka_schemas.schema import get_topiccorrectfrom sentry_kafka_schemas import get_topic - get_message_type wrong
from sentry_kafka_schemas.types import get_message_typecorrectfrom sentry_kafka_schemas import get_message_type
Quickstart
from sentry_kafka_schemas import get_topic, get_message_type, get_schema
topic_name = "events"
topic = get_topic(topic_name)
print(topic.version)
msg_type = get_message_type(topic_name)
print(msg_type)
schema = get_schema(topic_name)
print(schema.schema_str[:100])