Skip to content

Python 3.14: compatibility issue with default lazy annotationsΒ #153

@ncoghlan

Description

@ncoghlan

Highlighting the Python 3.14 compatibility requirements:

  • base any data model classes passed to the SDK on Pydantic rather than lmstudio.BaseModel; or
  • specify from __future__ import annotations to use string annotations instead of lazy ones (since msgspec handles those)

lmstudio-python is affected by jcrist/msgspec#847, so running on Python 3.14+ currently requires the use of from __future__ import annotations when defining structured response formats based on lmstudio.BaseModel.

The main SDK schema export classes already used string annotations to avoid forward referencing problems, so the PR adding 3.14 to CI (#154) works around the issue by also adding from __future__ import annotations to the affected test modules.

Client applications relying on Pydantic for their data model classes won't be affected (beyond needing to update to Pydantic 2.12.0a1 or later), but those relying on lmstudio.BaseModel to define their structured response formats will currently also need to use from __future__ import annotations for their struct fields to actually get defined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions