Skip to content

Commit e3936b7

Browse files
committed
Revert "Drop support for Python 3.6 (elastic#2338)"
This reverts commit 76cf5c8.
1 parent 86c68d8 commit e3936b7

File tree

13 files changed

+120
-40
lines changed

13 files changed

+120
-40
lines changed

.ci/.matrix_exclude.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@ exclude:
55
# Django 4.0 requires Python 3.8+
66
- VERSION: pypy-3 # current pypy-3 is compatible with Python 3.7
77
FRAMEWORK: django-4.0
8+
- VERSION: python-3.6
9+
FRAMEWORK: django-4.0
810
- VERSION: python-3.7
911
FRAMEWORK: django-4.0
1012
# Django 4.2 requires Python 3.8+
13+
- VERSION: python-3.6
14+
FRAMEWORK: django-4.2
1115
- VERSION: python-3.7
1216
FRAMEWORK: django-4.2
1317
# Django 5.0 requires Python 3.10+
18+
- VERSION: python-3.6
19+
FRAMEWORK: django-5.0
1420
- VERSION: python-3.7
1521
FRAMEWORK: django-5.0
1622
- VERSION: python-3.8
@@ -19,8 +25,12 @@ exclude:
1925
FRAMEWORK: django-5.0
2026
- VERSION: pypy-3 # current pypy-3 is compatible with Python 3.7
2127
FRAMEWORK: celery-5-django-4
28+
- VERSION: python-3.6
29+
FRAMEWORK: celery-5-django-4
2230
- VERSION: python-3.7
2331
FRAMEWORK: celery-5-django-4
32+
- VERSION: python-3.6
33+
FRAMEWORK: celery-5-django-5
2434
- VERSION: python-3.7
2535
FRAMEWORK: celery-5-django-5
2636
- VERSION: python-3.8
@@ -30,6 +40,14 @@ exclude:
3040
# Flask
3141
- VERSION: pypy-3
3242
FRAMEWORK: flask-0.11 # see https://github.com/pallets/flask/commit/6e46d0cd, 0.11.2 was never released
43+
- VERSION: python-3.6
44+
FRAMEWORK: flask-2.1
45+
- VERSION: python-3.6
46+
FRAMEWORK: flask-2.2
47+
- VERSION: python-3.6
48+
FRAMEWORK: flask-2.3
49+
- VERSION: python-3.6
50+
FRAMEWORK: flask-3.0
3351
- VERSION: python-3.7
3452
FRAMEWORK: flask-2.3
3553
- VERSION: python-3.7
@@ -167,6 +185,8 @@ exclude:
167185
# pymssql
168186
- VERSION: pypy-3 # currently fails with error on pypy3
169187
FRAMEWORK: pymssql-newest
188+
- VERSION: python-3.6 # dropped support for py3.6
189+
FRAMEWORK: pymssql-newest
170190
# pyodbc
171191
- VERSION: pypy-3
172192
FRAMEWORK: pyodbc-newest
@@ -190,49 +210,81 @@ exclude:
190210
# aiohttp client, only supported in Python 3.7+
191211
- VERSION: pypy-3
192212
FRAMEWORK: aiohttp-3.0
213+
- VERSION: python-3.6
214+
FRAMEWORK: aiohttp-3.0
193215
- VERSION: pypy-3
194216
FRAMEWORK: aiohttp-4.0
217+
- VERSION: python-3.6
218+
FRAMEWORK: aiohttp-4.0
195219
- VERSION: pypy-3
196220
FRAMEWORK: aiohttp-newest
221+
- VERSION: python-3.6
222+
FRAMEWORK: aiohttp-newest
197223
# tornado, only supported in Python 3.7+
198224
- VERSION: pypy-3
199225
FRAMEWORK: tornado-newest
226+
- VERSION: python-3.6
227+
FRAMEWORK: tornado-newest
200228
# Starlette, only supported in python 3.7+
201229
- VERSION: pypy-3
202230
FRAMEWORK: starlette-0.13
231+
- VERSION: python-3.6
232+
FRAMEWORK: starlette-0.13
203233
- VERSION: pypy-3
204234
FRAMEWORK: starlette-0.14
235+
- VERSION: python-3.6
236+
FRAMEWORK: starlette-0.14
205237
- VERSION: pypy-3
206238
FRAMEWORK: starlette-newest
239+
- VERSION: python-3.6
240+
FRAMEWORK: starlette-newest
207241
# aiopg
208242
- VERSION: pypy-3
209243
FRAMEWORK: aiopg-newest
244+
- VERSION: python-3.6
245+
FRAMEWORK: aiopg-newest
210246
# asyncpg
211247
- VERSION: pypy-3
212248
FRAMEWORK: asyncpg-newest
213249
- VERSION: pypy-3
214250
FRAMEWORK: asyncpg-0.28
251+
- VERSION: python-3.6
252+
FRAMEWORK: asyncpg-newest
253+
- VERSION: python-3.6
254+
FRAMEWORK: asyncpg-0.28
215255
- VERSION: python-3.13
216256
FRAMEWORK: asyncpg-0.28
217257
# sanic
218258
- VERSION: pypy-3
219259
FRAMEWORK: sanic-newest
220260
- VERSION: pypy-3
221261
FRAMEWORK: sanic-20.12
262+
- VERSION: python-3.6
263+
FRAMEWORK: sanic-20.12
264+
- VERSION: python-3.6
265+
FRAMEWORK: sanic-newest
222266
- VERSION: python-3.8
223267
FRAMEWORK: sanic-newest
224268
- VERSION: python-3.13
225269
FRAMEWORK: sanic-20.12
226270
# aioredis
227271
- VERSION: pypy-3
228272
FRAMEWORK: aioredis-newest
273+
- VERSION: python-3.6
274+
FRAMEWORK: aioredis-newest
229275
# aiomysql
230276
- VERSION: pypy-3
231277
FRAMEWORK: aiomysql-newest
278+
- VERSION: python-3.6
279+
FRAMEWORK: aiomysql-newest
232280
# aiobotocore
233281
- VERSION: pypy-3
234282
FRAMEWORK: aiobotocore-newest
283+
- VERSION: python-3.6
284+
FRAMEWORK: aiobotocore-newest
235285
# mysql-connector-python
286+
- VERSION: python-3.6
287+
FRAMEWORK: mysql_connector-newest
236288
# twisted
237289
- VERSION: python-3.11
238290
FRAMEWORK: twisted-18
@@ -266,6 +318,8 @@ exclude:
266318
- VERSION: python-3.13
267319
FRAMEWORK: pylibmc-1.4
268320
# grpc
321+
- VERSION: python-3.6
322+
FRAMEWORK: grpc-newest
269323
- VERSION: python-3.7
270324
FRAMEWORK: grpc-1.24
271325
- VERSION: python-3.8

.ci/.matrix_python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
VERSION:
2-
- python-3.7
2+
- python-3.6
33
- python-3.13

.ci/.matrix_python_full.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
VERSION:
2+
- python-3.6
23
- python-3.7
34
- python-3.8
45
- python-3.9

.ci/publish-aws.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ for region in $ALL_AWS_REGIONS; do
4646
--layer-name="${FULL_LAYER_NAME}" \
4747
--description="AWS Lambda Extension Layer for the Elastic APM Python Agent" \
4848
--license-info="BSD-3-Clause" \
49-
--compatible-runtimes python3.7 python3.8 python3.9 python3.10 python3.11 python3.12 python3.13\
49+
--compatible-runtimes python3.6 python3.7 python3.8 python3.9 python3.10 python3.11 python3.12 python3.13\
5050
--zip-file="fileb://${zip_file}")
5151
echo "${publish_output}" > "${AWS_FOLDER}/${region}"
5252
layer_version=$(echo "${publish_output}" | jq '.Version')

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ jobs:
114114
fail-fast: false
115115
matrix:
116116
include:
117+
# - version: "3.6"
118+
# framework: "none"
119+
# asyncio: "true"
117120
# - version: "3.7"
118121
# framework: none
119122
# asyncio: true

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ flake8:
1010
test:
1111
# delete any __pycache__ folders to avoid hard-to-debug caching issues
1212
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
13-
echo "Python 3.7+, with asyncio"; \
14-
pytest -v $(PYTEST_ARGS) --showlocals $(PYTEST_MARKER) $(PYTEST_JUNIT); \
13+
# pypy3 should be added to the first `if` once it supports py3.7
14+
if [[ "$$PYTHON_VERSION" =~ ^(3.7|3.8|3.9|3.10|3.11|3.12|3.13|nightly)$$ ]] ; then \
15+
echo "Python 3.7+, with asyncio"; \
16+
pytest -v $(PYTEST_ARGS) --showlocals $(PYTEST_MARKER) $(PYTEST_JUNIT); \
17+
else \
18+
echo "Python < 3.7, without asyncio"; \
19+
pytest -v $(PYTEST_ARGS) --showlocals $(PYTEST_MARKER) $(PYTEST_JUNIT) --ignore-glob='*/asyncio*/*'; \
20+
fi
1521

1622
coverage: PYTEST_ARGS=--cov --cov-context=test --cov-config=setup.cfg --cov-branch
1723
coverage: export COVERAGE_FILE=.coverage.docker.$(PYTHON_FULL_VERSION).$(FRAMEWORK)

docs/reference/run-tests-locally.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ $ ./tests/scripts/docker/run_tests.sh python-version framework-version <pip-cach
5353
```
5454

5555
::::{note}
56-
The `python-version` must be of format `python-version`, e.g. `python-3.8` or `pypy-3`. The `framework` must be of format `framework-version`, e.g. `django-1.10` or `flask-0.12`.
56+
The `python-version` must be of format `python-version`, e.g. `python-3.6` or `pypy-2`. The `framework` must be of format `framework-version`, e.g. `django-1.10` or `flask-0.12`.
5757
::::
5858

5959

elasticapm/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
VERSION = "unknown"
6363

6464

65-
if sys.version_info < (3, 7):
66-
raise DeprecationWarning("The Elastic APM agent requires Python 3.7+")
65+
if sys.version_info <= (3, 5):
66+
raise DeprecationWarning("The Elastic APM agent requires Python 3.6+")
6767

6868
from elasticapm.contrib.asyncio.traces import async_capture_span # noqa: F401 E402

elasticapm/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,8 @@ def should_ignore_topic(self, topic: str) -> bool:
704704

705705
def check_python_version(self) -> None:
706706
v = tuple(map(int, platform.python_version_tuple()[:2]))
707-
if v < (3, 7):
708-
warnings.warn("The Elastic APM agent only supports Python 3.7+", DeprecationWarning)
707+
if v < (3, 6):
708+
warnings.warn("The Elastic APM agent only supports Python 3.6+", DeprecationWarning)
709709

710710
def check_server_version(
711711
self, gte: Optional[Tuple[int, ...]] = None, lte: Optional[Tuple[int, ...]] = None

elasticapm/instrumentation/register.py

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2929
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030

31+
import sys
32+
3133
from elasticapm.utils.module_import import import_string
3234

3335
_cls_register = {
@@ -68,29 +70,35 @@
6870
"elasticapm.instrumentation.packages.kafka.KafkaInstrumentation",
6971
"elasticapm.instrumentation.packages.grpc.GRPCClientInstrumentation",
7072
"elasticapm.instrumentation.packages.grpc.GRPCServerInstrumentation",
71-
"elasticapm.instrumentation.packages.asyncio.sleep.AsyncIOSleepInstrumentation",
72-
"elasticapm.instrumentation.packages.asyncio.aiohttp_client.AioHttpClientInstrumentation",
73-
"elasticapm.instrumentation.packages.httpx.async.httpx.HttpxAsyncClientInstrumentation",
74-
"elasticapm.instrumentation.packages.asyncio.elasticsearch.ElasticSearchAsyncConnection",
75-
"elasticapm.instrumentation.packages.asyncio.elasticsearch.ElasticsearchAsyncTransportInstrumentation",
76-
"elasticapm.instrumentation.packages.asyncio.aiopg.AioPGInstrumentation",
77-
"elasticapm.instrumentation.packages.asyncio.asyncpg.AsyncPGInstrumentation",
78-
"elasticapm.instrumentation.packages.tornado.TornadoRequestExecuteInstrumentation",
79-
"elasticapm.instrumentation.packages.tornado.TornadoHandleRequestExceptionInstrumentation",
80-
"elasticapm.instrumentation.packages.tornado.TornadoRenderInstrumentation",
81-
"elasticapm.instrumentation.packages.httpx.async.httpcore.HTTPCoreAsyncInstrumentation",
82-
"elasticapm.instrumentation.packages.asyncio.aioredis.RedisConnectionPoolInstrumentation",
83-
"elasticapm.instrumentation.packages.asyncio.aioredis.RedisPipelineInstrumentation",
84-
"elasticapm.instrumentation.packages.asyncio.aioredis.RedisConnectionInstrumentation",
85-
"elasticapm.instrumentation.packages.asyncio.aiomysql.AioMySQLInstrumentation",
86-
"elasticapm.instrumentation.packages.asyncio.aiobotocore.AioBotocoreInstrumentation",
87-
"elasticapm.instrumentation.packages.asyncio.starlette.StarletteServerErrorMiddlewareInstrumentation",
88-
"elasticapm.instrumentation.packages.asyncio.redis_asyncio.RedisAsyncioInstrumentation",
89-
"elasticapm.instrumentation.packages.asyncio.redis_asyncio.RedisPipelineInstrumentation",
90-
"elasticapm.instrumentation.packages.asyncio.psycopg_async.AsyncPsycopgInstrumentation",
91-
"elasticapm.instrumentation.packages.grpc.GRPCAsyncServerInstrumentation",
9273
}
9374

75+
if sys.version_info >= (3, 7):
76+
_cls_register.update(
77+
[
78+
"elasticapm.instrumentation.packages.asyncio.sleep.AsyncIOSleepInstrumentation",
79+
"elasticapm.instrumentation.packages.asyncio.aiohttp_client.AioHttpClientInstrumentation",
80+
"elasticapm.instrumentation.packages.httpx.async.httpx.HttpxAsyncClientInstrumentation",
81+
"elasticapm.instrumentation.packages.asyncio.elasticsearch.ElasticSearchAsyncConnection",
82+
"elasticapm.instrumentation.packages.asyncio.elasticsearch.ElasticsearchAsyncTransportInstrumentation",
83+
"elasticapm.instrumentation.packages.asyncio.aiopg.AioPGInstrumentation",
84+
"elasticapm.instrumentation.packages.asyncio.asyncpg.AsyncPGInstrumentation",
85+
"elasticapm.instrumentation.packages.tornado.TornadoRequestExecuteInstrumentation",
86+
"elasticapm.instrumentation.packages.tornado.TornadoHandleRequestExceptionInstrumentation",
87+
"elasticapm.instrumentation.packages.tornado.TornadoRenderInstrumentation",
88+
"elasticapm.instrumentation.packages.httpx.async.httpcore.HTTPCoreAsyncInstrumentation",
89+
"elasticapm.instrumentation.packages.asyncio.aioredis.RedisConnectionPoolInstrumentation",
90+
"elasticapm.instrumentation.packages.asyncio.aioredis.RedisPipelineInstrumentation",
91+
"elasticapm.instrumentation.packages.asyncio.aioredis.RedisConnectionInstrumentation",
92+
"elasticapm.instrumentation.packages.asyncio.aiomysql.AioMySQLInstrumentation",
93+
"elasticapm.instrumentation.packages.asyncio.aiobotocore.AioBotocoreInstrumentation",
94+
"elasticapm.instrumentation.packages.asyncio.starlette.StarletteServerErrorMiddlewareInstrumentation",
95+
"elasticapm.instrumentation.packages.asyncio.redis_asyncio.RedisAsyncioInstrumentation",
96+
"elasticapm.instrumentation.packages.asyncio.redis_asyncio.RedisPipelineInstrumentation",
97+
"elasticapm.instrumentation.packages.asyncio.psycopg_async.AsyncPsycopgInstrumentation",
98+
"elasticapm.instrumentation.packages.grpc.GRPCAsyncServerInstrumentation",
99+
]
100+
)
101+
94102
# These instrumentations should only be enabled if we're instrumenting via the
95103
# wrapper script, which calls register_wrapper_instrumentations() below.
96104
_wrapper_register = {

0 commit comments

Comments
 (0)