You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unless I'm mistaken, there's is no way to conditionally import python-future
I have a couple of pasteurised libraries. When in modern environments, my libs don't really require future to run which results in some amount of bloat. To avoid that, I've been trying to leverage setup.py's "extras_require", which would only install future when deemed necessary.
The conventional way of doing a conditional import would look something like this:
try:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import open
from future import standard_library
standard_library.install_aliases()
except ImportError:
pass
Sadly, with future, this results in SyntaxError: from __future__ imports must occur at the beginning of the file.
I was wondering if conditional imports could be made possible (Or if there's an alternative approach that I'm unaware of here).
Note:
Implementing issue #266 could make this issue irrelevant. Feel free to close if #266 is being prioritised.
The text was updated successfully, but these errors were encountered:
Unless I'm mistaken, there's is no way to conditionally import python-future
I have a couple of pasteurised libraries. When in modern environments, my libs don't really require future to run which results in some amount of bloat. To avoid that, I've been trying to leverage setup.py's "extras_require", which would only install future when deemed necessary.
The conventional way of doing a conditional import would look something like this:
Sadly, with future, this results in
SyntaxError: from __future__ imports must occur at the beginning of the file
.I was wondering if conditional imports could be made possible (Or if there's an alternative approach that I'm unaware of here).
Note:
Implementing issue #266 could make this issue irrelevant. Feel free to close if #266 is being prioritised.
The text was updated successfully, but these errors were encountered: