-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Future: Python 3.8 compatibility #325
Comments
Looks like six was going to support this natively, but has decided not to for some reason. Other options appear to be:
and
I'm inclined towards leveraging six if possible. |
Can you elaborate why you’d prefer leveraging six if, in this rare case, we actually could have a back- and forward compatible solution that never needs to change even if we were to get rid of six in the future? Somehow it sound advantageous to me to stay with built-in Python only as much as possible? |
I much prefer testing on the python version instead of just catching an importError. try/catch style tests tend to cause headaches when something unexpected raises an exception. |
The very point of six are to perform these python version specific delegations so I do not want to maintain my own version of this, although there may not be an option to do so because of six.
In reading the post it look like the maintainer considers 3.8 related changes unnecessary given Python 2.7 EOL. I disagree with that but it could add another item to my list of reasons to drop python 2 support...
…-Andrew Annex
On Nov 22, 2019, at 6:36 PM, Jesse Mapel ***@***.***> wrote:
I much prefer testing on the python version instead of just catching an importError. try/catch style tests tend to cause headaches when something unexpected raises an exception.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
six is also a very popular and small dependency, I don't plan on ever removing it from the package unless forced |
@jessemapel can you give an example how exception handling causes headaches for import checking? I don't understand what can be problematic here, either an import works or not. And for checking on python version, you really don't need six to do that, @AndrewAnnex I have nothing against six, it was and is a very useful and popular package. But why use it when it doesn't provide any benefit? And as you wrote above, thinking about dropping Py2 support, that would be a nice time to remove all use of six, as it reduces the codebase and therefore the maintenance burden. scikit-image just went through the same effort, after dropping legacy python support. |
it provides benefit for supporting python 2. If I drop python 2 support then there would not be a reason to use it. however, a lot of my users use python 2, and they do not like being told to upgrade, so I am not actively planning to drop python 2 support any time soon. |
you misunderstand. my question was why use six at a specific point in the code when there's no benefit for that code and built-in solutions work just as well? The less specific six uses you have in your code, the easier it will be to clean up the code base once you are dropping Py2 support and future you will love past you for that. ;) |
I understood your question perfectly well, but this isn't an urgent issue for me, and I disagree with many of the benefits you cite. |
If you understood my question well I’m puzzled why instead of addressing my point you chose to inform me that the benefit of six is to support Python 2? |
Using With the try catch logic, if a user is using Python 2 and has somehow mangled their environment, they won't get the real error message from the Python 2 import call. They will get a package not found error from the Python 3 import call. To get to the real error message, you then have to go in and comment out the try catch logic. Since this is a standard package it would take some work to get your version of Python to this state, but I don't see any draw backs to checking the version number. Plus the try catch logic will still raise a warning for Python <3.8. |
Also, what's the cost/benefit of removing/retaining Python 2 support. It seems like keeping it in is a fairly low cost with a high benefit. Taking it out is a fairly high cost with low benefit. |
Having to read a code base is an always underestimated cost. Have a look here how much “trash” can be removed when dropping Python 2 support. It’s quite a thinning. https://adamj.eu/tech/2019/03/13/dropping-python-2-support/ If the exception handling would always create a warning < 3.8, that’s a good reason not to use it. But why would it do that? Should try it. |
With Python < 3.8, |
sorry, what warning? as that import is fine in 3.7, nothing happens at those lines, i must misunderstand you. do you speak of another warning? |
Oh, you mean the warning of the tests for this issue? |
So, still confused what you mean with still having a warning < 3.8? I just tried this in 3.7: try:
import collections.abc as collections_abc
except ImportError:
import collections as collections_abc and there's no warning, as expected. |
@michaelaye I had mixed up if it does the Python 3 or Python 2 first. The warning shouldn't occur because the Python 3 approach succeeds. |
This warning will need to be addressed in the future, as it would break in Python 3.8:
The text was updated successfully, but these errors were encountered: