{"id":26967,"library":"event-model","title":"Event Model","description":"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.","status":"active","version":"1.23.1","language":"python","source_language":"en","source_url":"https://github.com/bluesky/event-model","tags":["bluesky","data-model","experimental-data","schemas"],"install":[{"cmd":"pip install event-model","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Schema validation; replaced pydantic in v1.23","package":"jsonschema","optional":false},{"reason":"Used for type definitions","package":"numpy","optional":true},{"reason":"Pin <2.11 for Python 3.8 support","package":"pydantic","optional":true}],"imports":[{"note":"Event is exported from the top-level package, not from submodules","wrong":"from event_model.schemas import Event","symbol":"Event","correct":"from event_model import Event"},{"note":"The correct package is event-model, not bluesky_models","wrong":"from bluesky_models import RunStart","symbol":"RunStart","correct":"from event_model import RunStart"},{"note":"bluesky package does not re-export event-model types directly","wrong":"from bluesky import event_model","symbol":"EventDescriptor","correct":"from event_model import EventDescriptor"}],"quickstart":{"code":"from event_model import Event, RunStart\n\nstart = RunStart(\n    uid='abc123',\n    time=1640000000.0,\n    plan_name='scan',\n    scan_id=42\n)\nevent = Event(\n    uid='def456',\n    time=1640000001.0,\n    descriptor_uid='ghi789',\n    seq_num=1,\n    data={'det': 3.14159},\n    timestamps={'det': 1640000001.0},\n    filled={}\n)\nprint(start, event)","lang":"python","description":"Create and print basic event-model documents"},"warnings":[{"fix":"Replace .dict() with dict(doc) and .copy() with dict(doc); avoid pydantic-specific features.","message":"In 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.","severity":"breaking","affected_versions":">=1.23.0"},{"fix":"Update code that creates StreamResource/StreamDatum to use new fields; drop old fields.","message":"In v1.21, StreamResource and StreamDatum schemas changed significantly: `path_semantics` and `resource_kwargs` removed; `uri`, `parameters`, and `mimetype` added.","severity":"breaking","affected_versions":"1.21.0"},{"fix":"Remove None values from those fields; omit the keys entirely if not needed.","message":"In 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.","severity":"gotcha","affected_versions":"1.22.0 - 1.22.2"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: from event_model import Event","cause":"Event is exported from the top-level event_model package, not from event_model.schemas.","error":"ImportError: cannot import name 'Event' from 'event_model.schemas'"},{"fix":"Use: dict(event) or copy with dict(event)","cause":"In v1.23, Event is a TypedDict, not a pydantic BaseModel. pydantic's .dict() is not available.","error":"AttributeError: 'Event' object has no attribute 'dict'"},{"fix":"Remove the field or use a valid value.","cause":"In v1.22.0+, DataKey fields like 'precision' cannot be None; omit the key if not needed.","error":"ValidationError: 1 validation error for DataKey\n  precision\n    none is not an allowed value (type=type_error.none.not_allowed)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}