Skip to content

Commit 10c092b

Browse files
committed
[init] Add py deprecation warning
Related to issue #387
1 parent 4a3e56b commit 10c092b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

odml/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ def _format_warning(warn_msg, *args, **kwargs):
2929
# Monkey patch formatting 'warnings' messages for the whole module.
3030
warnings.formatwarning = _format_warning
3131

32-
if _python_version.major < 3 or _python_version.major == 3 and _python_version.minor < 6:
32+
if _python_version.major < 3:
33+
msg = "Python 2 has been deprecated.\n\todML support for Python 2 will be dropped August 2020."
34+
warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
35+
elif _python_version.major == 3 and _python_version.minor < 6:
3336
msg = "The '%s' package is not tested with your Python version. " % __name__
3437
msg += "\n\tPlease consider upgrading to the latest Python distribution."
3538
warnings.warn(msg)

0 commit comments

Comments
 (0)