-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add Python 3.12 related updates #110
Conversation
- Use Python 3.8-3.12 for test matrix - Bump GH action versions - Fix configparser SafeConfigParser name issue (the initial one) - Replace pkg_resources with importlib.metadata
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.
Thanks for the work. I support those changes and would hope that they get merged and released soon.
try: | ||
from configparser import SafeConfigParser | ||
from configparser import ConfigParser as SafeConfigParser | ||
except ImportError: | ||
from ConfigParser import SafeConfigParser |
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 this is a pattern to support Python 2 it might as well be a good idea to just use the Python 3 variant.
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 you provide an example?
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.
Since lingua is Python 3 only, the except
-case can be removed. The module is called configparser
since Python 3.0.
try: | ||
from importlib.metadata import entry_points | ||
except ImportError: | ||
from importlib_metadata import entry_points |
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.
To prevent the same issue as with configparser above, it could be helpful to document, when this workaround is no longer needed.
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.
try: | |
from importlib.metadata import entry_points | |
except ImportError: | |
from importlib_metadata import entry_points | |
try: | |
from importlib.metadata import entry_points | |
except ImportError: # required up to Python 3.9 | |
from importlib_metadata import entry_points |
At least AFAIU https://docs.python.org/3.9/library/importlib.metadata.html#entry-points and the "Compatibility Note" in https://docs.python.org/3.10/library/importlib.metadata.html#entry-points
try: | ||
from importlib.metadata import entry_points | ||
except ImportError: | ||
from importlib_metadata import entry_points | ||
|
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.
See above.
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.
Hi @sallner, thanks for reviewing this!
try: | ||
from configparser import SafeConfigParser | ||
from configparser import ConfigParser as SafeConfigParser | ||
except ImportError: | ||
from ConfigParser import SafeConfigParser |
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 you provide an example?
I've bumped into one more lingua issue that needs to be fixed 🤷♂️ Taking into account there has been no activity on the project for more than 18 months it may be a good idea to branch out a new project and use it for further development. Need to look into the license for details. Keeping this open for another week or two. |
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.
Thanks for this update.
@wichert Can you please merge this and provide a new release.Thanks.
@@ -9,15 +9,15 @@ jobs: | |||
|
|||
strategy: | |||
matrix: | |||
python: ["3.7", "3.9", "3.10"] | |||
python: ["3.8", "3.9", "3.10", "3.11", "3.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.
I'd keep Python 3.7 if test still pass. Even if 3.7 is EOL there might be old code out there using it.
try: | ||
from configparser import SafeConfigParser | ||
from configparser import ConfigParser as SafeConfigParser | ||
except ImportError: | ||
from ConfigParser import SafeConfigParser |
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.
Since lingua is Python 3 only, the except
-case can be removed. The module is called configparser
since Python 3.0.
try: | ||
from importlib.metadata import entry_points | ||
except ImportError: | ||
from importlib_metadata import entry_points |
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.
try: | |
from importlib.metadata import entry_points | |
except ImportError: | |
from importlib_metadata import entry_points | |
try: | |
from importlib.metadata import entry_points | |
except ImportError: # required up to Python 3.9 | |
from importlib_metadata import entry_points |
At least AFAIU https://docs.python.org/3.9/library/importlib.metadata.html#entry-points and the "Compatibility Note" in https://docs.python.org/3.10/library/importlib.metadata.html#entry-points
Closing in favor of vacanza/lingva#1 |
Resolves #109
Add Python 3.12 related updates:
The 3.12 test job will fail due to a similar issue -- I'll revisit this if needed later after malthe/chameleon#379 is addressed.
I also recommend migrating the PyPI publisher to OIDC's short lived tokens.