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.
pip install jupyter_eventsVerified import paths — ran on the pinned version, not inferred.
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.
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.
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.
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.
Ensure your event schema dictionary includes the `version`, `$id`, and `properties` fields at the root level. For example:
```json
{
"$id": "https://example.com/schemas/my_event.json",
"version": "1",
"title": "My Custom Event",
"description": "A simple custom event for demonstration.",
"type": "object",
"properties": {
"message": {"type": "string"},
"level": {"type": "string", "enum": ["info", "warning", "error"]}
},
"required": ["message", "level"]
}
```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.
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.
Modify the event schema to ensure the `version` property is explicitly a string type.
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.
Ensure all event schemas include a unique `"$id"` property, which should be a valid URI, to correctly identify the schema.
Ensure all event schemas include a `"version"` property with a string value to specify the schema's version.