{"id":650,"library":"jupyter-events","title":"Jupyter Events","description":"Jupyter Events is an event system library that enables Jupyter Python applications (e.g., Jupyter Server, JupyterLab Server, JupyterHub) and extensions to emit structured data describing internal happenings. Other software can then listen and respond to these events. The current version is 0.12.0, with releases occurring periodically to introduce new features, improvements, and bug fixes.","status":"active","version":"0.12.0","language":"python","source_language":"en","source_url":"https://github.com/jupyter/jupyter_events","tags":["jupyter","events","logging","schema","framework"],"install":[{"cmd":"pip install jupyter_events","lang":"bash","label":"PyPI"},{"cmd":"conda install -c conda-forge jupyter_events","lang":"bash","label":"Conda-forge"}],"dependencies":[{"reason":"Used for validating event data against registered JSON schemas.","package":"jsonschema"},{"reason":"Used for formatting logs as JSON strings.","package":"python_json_logger"},{"reason":"Likely used for loading or parsing schema definitions.","package":"pyyaml"},{"reason":"JSON Referencing + Python, likely for schema resolution.","package":"referencing"},{"reason":"A pure Python RFC3339 validator, likely for date/time string validation in schemas.","package":"rfc3339_validator"}],"imports":[{"symbol":"EventLogger","correct":"from jupyter_events import EventLogger"}],"quickstart":{"code":"import logging\nfrom jupyter_events import EventLogger\nimport json\nimport os\n\n# Define a simple event schema (in-memory for this example)\nmy_event_schema = {\n    \"$id\": \"https://example.com/schemas/my_event.json\",\n    \"title\": \"My Custom Event\",\n    \"description\": \"A simple custom event for demonstration.\",\n    \"type\": \"object\",\n    \"properties\": {\n        \"message\": {\"type\": \"string\"},\n        \"level\": {\"type\": \"string\", \"enum\": [\"info\", \"warning\", \"error\"]}\n    },\n    \"required\": [\"message\", \"level\"]\n}\n\n# Create a temporary log file\nevent_log_file = 'quickstart_events.log'\n\n# Initialize EventLogger with a FileHandler and register the schema\nlogger = EventLogger(\n    handlers=[logging.FileHandler(event_log_file)],\n    allowed_schemas=[my_event_schema[\"$id\"]]\n)\nlogger.register_event_schema(my_event_schema)\n\n# Emit an event\nprint(f\"Emitting an 'info' event...\")\nlogger.emit(schema_id=my_event_schema[\"$id\"], data={'message': 'This is a test event!', 'level': 'info'})\nprint(f\"Event emitted to {event_log_file}\")\n\n# Read the logged event\nwith open(event_log_file, 'r') as f:\n    logged_event = json.loads(f.readline())\n    print(f\"Logged event: {logged_event}\")\n\n# Clean up the log file\nos.remove(event_log_file)\n","lang":"python","description":"This quickstart demonstrates how to initialize an `EventLogger`, register a custom event schema, emit an event conforming to that schema, and verify that the event is logged. Events are validated against registered JSON schemas before being processed by Python's standard logging handlers."},"warnings":[{"fix":"Review `jupyter-events` documentation for equivalent functionalities and update event emission calls and schema definitions. Consult the changelog of dependent applications (like JupyterHub) for specific migration guides.","message":"Applications previously using `jupyter-telemetry` (e.g., JupyterHub) must migrate to `jupyter-events`. The API for event emission and schema definition is different and direct compatibility is not maintained.","severity":"breaking","affected_versions":"N/A (migration from jupyter-telemetry)"},{"fix":"Always call `event_logger.register_event_schema(your_schema_dict)` for each schema ID that your application intends to emit events for. Ensure the `$id` field in your schema dictionary matches the `schema_id` used in `emit()` calls.","message":"Event schemas must be explicitly registered with the `EventLogger` using `register_event_schema()` before emitting events. If an event is emitted for an unregistered schema ID, it will not be recorded and may raise an error or be silently dropped depending on the `EventLogger`'s configuration or version.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Define and apply appropriate redaction policies within your event schemas. Thoroughly test event flows to ensure sensitive data is not inadvertently exposed or logged in plaintext, especially when integrating with client-side listeners or external logging services.","message":"Sensitive data in event payloads requires careful handling, especially if event data is routed to client applications or persistent storage. While `jupyter-events` allows for redaction policies, an incorrect or missing policy could expose sensitive information.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your event schema dictionary includes the `version`, `$id`, and `properties` fields at the root level. For example:\n```json\n{\n  \"$id\": \"https://example.com/schemas/my_event.json\",\n  \"version\": \"1\",\n  \"title\": \"My Custom Event\",\n  \"description\": \"A simple custom event for demonstration.\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"message\": {\"type\": \"string\"},\n    \"level\": {\"type\": \"string\", \"enum\": [\"info\", \"warning\", \"error\"]}\n  },\n  \"required\": [\"message\", \"level\"]\n}\n```","message":"Event schemas submitted for registration must conform to the `jupyter-events` meta-schema. Specifically, they must include top-level `version`, `$id`, and `properties` fields. Failure to include these required properties will result in a `jsonschema.exceptions.ValidationError` during schema registration.","severity":"breaking","affected_versions":"All versions"},{"fix":"Ensure your event schema dictionary includes all required top-level fields such as `$id`, `version` (e.g., `'version': '1'`), and `properties` as specified by the `jupyter-events` meta-schema. Consult the `jupyter-events` documentation for the full meta-schema specification.","message":"Event schemas registered with `jupyter-events` must conform to the `jupyter-events` meta-schema. This meta-schema requires specific top-level properties like `$id`, `version`, and `properties` to be present. Omitting a required meta-schema property will result in a `jsonschema.exceptions.ValidationError` during schema registration.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-05-12T17:15:29.682Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Downgrade `jsonschema` to a compatible version (e.g., `jsonschema==4.19.2`) or upgrade `jupyter-events` to its latest version, which may have resolved the dependency conflict.","cause":"This error occurs due to an incompatibility between `jupyter-events` and newer versions of its `jsonschema` dependency, where the `Validator` class in `jsonschema` no longer accepts the `registry` argument that `jupyter-events` expects.","error":"TypeError: create.<locals>.Validator.__init__() got an unexpected keyword argument 'registry'"},{"fix":"Modify the event schema to ensure the `version` property is explicitly a string type.","cause":"An event schema being used by `jupyter-events` has its `version` property defined with a non-string type, which is deprecated and will lead to validation errors in future library versions.","error":"JupyterEventsVersionWarning: The `version` property of an event schema must be a string. It has been type coerced, but in a future version of this library, it will fail to validate. Please update schema: <schema_url>"},{"fix":"Install `jupyter-events` using `pip install jupyter_events` (or `conda install -c conda-forge jupyter_events` if using Anaconda) in the correct Python environment, and then restart your Jupyter kernel or server.","cause":"The `jupyter_events` package is either not installed in the Python environment that Jupyter is currently using, or there is a discrepancy between the environment where the package was installed and the active Jupyter kernel's environment.","error":"ModuleNotFoundError: No module named 'jupyter_events'"},{"fix":"Ensure all event schemas include a unique `\"$id\"` property, which should be a valid URI, to correctly identify the schema.","cause":"This error indicates that an event schema being registered or validated by `jupyter-events` is missing the mandatory `'$id'` key, which is required for identifying the schema.","error":"ValidationError: '$id' is a required property"},{"fix":"Ensure all event schemas include a `\"version\"` property with a string value to specify the schema's version.","cause":"This error signifies that an event schema being registered or validated by `jupyter-events` lacks the mandatory `'version'` key, which is essential for schema versioning.","error":"ValidationError: 'version' is a required property"}],"ecosystem":"pypi","meta_description":null,"install_score":85,"install_tag":"verified","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"0.12.1","install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":6.14,"mem_mb":31.2,"disk_size":"32.0M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":6.82,"mem_mb":31.1,"disk_size":"31.9M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":3.7,"import_time_s":4.51,"mem_mb":31.2,"disk_size":"33M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":4.34,"mem_mb":31.1,"disk_size":"33M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":6.69,"mem_mb":29.7,"disk_size":"35.2M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":7.86,"mem_mb":29.7,"disk_size":"35.0M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":3.8,"import_time_s":6.21,"mem_mb":29.7,"disk_size":"36M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":5.8,"mem_mb":29.7,"disk_size":"36M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":6.44,"mem_mb":28.7,"disk_size":"26.8M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":7.22,"mem_mb":28.8,"disk_size":"26.6M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":3.3,"import_time_s":6.84,"mem_mb":28.7,"disk_size":"28M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":7.77,"mem_mb":28.8,"disk_size":"27M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":5.95,"mem_mb":30.3,"disk_size":"26.2M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":6.66,"mem_mb":30.3,"disk_size":"25.9M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":3.3,"import_time_s":6.39,"mem_mb":30.3,"disk_size":"27M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":6.98,"mem_mb":30.3,"disk_size":"27M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":6.04,"mem_mb":31.2,"disk_size":"31.4M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":6.69,"mem_mb":31.3,"disk_size":"31.2M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":4.3,"import_time_s":5.42,"mem_mb":31.2,"disk_size":"32M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":5.73,"mem_mb":31.3,"disk_size":"32M"}]},"quickstart_checks":{"last_tested":"2026-04-24","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}