{"library":"python-schema-registry-client","title":"Python Schema Registry Client","description":"A Python client to interact with the Confluent Schema Registry's REST API. It allows managing Avro and JSON schemas, including registering new schemas, retrieving existing ones by ID or subject, and performing compatibility checks. The library is currently at version 2.6.1 and is actively maintained, with releases typically tied to feature enhancements and bug fixes.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install python-schema-registry-client","pip install python-schema-registry-client[faust]"],"cli":null},"imports":["from schema_registry.client import SchemaRegistryClient","from schema_registry.client import AsyncSchemaRegistryClient","from schema_registry.client.schema import AvroSchema","from schema_registry.client.schema import JsonSchema","from schema_registry.serializers import MessageSerializer"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nimport asyncio\nfrom schema_registry.client import SchemaRegistryClient\nfrom schema_registry.client.schema import AvroSchema\n\nSCHEMA_REGISTRY_URL = os.environ.get('SCHEMA_REGISTRY_URL', 'http://localhost:8081')\n\nasync def main():\n    client = SchemaRegistryClient(url=SCHEMA_REGISTRY_URL)\n\n    avro_schema_definition = {\n        \"type\": \"record\",\n        \"namespace\": \"com.example\",\n        \"name\": \"SensorReading\",\n        \"fields\": [\n            {\"name\": \"id\", \"type\": \"string\"},\n            {\"name\": \"value\", \"type\": \"int\"}\n        ]\n    }\n    \n    # Create an AvroSchema object\n    avro_schema = AvroSchema(avro_schema_definition)\n\n    # Define a subject name\n    subject = \"sensor-readings-value\"\n\n    try:\n        # Register the schema\n        registered_schema = client.register(subject, avro_schema)\n        print(f\"Schema registered with ID: {registered_schema.schema_id}\")\n\n        # Get the schema by ID\n        retrieved_schema = client.get_by_id(registered_schema.schema_id)\n        print(f\"Retrieved schema (ID {registered_schema.schema_id}): {retrieved_schema.schema.to_dict()}\")\n\n        # Get the latest schema for a subject\n        latest_schema_info = client.get_latest_version(subject)\n        print(f\"Latest schema for '{subject}' (version {latest_schema_info.version}, ID {latest_schema_info.schema.schema_id}): {latest_schema_info.schema.to_dict()}\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n\nif __name__ == \"__main__\":\n    # For synchronous use, just call client methods directly.\n    # The example uses async to show client.register which is an async method by default\n    # if the client is AsyncSchemaRegistryClient. For SchemaRegistryClient, it's synchronous.\n    # However, the example above will work for both if using the sync client\n    # due to how the `register` method is implemented (it's not truly async with await here).\n    # Let's adjust for clarity to ensure it runs correctly with the default SchemaRegistryClient.\n    # For a truly async example, one would use AsyncSchemaRegistryClient and 'await'.\n    # For this quickstart, we'll keep it simple with the synchronous client.\n    \n    # Rerunning the quickstart for synchronous client clarification\n    sync_client = SchemaRegistryClient(url=SCHEMA_REGISTRY_URL)\n    \n    avro_schema_definition = {\n        \"type\": \"record\",\n        \"namespace\": \"com.example\",\n        \"name\": \"SensorReading\",\n        \"fields\": [\n            {\"name\": \"id\", \"type\": \"string\"},\n            {\"name\": \"value\", \"type\": \"int\"}\n        ]\n    }\n    \n    avro_schema = AvroSchema(avro_schema_definition)\n    subject = \"sensor-readings-value-sync\"\n\n    try:\n        registered_schema = sync_client.register(subject, avro_schema)\n        print(f\"Sync: Schema registered with ID: {registered_schema.schema_id}\")\n\n        retrieved_schema = sync_client.get_by_id(registered_schema.schema_id)\n        print(f\"Sync: Retrieved schema (ID {registered_schema.schema_id}): {retrieved_schema.schema.to_dict()}\")\n\n        latest_schema_info = sync_client.get_latest_version(subject)\n        print(f\"Sync: Latest schema for '{subject}' (version {latest_schema_info.version}, ID {latest_schema_info.schema.schema_id}): {latest_schema_info.schema.to_dict()}\")\n\n    except Exception as e:\n        print(f\"Sync: An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize the `SchemaRegistryClient`, define an Avro schema, register it with the Schema Registry, and then retrieve it by its ID and subject name. Ensure a Confluent Schema Registry instance is running and accessible at the specified `SCHEMA_REGISTRY_URL` (default: http://localhost:8081).","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"2.6.1","pypi_latest":"2.6.1","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":75,"avg_install_s":6.5,"avg_import_s":0.55,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"python-schema-registry-client","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.44,"mem_mb":12.6,"disk_size":"33.7M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"faust","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"python-schema-registry-client","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":3.5,"import_time_s":0.32,"mem_mb":12.6,"disk_size":"37M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"faust","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":9,"import_time_s":0.34,"mem_mb":13.3,"disk_size":"66M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"python-schema-registry-client","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.66,"mem_mb":13.8,"disk_size":"36.9M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"faust","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"python-schema-registry-client","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":3.3,"import_time_s":0.58,"mem_mb":13.8,"disk_size":"41M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"faust","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":7.6,"import_time_s":0.63,"mem_mb":14.7,"disk_size":"73M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"python-schema-registry-client","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.78,"mem_mb":13.8,"disk_size":"28.8M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"faust","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"python-schema-registry-client","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.9,"import_time_s":0.82,"mem_mb":13.8,"disk_size":"32M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"faust","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":11.5,"import_time_s":0.78,"mem_mb":14.7,"disk_size":"60M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"python-schema-registry-client","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.51,"mem_mb":12.6,"disk_size":"28.0M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"faust","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"python-schema-registry-client","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.8,"import_time_s":0.52,"mem_mb":12.6,"disk_size":"31M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"faust","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":10.8,"import_time_s":0.55,"mem_mb":14.1,"disk_size":"59M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"python-schema-registry-client","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.47,"mem_mb":12.4,"disk_size":"33.0M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"faust","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"python-schema-registry-client","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":3.9,"import_time_s":0.39,"mem_mb":12.4,"disk_size":"36M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"faust","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":10.1,"import_time_s":0.44,"mem_mb":13.2,"disk_size":"67M"}]}}