Registry / data / event-model

event-model

JSON →
library1.23.1pypypi✓ verified 89d ago

Data model used by the bluesky ecosystem. Defines schemas for experimental data documents (e.g., Event, EventDescriptor, RunStart). Currently at version 1.23.1, released on a monthly cadence.

pip install event-model
INSTALL
IMPORT
SIG · EVENT-MODEL
E
event-model
datapythonv1.23.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Event
✓ from event_model import Event
✗ from event_model.schemas import Event
Event is exported from the top-level package, not from submodules
RunStart
✓ from event_model import RunStart
✗ from bluesky_models import RunStart
The correct package is event-model, not bluesky_models
EventDescriptor
✓ from event_model import EventDescriptor
✗ from bluesky import event_model
bluesky package does not re-export event-model types directly

Create and print basic event-model documents

from event_model import Event, RunStart start = RunStart( uid='abc123', time=1640000000.0, plan_name='scan', scan_id=42 ) event = Event( uid='def456', time=1640000001.0, descriptor_uid='ghi789', seq_num=1, data={'det': 3.14159}, timestamps={'det': 1640000001.0}, filled={} ) print(start, event)
Debug
Known issues
breakingIn v1.23, the internal representation changed from pydantic BaseModel to jsonschema + TypedDict. Code that relied on pydantic methods (e.g., .dict(), .copy()) will break. Use dict() and copy from the TypedDict protocol instead.
fix
Replace .dict() with dict(doc) and .copy() with dict(doc); avoid pydantic-specific features.
affects: >=1.23.0
breakingIn v1.21, StreamResource and StreamDatum schemas changed significantly: `path_semantics` and `resource_kwargs` removed; `uri`, `parameters`, and `mimetype` added.
fix
Update code that creates StreamResource/StreamDatum to use new fields; drop old fields.
affects: 1.21.0
gotchaIn v1.22.0, DataKey fields `precision`, `choices`, and `units` became required (non-optional). Leaving them out is still allowed, but providing None raises a validation error.
fix
Remove None values from those fields; omit the keys entirely if not needed.
affects: 1.22.0 - 1.22.2
Errors
Common errors & fixes
ImportError: cannot import name 'Event' from 'event_model.schemas'
Event is exported from the top-level event_model package, not from event_model.schemas.
fix
Use: from event_model import Event
AttributeError: 'Event' object has no attribute 'dict'
In v1.23, Event is a TypedDict, not a pydantic BaseModel. pydantic's .dict() is not available.
fix
Use: dict(event) or copy with dict(event)
ValidationError: 1 validation error for DataKey precision none is not an allowed value (type=type_error.none.not_allowed)
In v1.22.0+, DataKey fields like 'precision' cannot be None; omit the key if not needed.
fix
Remove the field or use a valid value.
Upgrade
Version history
1.23.1latest on PyPI · released Aug 28, 2025
Audit
Dependencies
jsonschemarequiredSchema validation; replaced pydantic in v1.23
numpyoptionalUsed for type definitions
pydanticoptionalPin <2.11 for Python 3.8 support
Agent activity
4 hits · last 30 days
node
4
Resources
event-model — pip install event-model · libregistry