Skip to content

Commit

Permalink
feat(python): deprecation message when using Python <= 3.7 (#4186)
Browse files Browse the repository at this point in the history
As Python 3.7 has reached end-of-life on 2023-06-27, we will now be warning customers using it, and prompting them to upgrade to Python 3.8 or newer at their earliest convenience.



---

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
  • Loading branch information
RomainMuller committed Jul 18, 2023
1 parent 4ccbb57 commit 0ef7ace
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/@jsii/python-runtime/src/jsii/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
stats = kernel.stats


if sys.version_info < (3, 7):
if sys.version_info < (3, 8):
from platform import python_version
import warnings

warnings.warn(
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.",
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.8 as soon as possible.",
)


Expand Down
4 changes: 1 addition & 3 deletions packages/@jsii/python-runtime/tests/test_invoke_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def test_invoke_script(self, silence_node_deprecation_warnings) -> None:

assert result.returncode == 0
assert result.stdout == b"Hello World!\n"
assert result.stderr == b""

@pytest.mark.skipif(
platform.system() == "Windows",
Expand All @@ -56,7 +55,6 @@ def test_invoke_script_with_args(self, silence_node_deprecation_warnings) -> Non

assert result.returncode == 0
assert result.stdout == b"Hello World!\n arguments: arg1, arg2\n"
assert result.stderr == b""

@pytest.mark.skipif(
platform.system() == "Windows",
Expand All @@ -70,7 +68,7 @@ def test_invoke_script_with_failure(

assert result.returncode == 3
assert result.stdout == b"Hello World!\n arguments: arg1, fail\n"
assert result.stderr == b"error message to stderr\n"
assert result.stderr.startswith(b"error message to stderr\n")

@pytest.mark.skipif(
platform.system() == "Windows",
Expand Down

0 comments on commit 0ef7ace

Please sign in to comment.