Skip to content

Conversation

@purarue
Copy link

@purarue purarue commented Jan 15, 2026

in python3.14, computing the __annotations__ is done lazily which
leads to an error. see
https://docs.python.org/3/whatsnew/3.14.html#implications-for-readers-of-annotations

@coderabbitai
Copy link

coderabbitai bot commented Jan 15, 2026

Walkthrough

The change refactors trakt/config.py to replace iteration over __annotations__ with the dataclass fields() function for deriving configuration keys in the all() and load() methods, while preserving existing behavior and public API signatures.

Changes

Cohort / File(s) Summary
Refactoring of field iteration
trakt/config.py
Replaced __annotations__ iteration with dataclass.fields() for key extraction in all() and load() methods. Changed key retrieval to use field.name. Added import of fields from dataclasses module.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops through fields of code so fine,
Where annotations danced in every line,
Now dataclass fields take center stage,
Same behavior, cleaner page!
The config thrives, refactored with delight. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: replacing annotations with dataclasses.fields to fix a compatibility issue.
Description check ✅ Passed The PR description clearly explains the motivation for the change—addressing Python 3.14's lazy evaluation of annotations—and directly relates to the changeset which replaces annotations usage with dataclasses.fields.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@purarue
Copy link
Author

purarue commented Jan 15, 2026

Heres the output in a debugger in python3.13, to show they're the same order:

ipdb> [field.name for field in fields(self)]
['APPLICATION_ID', 'CLIENT_ID', 'CLIENT_SECRET', 'OAUTH_EXPIRES_AT', 'OAUTH_REFRESH', 'OAUTH_TOKEN']
ipdb> self.__annotations__.keys()
dict_keys(['APPLICATION_ID', 'CLIENT_ID', 'CLIENT_SECRET', 'OAUTH_EXPIRES_AT', 'OAUTH_REFRESH', 'OAUTH_TOKEN'])
ipdb> p list(self.__annotations__.keys()) == [field.name for
field in fields(self)]
True

This fixes #95

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