-
Notifications
You must be signed in to change notification settings - Fork 459
Fix for PyBabel Compatibility with Python 3.12 and Third-Party Extractors #1093
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
Conversation
Refactored both checkers.py and extract.py to use importlib.metadata instead of pkg_resources for better performance and compatibility with modern Python versions. Closes python-babel#861
I don't think all of our currently supported platforms have |
@akx you are right, it should try |
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.
As discussed, this needs a fallback for environments where importlib.metadata.entry_points()
is not available.
Another fallback was needed, this time for
According to the documentation:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1093 +/- ##
==========================================
- Coverage 90.99% 90.87% -0.13%
==========================================
Files 26 26
Lines 4444 4481 +37
==========================================
+ Hits 4044 4072 +28
- Misses 400 409 +9 ☔ View full report in Codecov by Sentry. |
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.
Could the duplicated code be DRYed into a single _get_group_entrypoints(group, name=None)
generator function that could live in e.g. babel/util.py
(as a private name)?
@akx I'm preparing fixes, as I see you are planning to finish the update. I needed to let you know that I'm working on it and plan to finish it |
@podgorniy94 I wasn't sure you were doing that, so please just see #1102 instead – the commit has you as a co-author :) |
PyBabel currently fails to work with Python 3.12 when using third-party extractors. Specifically, the extraction method for Jinja2 templates throws a ValueError:
This issue does not occur with Python 3.11, where the same setup functions correctly.
Issue: #861