Skip to content

Commit 919f735

Browse files
author
Romain Marcadier
authored
chore: deprecate Python 3.6 support (#3364)
Python 3.6 has reached end-of-life at the end of December 2021, and new `pip` releases no longer support it. Check for python versions at load of the `jsii` runtime for Python, and emit a warning if Python < 3.7 is detected. Additionally, change the `pip` build-tool requirement to be `pip ~= 22.0` if Python >= 3.7 is used. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
1 parent 75d94ef commit 919f735

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

packages/@jsii/python-runtime/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
black~=21.12b0
22
mypy==0.812
3-
pip~=21.3
3+
pip~=21.3 ; python_version < '3.7'
4+
pip~=22.0 ; python_version >= '3.7'
45
pytest~=6.2
56
pytest-mypy~=0.9
67
setuptools~=59.6

packages/@jsii/python-runtime/src/jsii/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from typing import Union
23

34
from .__meta__ import __version__, __jsii_runtime_version__
@@ -35,6 +36,15 @@
3536
stats = kernel.stats
3637

3738

39+
if sys.version_info < (3, 7):
40+
from platform import python_version
41+
import warnings
42+
43+
warnings.warn(
44+
f"WARNING: You are using python release {python_version()}, which has reached end-of-life! Support for EOL Python releases may be dropped in the future. Please consider upgrading to Python >= 3.7 as soon as possible.",
45+
)
46+
47+
3848
__all__ = [
3949
"__version__",
4050
"__jsii_runtime_version__",

0 commit comments

Comments
 (0)