lmstudio-ai / lmstudio-ai/lmstudio-python

Python 3.14: compatibility issue with default lazy annotations

Open
#153 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
875
Forks
166
PR merge metrics
No merged PRs in 30d

Description

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 https://github.com/jcrist/msgspec/issues/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 (https://github.com/lmstudio-ai/lmstudio-python/pull/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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with PR #154 and the affected test modules, then inspect the main SDK schema export classes mentioned in the issue. Check how structured response formats behave on Python 3.14 and compare the existing string-annotation workaround. Done means the compatibility requirement is covered consistently for these formats.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.