question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: Remove Python 3.6 support

See original GitHub issue

Use case

Now that Python 3.6 has been deprecated, moving up to Python 3.7 will come with some user experience improvements.

Also most of the library dependencies don’t support Python 3.6 anymore in their Github Actions:

NOTE: JMESPath has already caused issues in 1.0.0, and had to be removed. Some utilities use JMESPath and not Boto3, and so we can not account JMESPath will always be bundled at runtime like when vendored version requests was removed

Runtime dependencies:

And same for dev tooling:

Solution/User Experience

Drop Python 3.6 from the supported list for the next couple released. And then start targeting Python 3.7+ features like enhanced typing. Add back JMESPath as a dependency

And embrace some of the cool new features in Python 3.7 like:

Solution as a diff to develop batch at the time of righting:

diff --git a/.github/workflows/python_build.yml b/.github/workflows/python_build.yml
index f37f6c70..306e08b4 100644
--- a/.github/workflows/python_build.yml
+++ b/.github/workflows/python_build.yml
@@ -16,7 +16,7 @@ jobs:
     strategy:
       max-parallel: 4
       matrix:
-        python-version: [3.6, 3.7, 3.8, 3.9]
+        python-version: ["3.7", "3.8", "3.9"]
     env:
       OS: ${{ matrix.os }}
       PYTHON: ${{ matrix.python-version }}
diff --git a/pyproject.toml b/pyproject.toml
index 7263ff4b..11f84273 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -20,7 +20,7 @@ keywords = ["aws_lambda_powertools", "aws", "tracing", "logging", "lambda", "pow
 license = "MIT-0"
 
 [tool.poetry.dependencies]
-python = "^3.6.2"
+python = "^3.7.10"
 aws-xray-sdk = "^2.8.0"
 fastjsonschema = "^2.14.5"
 boto3 = "^1.18"
diff --git a/tests/functional/idempotency/test_idempotency.py b/tests/functional/idempotency/test_idempotency.py
index 40cee10e..2862b0fb 100644
--- a/tests/functional/idempotency/test_idempotency.py
+++ b/tests/functional/idempotency/test_idempotency.py
@@ -1,4 +1,5 @@
 import copy
+import dataclasses
 import sys
 from hashlib import md5
 from unittest.mock import MagicMock
@@ -32,13 +33,6 @@ from tests.functional.utils import json_serialize, load_event
 TABLE_NAME = "TEST_TABLE"
 
 
-def get_dataclasses_lib():
-    """Python 3.6 doesn't support dataclasses natively"""
-    import dataclasses
-
-    return dataclasses
-
-
 # Using parametrize to run test twice, with two separate instances of persistence store. One instance with caching
 # enabled, and one without.
 @pytest.mark.parametrize("idempotency_config", [{"use_local_cache": False}, {"use_local_cache": True}], indirect=True)
@@ -1128,11 +1122,8 @@ def test_invalid_dynamodb_persistence_layer():
     assert str(ve.value) == "key_attr [id] and sort_key_attr [id] cannot be the same!"
 
 
-@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher for dataclasses")
 def test_idempotent_function_dataclasses():
     # Scenario _prepare_data should convert a python dataclasses to a dict
-    dataclasses = get_dataclasses_lib()
-
     @dataclasses.dataclass
     class Foo:
         name: str
@@ -1162,10 +1153,8 @@ def test_idempotent_function_other(data):
     assert _prepare_data(data) == data
 
 
-@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher for dataclasses")
 def test_idempotent_function_dataclass_with_jmespath():
     # GIVEN
-    dataclasses = get_dataclasses_lib()
     config = IdempotencyConfig(event_key_jmespath="transaction_id", use_local_cache=True)
     mock_event = {"customer_id": "fake", "transaction_id": "fake-id"}
     idempotency_key = "test-func.collect_payment#" + hash_idempotency_key(mock_event["transaction_id"])

Alternative solutions

Ultimately, there is no other solutions that make sense like Python 3.6 support is completely removed from AWS Lambda.

Acknowledgment

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sthulbcommented, Apr 20, 2022

Whilst Python 3.6 has hit EOL, we’ll continue to support until at least the end dates provided by the announcement email:

As described in the Lambda runtime support policy [2], end of support for language runtimes in Lambda happens in two stages. Starting July 18, 2022, Lambda will no longer apply security patches and other updates to the Python 3.6 runtime used by Lambda functions, and functions using Python 3.6 will no longer be eligible for technical support. In addition, you will no longer be able to create new Lambda functions using the Python 3.6 runtime. Starting August 17, 2022, you will no longer be able to update existing functions using the Python 3.6 runtime.

We’ll revisit this in late August, as that’s when customers will no longer be able to update existing functions.

0reactions
michaelbrewercommented, Apr 21, 2022

Added boto3 deprecation notice which is from 2022-05-30

Read more comments on GitHub >

github_iconTop Results From Across the Web

Community Updates — Requests 2.28.1 documentation
Requests support for Python 2.7 and 3.6 will be ending in 2022. While we don't have exact dates, Requests 2.27.x is likely to...
Read more >
What's New In Python 3.6 — Python 3.11.1 documentation
This article explains the new features in Python 3.6, compared to 3.5. Python 3.6 was ... and endheaders() both now support chunked encoding...
Read more >
can't uninstall Python 3.6 on windows 10 - Super User
Solution: UNHIDE ALL FOLDERS BEFORE FOLLOWING DOWN... Go to C:\Users\%USERNAME%\AppData\Local\Programs; Delete Python Folder; Go to Control ...
Read more >
Installing, uninstalling, or upgrading Python modules using ...
Uninstalling/removing Python packages using Pip​​ Open a terminal window. To uninstall, or remove, a package use the command '$PIP uninstall < ...
Read more >
How to PIP Install Requests Python Package - ActiveState
The Requests library is available for both Python 2 and Python 3 from the Python Package Index (PyPI), and has the following features:....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found