-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix init_parser_plugins for python 3.12 #425
Conversation
reformatted the ValueError in init_parser_plugins to conform with black's formatting standard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much! You've probably gone to bed so I'll take the PR and make the changes to it, and then merge it. Appreciated!
|
||
if version_info.major == 3 and version_info.minor in (8, 9, 10, 11): | ||
custom_parser_eps = entry_points().get('lute.plugin.parse') | ||
elif version_info.major == 3 and version_info.minor == 12: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should change this to >= 12
. Granted, we can't know what the API will be in version 3.13+, but maybe we can play fast and loose with this one, and just bump up the CI checks on GitHub as versions come out.
for custom_parser_ep in custom_parser_eps: | ||
if _is_valid(custom_parser_ep.load()): | ||
__LUTE_PARSERS__[custom_parser_ep.name] = custom_parser_ep.load() | ||
else: | ||
raise ValueError( | ||
f"{custom_parser_ep.name} is not a subclass of AbstractParser" | ||
f"{custom_parser_ep.name} is not a a subclass of AbstractParser" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the "a a" before, and here it's added again, any reason? :-)
Code included in updated #426 , cheers! |
Hotfix for users on python 3.12, which broke because the entry points no longer return as a dictionary in that version, so
.select(group='lute.plugin.parse')
is used instead.Additional logic was added to handle version differences, both in terms of fetching the entry points from the method and processing them (a catch for None was added)
Solves: