Skip to content

Commit 7271b2e

Browse files
lrafeeiTimPansinomergify[bot]
authored
Drop Python 3.7 Support (#1491)
* Drop monotonic C extension * Add warning in setup.py * Format and lint setup.py * Fix 3.7 specific logic for Flask tests * Removing all logic related to Python 3.7 * Format with ruff * Remove py37 tests from tox * Remove Python 2 syntax checks * Sort agent.py file * Fix merge commits * Remove unsupported Sanic from tests * Remove unsupported Falcon from tests * Megalinter fixes * Redo changes to setup.py --------- Co-authored-by: Tim Pansino <timpansino@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 4b415e4 commit 7271b2e

File tree

15 files changed

+180
-474
lines changed

15 files changed

+180
-474
lines changed

.github/.trivyignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Ignored Vulnerabilities
33
# =======================
44

5-
# Accepting risk due to Python 3.7 and 3.8 support.
5+
# Accepting risk due to Python 3.8 support.
66
CVE-2025-50181
77

88
# Not relevant, only affects Pyodide

.github/containers/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ RUN echo 'eval "$(pyenv init -)"' >>${HOME}/.bashrc && \
111111
pyenv update
112112

113113
# Install Python
114-
ARG PYTHON_VERSIONS="3.12 3.11 3.10 3.9 3.8 3.7 3.13 pypy3.10-7.3.17"
114+
ARG PYTHON_VERSIONS="3.13 3.12 3.11 3.10 3.9 3.8 pypy3.10-7.3.17"
115115
COPY --chown=0:0 --chmod=755 ./install-python.sh /tmp/install-python.sh
116116
RUN /tmp/install-python.sh && \
117117
rm /tmp/install-python.sh

.github/workflows/deploy.yml

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,6 @@ permissions:
2323
contents: read
2424

2525
jobs:
26-
build-linux-py3-legacy:
27-
runs-on: ubuntu-24.04
28-
strategy:
29-
fail-fast: false
30-
matrix:
31-
wheel:
32-
- cp37-manylinux
33-
- cp37-musllinux
34-
35-
steps:
36-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
37-
with:
38-
persist-credentials: false
39-
fetch-depth: 0
40-
41-
- name: Setup QEMU
42-
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # 3.6.0
43-
44-
- name: Build Wheels
45-
uses: pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce # 2.17.0
46-
env:
47-
CIBW_PLATFORM: linux
48-
CIBW_BUILD: "${{ matrix.wheel }}*"
49-
CIBW_ARCHS_LINUX: x86_64 aarch64
50-
CIBW_ENVIRONMENT: "LD_LIBRARY_PATH=/opt/rh/devtoolset-8/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib:/opt/rh/devtoolset-8/root/usr/lib64/dyninst:/opt/rh/devtoolset-8/root/usr/lib/dyninst:/usr/local/lib64:/usr/local/lib"
51-
CIBW_TEST_REQUIRES: pytest
52-
CIBW_TEST_COMMAND: "PYTHONPATH={project}/tests pytest {project}/tests/agent_unittests -vx"
53-
54-
- name: Upload Artifacts
55-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # 4.6.2
56-
with:
57-
name: ${{ github.job }}-${{ matrix.wheel }}
58-
path: ./wheelhouse/*.whl
59-
if-no-files-found: error
60-
retention-days: 1
61-
6226
build-linux-py3:
6327
runs-on: ubuntu-24.04
6428
strategy:
@@ -151,7 +115,6 @@ jobs:
151115
attestations: write
152116

153117
needs:
154-
- build-linux-py3-legacy
155118
- build-linux-py3
156119
- build-sdist
157120

THIRD_PARTY_NOTICES.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,6 @@ Distributed under the following license(s):
3535
* [The Apache License, Version 2.0 License](https://opensource.org/license/apache-2-0/)
3636

3737

38-
## [time.monotonic](newrelic/common/_monotonic.c)
39-
40-
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Python Software Foundation; All Rights Reserved
41-
42-
Distributed under the following license(s):
43-
44-
* [Python Software Foundation](https://docs.python.org/3/license.html)
45-
46-
4738
## [urllib3](https://pypi.org/project/urllib3)
4839

4940
Copyright (c) 2008-2019 Andrey Petrov and contributors (see CONTRIBUTORS.txt)

newrelic/agent.py

Lines changed: 40 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -15,56 +15,9 @@
1515
from newrelic.api.application import application_instance as __application
1616
from newrelic.api.application import application_settings as __application_settings
1717
from newrelic.api.application import register_application as __register_application
18-
from newrelic.api.log import NewRelicContextFormatter as __NewRelicContextFormatter
19-
from newrelic.api.time_trace import add_custom_span_attribute as __add_custom_span_attribute
20-
from newrelic.api.time_trace import current_trace as __current_trace
21-
from newrelic.api.time_trace import get_linking_metadata as __get_linking_metadata
22-
from newrelic.api.time_trace import notice_error as __notice_error
23-
from newrelic.api.transaction import accept_distributed_trace_headers as __accept_distributed_trace_headers
24-
from newrelic.api.transaction import add_custom_attribute as __add_custom_attribute
25-
from newrelic.api.transaction import add_custom_attributes as __add_custom_attributes
26-
from newrelic.api.transaction import add_framework_info as __add_framework_info
27-
from newrelic.api.transaction import capture_request_params as __capture_request_params
28-
from newrelic.api.transaction import current_span_id as __current_span_id
29-
from newrelic.api.transaction import current_trace_id as __current_trace_id
30-
from newrelic.api.transaction import current_transaction as __current_transaction
31-
from newrelic.api.transaction import disable_browser_autorum as __disable_browser_autorum
32-
from newrelic.api.transaction import end_of_transaction as __end_of_transaction
33-
from newrelic.api.transaction import get_browser_timing_header as __get_browser_timing_header
34-
from newrelic.api.transaction import ignore_transaction as __ignore_transaction
35-
from newrelic.api.transaction import insert_distributed_trace_headers as __insert_distributed_trace_headers
36-
from newrelic.api.transaction import record_custom_event as __record_custom_event
37-
from newrelic.api.transaction import record_custom_metric as __record_custom_metric
38-
from newrelic.api.transaction import record_custom_metrics as __record_custom_metrics
39-
from newrelic.api.transaction import record_log_event as __record_log_event
40-
from newrelic.api.transaction import record_ml_event as __record_ml_event
41-
from newrelic.api.transaction import set_background_task as __set_background_task
42-
from newrelic.api.transaction import set_transaction_name as __set_transaction_name
43-
from newrelic.api.transaction import suppress_apdex_metric as __suppress_apdex_metric
44-
from newrelic.api.transaction import suppress_transaction_trace as __suppress_transaction_trace
45-
from newrelic.api.wsgi_application import WSGIApplicationWrapper as __WSGIApplicationWrapper
46-
from newrelic.api.wsgi_application import wrap_wsgi_application as __wrap_wsgi_application
47-
from newrelic.api.wsgi_application import wsgi_application as __wsgi_application
48-
from newrelic.config import extra_settings as __extra_settings
49-
from newrelic.config import initialize as __initialize
50-
from newrelic.core.agent import register_data_source as __register_data_source
51-
from newrelic.core.agent import shutdown_agent as __shutdown_agent
52-
from newrelic.core.config import global_settings as __global_settings
53-
from newrelic.samplers.decorators import data_source_factory as __data_source_factory
54-
from newrelic.samplers.decorators import data_source_generator as __data_source_generator
55-
56-
try:
57-
from newrelic.api.asgi_application import ASGIApplicationWrapper as __ASGIApplicationWrapper
58-
from newrelic.api.asgi_application import asgi_application as __asgi_application
59-
from newrelic.api.asgi_application import wrap_asgi_application as __wrap_asgi_application
60-
except SyntaxError:
61-
62-
def __asgi_application(*args, **kwargs):
63-
pass
64-
65-
__ASGIApplicationWrapper = __asgi_application
66-
__wrap_asgi_application = __asgi_application
67-
18+
from newrelic.api.asgi_application import ASGIApplicationWrapper as __ASGIApplicationWrapper
19+
from newrelic.api.asgi_application import asgi_application as __asgi_application
20+
from newrelic.api.asgi_application import wrap_asgi_application as __wrap_asgi_application
6821
from newrelic.api.background_task import BackgroundTask as __BackgroundTask
6922
from newrelic.api.background_task import BackgroundTaskWrapper as __BackgroundTaskWrapper
7023
from newrelic.api.background_task import background_task as __background_task
@@ -96,6 +49,7 @@ def __asgi_application(*args, **kwargs):
9649
from newrelic.api.html_insertion import insert_html_snippet as __insert_html_snippet
9750
from newrelic.api.html_insertion import verify_body_exists as __verify_body_exists
9851
from newrelic.api.llm_custom_attributes import WithLlmCustomAttributes as __WithLlmCustomAttributes
52+
from newrelic.api.log import NewRelicContextFormatter as __NewRelicContextFormatter
9953
from newrelic.api.message_trace import MessageTrace as __MessageTrace
10054
from newrelic.api.message_trace import MessageTraceWrapper as __MessageTraceWrapper
10155
from newrelic.api.message_trace import message_trace as __message_trace
@@ -112,14 +66,43 @@ def __asgi_application(*args, **kwargs):
11266
from newrelic.api.profile_trace import wrap_profile_trace as __wrap_profile_trace
11367
from newrelic.api.settings import set_error_group_callback as __set_error_group_callback
11468
from newrelic.api.supportability import wrap_api_call as __wrap_api_call
69+
from newrelic.api.time_trace import add_custom_span_attribute as __add_custom_span_attribute
70+
from newrelic.api.time_trace import current_trace as __current_trace
71+
from newrelic.api.time_trace import get_linking_metadata as __get_linking_metadata
72+
from newrelic.api.time_trace import notice_error as __notice_error
73+
from newrelic.api.transaction import accept_distributed_trace_headers as __accept_distributed_trace_headers
74+
from newrelic.api.transaction import add_custom_attribute as __add_custom_attribute
75+
from newrelic.api.transaction import add_custom_attributes as __add_custom_attributes
76+
from newrelic.api.transaction import add_framework_info as __add_framework_info
77+
from newrelic.api.transaction import capture_request_params as __capture_request_params
78+
from newrelic.api.transaction import current_span_id as __current_span_id
79+
from newrelic.api.transaction import current_trace_id as __current_trace_id
80+
from newrelic.api.transaction import current_transaction as __current_transaction
81+
from newrelic.api.transaction import disable_browser_autorum as __disable_browser_autorum
82+
from newrelic.api.transaction import end_of_transaction as __end_of_transaction
83+
from newrelic.api.transaction import get_browser_timing_header as __get_browser_timing_header
84+
from newrelic.api.transaction import ignore_transaction as __ignore_transaction
85+
from newrelic.api.transaction import insert_distributed_trace_headers as __insert_distributed_trace_headers
86+
from newrelic.api.transaction import record_custom_event as __record_custom_event
87+
from newrelic.api.transaction import record_custom_metric as __record_custom_metric
88+
from newrelic.api.transaction import record_custom_metrics as __record_custom_metrics
89+
from newrelic.api.transaction import record_log_event as __record_log_event
90+
from newrelic.api.transaction import record_ml_event as __record_ml_event
91+
from newrelic.api.transaction import set_background_task as __set_background_task
92+
from newrelic.api.transaction import set_transaction_name as __set_transaction_name
11593
from newrelic.api.transaction import set_user_id as __set_user_id
94+
from newrelic.api.transaction import suppress_apdex_metric as __suppress_apdex_metric
95+
from newrelic.api.transaction import suppress_transaction_trace as __suppress_transaction_trace
11696
from newrelic.api.transaction_name import TransactionNameWrapper as __TransactionNameWrapper
11797
from newrelic.api.transaction_name import transaction_name as __transaction_name
11898
from newrelic.api.transaction_name import wrap_transaction_name as __wrap_transaction_name
11999
from newrelic.api.web_transaction import WebTransaction as __WebTransaction
120100
from newrelic.api.web_transaction import WebTransactionWrapper as __WebTransactionWrapper
121101
from newrelic.api.web_transaction import web_transaction as __web_transaction
122102
from newrelic.api.web_transaction import wrap_web_transaction as __wrap_web_transaction
103+
from newrelic.api.wsgi_application import WSGIApplicationWrapper as __WSGIApplicationWrapper
104+
from newrelic.api.wsgi_application import wrap_wsgi_application as __wrap_wsgi_application
105+
from newrelic.api.wsgi_application import wsgi_application as __wsgi_application
123106
from newrelic.common.object_names import callable_name as __callable_name
124107
from newrelic.common.object_wrapper import CallableObjectProxy as __CallableObjectProxy
125108
from newrelic.common.object_wrapper import FunctionWrapper as __FunctionWrapper
@@ -143,6 +126,13 @@ def __asgi_application(*args, **kwargs):
143126
from newrelic.common.object_wrapper import wrap_out_function as __wrap_out_function
144127
from newrelic.common.object_wrapper import wrap_post_function as __wrap_post_function
145128
from newrelic.common.object_wrapper import wrap_pre_function as __wrap_pre_function
129+
from newrelic.config import extra_settings as __extra_settings
130+
from newrelic.config import initialize as __initialize
131+
from newrelic.core.agent import register_data_source as __register_data_source
132+
from newrelic.core.agent import shutdown_agent as __shutdown_agent
133+
from newrelic.core.config import global_settings as __global_settings
134+
from newrelic.samplers.decorators import data_source_factory as __data_source_factory
135+
from newrelic.samplers.decorators import data_source_generator as __data_source_generator
146136

147137
# EXPERIMENTAL - Generator traces are currently experimental and may not
148138
# exist in this form in future versions of the agent.

newrelic/common/_monotonic.c

Lines changed: 0 additions & 155 deletions
This file was deleted.

newrelic/common/package_version_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def int_or_str(value):
6969
return version
7070

7171

72-
@lru_cache()
72+
@lru_cache
7373
def _get_package_version(name):
7474
module = sys.modules.get(name, None)
7575
version = None

0 commit comments

Comments
 (0)