Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions .ci/.matrix_exclude.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@ exclude:
# Django 4.0 requires Python 3.8+
- VERSION: pypy-3 # current pypy-3 is compatible with Python 3.7
FRAMEWORK: django-4.0
- VERSION: python-3.6
FRAMEWORK: django-4.0
- VERSION: python-3.7
FRAMEWORK: django-4.0
# Django 4.2 requires Python 3.8+
- VERSION: python-3.6
FRAMEWORK: django-4.2
- VERSION: python-3.7
FRAMEWORK: django-4.2
# Django 5.0 requires Python 3.10+
- VERSION: python-3.6
FRAMEWORK: django-5.0
- VERSION: python-3.7
FRAMEWORK: django-5.0
- VERSION: python-3.8
Expand All @@ -25,12 +19,8 @@ exclude:
FRAMEWORK: django-5.0
- VERSION: pypy-3 # current pypy-3 is compatible with Python 3.7
FRAMEWORK: celery-5-django-4
- VERSION: python-3.6
FRAMEWORK: celery-5-django-4
- VERSION: python-3.7
FRAMEWORK: celery-5-django-4
- VERSION: python-3.6
FRAMEWORK: celery-5-django-5
- VERSION: python-3.7
FRAMEWORK: celery-5-django-5
- VERSION: python-3.8
Expand All @@ -40,14 +30,6 @@ exclude:
# Flask
- VERSION: pypy-3
FRAMEWORK: flask-0.11 # see https://github.com/pallets/flask/commit/6e46d0cd, 0.11.2 was never released
- VERSION: python-3.6
FRAMEWORK: flask-2.1
- VERSION: python-3.6
FRAMEWORK: flask-2.2
- VERSION: python-3.6
FRAMEWORK: flask-2.3
- VERSION: python-3.6
FRAMEWORK: flask-3.0
- VERSION: python-3.7
FRAMEWORK: flask-2.3
- VERSION: python-3.7
Expand Down Expand Up @@ -185,8 +167,6 @@ exclude:
# pymssql
- VERSION: pypy-3 # currently fails with error on pypy3
FRAMEWORK: pymssql-newest
- VERSION: python-3.6 # dropped support for py3.6
FRAMEWORK: pymssql-newest
# pyodbc
- VERSION: pypy-3
FRAMEWORK: pyodbc-newest
Expand All @@ -210,81 +190,49 @@ exclude:
# aiohttp client, only supported in Python 3.7+
- VERSION: pypy-3
FRAMEWORK: aiohttp-3.0
- VERSION: python-3.6
FRAMEWORK: aiohttp-3.0
- VERSION: pypy-3
FRAMEWORK: aiohttp-4.0
- VERSION: python-3.6
FRAMEWORK: aiohttp-4.0
- VERSION: pypy-3
FRAMEWORK: aiohttp-newest
- VERSION: python-3.6
FRAMEWORK: aiohttp-newest
# tornado, only supported in Python 3.7+
- VERSION: pypy-3
FRAMEWORK: tornado-newest
- VERSION: python-3.6
FRAMEWORK: tornado-newest
# Starlette, only supported in python 3.7+
- VERSION: pypy-3
FRAMEWORK: starlette-0.13
- VERSION: python-3.6
FRAMEWORK: starlette-0.13
- VERSION: pypy-3
FRAMEWORK: starlette-0.14
- VERSION: python-3.6
FRAMEWORK: starlette-0.14
- VERSION: pypy-3
FRAMEWORK: starlette-newest
- VERSION: python-3.6
FRAMEWORK: starlette-newest
# aiopg
- VERSION: pypy-3
FRAMEWORK: aiopg-newest
- VERSION: python-3.6
FRAMEWORK: aiopg-newest
# asyncpg
- VERSION: pypy-3
FRAMEWORK: asyncpg-newest
- VERSION: pypy-3
FRAMEWORK: asyncpg-0.28
- VERSION: python-3.6
FRAMEWORK: asyncpg-newest
- VERSION: python-3.6
FRAMEWORK: asyncpg-0.28
- VERSION: python-3.13
FRAMEWORK: asyncpg-0.28
# sanic
- VERSION: pypy-3
FRAMEWORK: sanic-newest
- VERSION: pypy-3
FRAMEWORK: sanic-20.12
- VERSION: python-3.6
FRAMEWORK: sanic-20.12
- VERSION: python-3.6
FRAMEWORK: sanic-newest
- VERSION: python-3.8
FRAMEWORK: sanic-newest
- VERSION: python-3.13
FRAMEWORK: sanic-20.12
# aioredis
- VERSION: pypy-3
FRAMEWORK: aioredis-newest
- VERSION: python-3.6
FRAMEWORK: aioredis-newest
# aiomysql
- VERSION: pypy-3
FRAMEWORK: aiomysql-newest
- VERSION: python-3.6
FRAMEWORK: aiomysql-newest
# aiobotocore
- VERSION: pypy-3
FRAMEWORK: aiobotocore-newest
- VERSION: python-3.6
FRAMEWORK: aiobotocore-newest
# mysql-connector-python
- VERSION: python-3.6
FRAMEWORK: mysql_connector-newest
# twisted
- VERSION: python-3.11
FRAMEWORK: twisted-18
Expand Down Expand Up @@ -318,8 +266,6 @@ exclude:
- VERSION: python-3.13
FRAMEWORK: pylibmc-1.4
# grpc
- VERSION: python-3.6
FRAMEWORK: grpc-newest
- VERSION: python-3.7
FRAMEWORK: grpc-1.24
- VERSION: python-3.8
Expand Down
2 changes: 1 addition & 1 deletion .ci/.matrix_python.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION:
- python-3.6
- python-3.7
- python-3.13
1 change: 0 additions & 1 deletion .ci/.matrix_python_full.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
VERSION:
- python-3.6
- python-3.7
- python-3.8
- python-3.9
Expand Down
21 changes: 0 additions & 21 deletions .ci/.matrix_windows.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .ci/publish-aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ for region in $ALL_AWS_REGIONS; do
--layer-name="${FULL_LAYER_NAME}" \
--description="AWS Lambda Extension Layer for the Elastic APM Python Agent" \
--license-info="BSD-3-Clause" \
--compatible-runtimes python3.6 python3.7 python3.8 python3.9 python3.10 python3.11 python3.12 python3.13\
--compatible-runtimes python3.7 python3.8 python3.9 python3.10 python3.11 python3.12 python3.13\
--zip-file="fileb://${zip_file}")
echo "${publish_output}" > "${AWS_FOLDER}/${region}"
layer_version=$(echo "${publish_output}" | jq '.Version')
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ jobs:
fail-fast: false
matrix:
include:
# - version: "3.6"
# framework: "none"
# asyncio: "true"
# - version: "3.7"
# framework: none
# asyncio: true
Expand Down
10 changes: 2 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ flake8:
test:
# delete any __pycache__ folders to avoid hard-to-debug caching issues
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
# pypy3 should be added to the first `if` once it supports py3.7
if [[ "$$PYTHON_VERSION" =~ ^(3.7|3.8|3.9|3.10|3.11|3.12|3.13|nightly)$$ ]] ; then \
echo "Python 3.7+, with asyncio"; \
pytest -v $(PYTEST_ARGS) --showlocals $(PYTEST_MARKER) $(PYTEST_JUNIT); \
else \
echo "Python < 3.7, without asyncio"; \
pytest -v $(PYTEST_ARGS) --showlocals $(PYTEST_MARKER) $(PYTEST_JUNIT) --ignore-glob='*/asyncio*/*'; \
fi
echo "Python 3.7+, with asyncio"; \
pytest -v $(PYTEST_ARGS) --showlocals $(PYTEST_MARKER) $(PYTEST_JUNIT); \

coverage: PYTEST_ARGS=--cov --cov-context=test --cov-config=setup.cfg --cov-branch
coverage: export COVERAGE_FILE=.coverage.docker.$(PYTHON_FULL_VERSION).$(FRAMEWORK)
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/run-tests-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ $ ./tests/scripts/docker/run_tests.sh python-version framework-version <pip-cach
```

::::{note}
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`.
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`.
::::


Expand Down
4 changes: 2 additions & 2 deletions elasticapm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
VERSION = "unknown"


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

from elasticapm.contrib.asyncio.traces import async_capture_span # noqa: F401 E402
4 changes: 2 additions & 2 deletions elasticapm/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,8 @@ def should_ignore_topic(self, topic: str) -> bool:

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

def check_server_version(
self, gte: Optional[Tuple[int, ...]] = None, lte: Optional[Tuple[int, ...]] = None
Expand Down
50 changes: 21 additions & 29 deletions elasticapm/instrumentation/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import sys

from elasticapm.utils.module_import import import_string

_cls_register = {
Expand Down Expand Up @@ -70,35 +68,29 @@
"elasticapm.instrumentation.packages.kafka.KafkaInstrumentation",
"elasticapm.instrumentation.packages.grpc.GRPCClientInstrumentation",
"elasticapm.instrumentation.packages.grpc.GRPCServerInstrumentation",
"elasticapm.instrumentation.packages.asyncio.sleep.AsyncIOSleepInstrumentation",
"elasticapm.instrumentation.packages.asyncio.aiohttp_client.AioHttpClientInstrumentation",
"elasticapm.instrumentation.packages.httpx.async.httpx.HttpxAsyncClientInstrumentation",
"elasticapm.instrumentation.packages.asyncio.elasticsearch.ElasticSearchAsyncConnection",
"elasticapm.instrumentation.packages.asyncio.elasticsearch.ElasticsearchAsyncTransportInstrumentation",
"elasticapm.instrumentation.packages.asyncio.aiopg.AioPGInstrumentation",
"elasticapm.instrumentation.packages.asyncio.asyncpg.AsyncPGInstrumentation",
"elasticapm.instrumentation.packages.tornado.TornadoRequestExecuteInstrumentation",
"elasticapm.instrumentation.packages.tornado.TornadoHandleRequestExceptionInstrumentation",
"elasticapm.instrumentation.packages.tornado.TornadoRenderInstrumentation",
"elasticapm.instrumentation.packages.httpx.async.httpcore.HTTPCoreAsyncInstrumentation",
"elasticapm.instrumentation.packages.asyncio.aioredis.RedisConnectionPoolInstrumentation",
"elasticapm.instrumentation.packages.asyncio.aioredis.RedisPipelineInstrumentation",
"elasticapm.instrumentation.packages.asyncio.aioredis.RedisConnectionInstrumentation",
"elasticapm.instrumentation.packages.asyncio.aiomysql.AioMySQLInstrumentation",
"elasticapm.instrumentation.packages.asyncio.aiobotocore.AioBotocoreInstrumentation",
"elasticapm.instrumentation.packages.asyncio.starlette.StarletteServerErrorMiddlewareInstrumentation",
"elasticapm.instrumentation.packages.asyncio.redis_asyncio.RedisAsyncioInstrumentation",
"elasticapm.instrumentation.packages.asyncio.redis_asyncio.RedisPipelineInstrumentation",
"elasticapm.instrumentation.packages.asyncio.psycopg_async.AsyncPsycopgInstrumentation",
"elasticapm.instrumentation.packages.grpc.GRPCAsyncServerInstrumentation",
}

if sys.version_info >= (3, 7):
_cls_register.update(
[
"elasticapm.instrumentation.packages.asyncio.sleep.AsyncIOSleepInstrumentation",
"elasticapm.instrumentation.packages.asyncio.aiohttp_client.AioHttpClientInstrumentation",
"elasticapm.instrumentation.packages.httpx.async.httpx.HttpxAsyncClientInstrumentation",
"elasticapm.instrumentation.packages.asyncio.elasticsearch.ElasticSearchAsyncConnection",
"elasticapm.instrumentation.packages.asyncio.elasticsearch.ElasticsearchAsyncTransportInstrumentation",
"elasticapm.instrumentation.packages.asyncio.aiopg.AioPGInstrumentation",
"elasticapm.instrumentation.packages.asyncio.asyncpg.AsyncPGInstrumentation",
"elasticapm.instrumentation.packages.tornado.TornadoRequestExecuteInstrumentation",
"elasticapm.instrumentation.packages.tornado.TornadoHandleRequestExceptionInstrumentation",
"elasticapm.instrumentation.packages.tornado.TornadoRenderInstrumentation",
"elasticapm.instrumentation.packages.httpx.async.httpcore.HTTPCoreAsyncInstrumentation",
"elasticapm.instrumentation.packages.asyncio.aioredis.RedisConnectionPoolInstrumentation",
"elasticapm.instrumentation.packages.asyncio.aioredis.RedisPipelineInstrumentation",
"elasticapm.instrumentation.packages.asyncio.aioredis.RedisConnectionInstrumentation",
"elasticapm.instrumentation.packages.asyncio.aiomysql.AioMySQLInstrumentation",
"elasticapm.instrumentation.packages.asyncio.aiobotocore.AioBotocoreInstrumentation",
"elasticapm.instrumentation.packages.asyncio.starlette.StarletteServerErrorMiddlewareInstrumentation",
"elasticapm.instrumentation.packages.asyncio.redis_asyncio.RedisAsyncioInstrumentation",
"elasticapm.instrumentation.packages.asyncio.redis_asyncio.RedisPipelineInstrumentation",
"elasticapm.instrumentation.packages.asyncio.psycopg_async.AsyncPsycopgInstrumentation",
"elasticapm.instrumentation.packages.grpc.GRPCAsyncServerInstrumentation",
]
)

# These instrumentations should only be enabled if we're instrumenting via the
# wrapper script, which calls register_wrapper_instrumentations() below.
_wrapper_register = {
Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ classifiers =
Operating System :: OS Independent
Topic :: Software Development
Programming Language :: Python
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Expand All @@ -33,7 +32,7 @@ project_urls =
Tracker = https://github.com/elastic/apm-agent-python/issues

[options]
python_requires = >=3.6, <4
python_requires = >=3.7, <4
packages = find:
include_package_data = true
zip_safe = false
Expand Down
23 changes: 8 additions & 15 deletions tests/requirements/reqs-base.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
pytest==7.0.1 ; python_version == '3.6'
pytest==7.4.0 ; python_version > '3.6'
pytest==7.4.0
pytest-random-order==1.1.0
pytest-django==4.4.0
coverage==6.2 ; python_version == '3.6'
coverage==6.3 ; python_version == '3.7'
coverage[toml]==6.3 ; python_version == '3.7'
coverage==7.3.1 ; python_version > '3.7'
pytest-cov==4.0.0 ; python_version < '3.8'
pytest-cov==4.1.0 ; python_version > '3.7'
jinja2==3.1.5 ; python_version == '3.7'
pytest-localserver==0.9.0
pytest-mock==3.6.1 ; python_version == '3.6'
pytest-mock==3.10.0 ; python_version > '3.6'
pytest-benchmark==3.4.1 ; python_version == '3.6'
pytest-benchmark==4.0.0 ; python_version > '3.6'
pytest-bdd==5.0.0 ; python_version == '3.6'
pytest-bdd==6.1.1 ; python_version > '3.6'
pytest-rerunfailures==10.2 ; python_version == '3.6'
pytest-rerunfailures==11.1.2 ; python_version > '3.6'
jsonschema==3.2.0 ; python_version == '3.6'
jsonschema==4.17.3 ; python_version > '3.6'
pytest-mock==3.10.0
pytest-benchmark==4.0.0
pytest-bdd==6.1.1
pytest-rerunfailures==11.1.2
jsonschema==4.17.3


urllib3!=2.0.0,<3.0.0
Expand All @@ -32,6 +25,6 @@ structlog
wrapt>=1.14.1,!=1.15.0
simplejson

pytest-asyncio==0.21.0 ; python_version >= '3.7'
asynctest==0.13.0 ; python_version >= '3.7'
pytest-asyncio==0.21.0
asynctest==0.13.0
typing_extensions!=3.10.0.1 ; python_version >= '3.10' # see https://github.com/python/typing/issues/865
2 changes: 1 addition & 1 deletion tests/scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export PATH=${HOME}/.local/bin:${PATH}
python -m pip install --user -U pip setuptools --cache-dir "${PIP_CACHE}"
python -m pip install --user -r "tests/requirements/reqs-${FRAMEWORK}.txt" --cache-dir "${PIP_CACHE}"

export PYTHON_VERSION=$(python -c "import platform; pv=platform.python_version_tuple(); print('pypy' + ('' if pv[0] == 2 else str(pv[0])) if platform.python_implementation() == 'PyPy' else '.'.join(map(str, platform.python_version_tuple()[:2])))")
export PYTHON_VERSION=$(python -c "import platform; pv=platform.python_version_tuple(); print('pypy' + (str(pv[0])) if platform.python_implementation() == 'PyPy' else '.'.join(map(str, platform.python_version_tuple()[:2])))")

# check if the full FRAMEWORK name is in scripts/envs
if [[ -e "./tests/scripts/envs/${FRAMEWORK}.sh" ]]
Expand Down
Loading