Skip to content

Fix deferred logger annotations on Python 3.14 - #7

Merged
rnilva merged 2 commits into
mainfrom
fix/python-3.14-annotations
Aug 27, 2026
Merged

rnilva merged 2 commits into
mainfrom
fix/python-3.14-annotations

Conversation

@rnilva

@rnilva rnilva commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Summary

Fix the two blockers found by the new release validation:

  • logger fields disappeared on Python 3.14 because annotation evaluation is now deferred;
  • the wheel smoke test imported LoggerBase from the package root rather than its documented expedantic.logger namespace.

Root cause

LoggerBase._resolve_schema() walks each class in the MRO, but used typing.get_type_hints(cls). Despite the per-class loop, get_type_hints() merges inherited annotations. Under Python 3.14's deferred annotation semantics, resolving a subclass could therefore try to evaluate base-class names in the subclass module and discard the whole schema when that failed. The preceding "__annotations__" in cls.__dict__ check was also incompatible with lazy annotation storage.

Changes

  • use inspect.get_annotations(cls, eval_str=True), which ignores inherited annotations and resolves each class in its own namespace;
  • remove the eager __annotations__ dictionary check;
  • guard generic-origin checks with inspect.isclass();
  • correct the isolated wheel smoke import.

The full Python 3.10–3.14 matrix, optional dataframe suite, and distribution build will run on this PR.

@rnilva
rnilva merged commit 4a0bbf4 into main Aug 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant