Skip to content

Commit fb62cd6

Browse files
committed
Merge remote-tracking branch 'origin/main' into develop-windows
2 parents f49aab6 + 7f3461d commit fb62cd6

File tree

157 files changed

+4800
-2167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+4800
-2167
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ RUN mkdir -p ${HOME} && \
2626
useradd --uid ${UID} --gid ${GID} --home ${HOME} vscode && \
2727
chown -R ${UID}:${GID} /home/vscode
2828

29-
# Fix pyenv installation
30-
RUN echo 'eval "$(pyenv init -)"' >>${HOME}/.bashrc && \
31-
chown -R vscode:vscode "${PYENV_ROOT}" && \
32-
chown -R vscode:vscode "${PIPX_HOME}"
29+
# Allow uv to download Python versions manually
30+
ENV UV_PYTHON_DOWNLOADS=manual
3331

3432
# Set user
3533
USER ${UID}:${GID}

.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

codecov.yml renamed to .github/codecov.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ ignore:
2323
- "newrelic/hooks/database_psycopg2ct.py"
2424
- "newrelic/hooks/datastore_aioredis.py"
2525
- "newrelic/hooks/datastore_aredis.py"
26-
- "newrelic/hooks/datastore_motor.py"
2726
- "newrelic/hooks/datastore_pyelasticsearch.py"
2827
- "newrelic/hooks/external_dropbox.py"
2928
- "newrelic/hooks/external_facepy.py"

.github/containers/Dockerfile

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
FROM ubuntu:20.04
16+
FROM ubuntu:24.04
1717
ARG TARGETPLATFORM
1818

1919
# Install OS packages
@@ -103,36 +103,34 @@ RUN ln -fs "/usr/share/zoneinfo/${TZ}" /etc/localtime && \
103103
ENV HOME=/root
104104
WORKDIR "${HOME}"
105105

106-
# Install pyenv
107-
ENV PYENV_ROOT="/usr/local/pyenv"
108-
RUN curl https://pyenv.run/ | /bin/bash
109-
ENV PATH="${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}"
110-
RUN echo 'eval "$(pyenv init -)"' >>${HOME}/.bashrc && \
111-
pyenv update
106+
# Install and configure uv
107+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
108+
ENV PATH="${HOME}/.local/bin:${PATH}"
109+
ENV UV_PYTHON_PREFERENCE="only-managed"
110+
ENV UV_LINK_MODE="copy"
112111

113-
# 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"
115-
COPY --chown=0:0 --chmod=755 ./install-python.sh /tmp/install-python.sh
116-
RUN /tmp/install-python.sh && \
117-
rm /tmp/install-python.sh
112+
# Install PyPy versions and rename shims
113+
RUN uv python install -f pp3.11 pp3.10
114+
RUN mv "${HOME}/.local/bin/python3.11" "${HOME}/.local/bin/pypy3.11" && \
115+
mv "${HOME}/.local/bin/python3.10" "${HOME}/.local/bin/pypy3.10"
118116

119-
# Install dependencies for main python installation
120-
COPY ./requirements.txt /tmp/requirements.txt
121-
RUN pyenv exec pip install --upgrade -r /tmp/requirements.txt && \
122-
rm /tmp/requirements.txt
117+
# Install CPython versions
118+
RUN uv python install -f cp3.14 cp3.13 cp3.12 cp3.11 cp3.10 cp3.9 cp3.8
123119

124-
# Install tools with pipx in isolated environments
125-
COPY ./requirements-tools.txt /tmp/requirements-tools.txt
126-
ENV PIPX_HOME="/opt/pipx"
127-
ENV PIPX_BIN_DIR="${PIPX_HOME}/bin"
128-
ENV PATH="${PIPX_BIN_DIR}:${PATH}"
129-
RUN mkdir -p "${PIPX_BIN_DIR}" && \
130-
while IFS="" read -r line || [ -n "$line" ]; do \
131-
pyenv exec pipx install --global "${line}"; \
132-
done </tmp/requirements-tools.txt && \
133-
rm /tmp/requirements-tools.txt
120+
# Set default Python version to CPython 3.13
121+
RUN uv python install -f --default cp3.13
134122

135-
# Inject compatibile dependencies for tox
136-
COPY ./requirements-tox.txt /tmp/requirements-tox.txt
137-
RUN pipx inject --force tox -r /tmp/requirements-tox.txt && \
138-
rm /tmp/requirements-tox.txt
123+
# Add shim for pip to use 'uv pip'
124+
COPY --chmod=775 <<EOF "${HOME}/.local/bin/pip"
125+
#!/bin/bash
126+
exec uv pip \$@
127+
EOF
128+
129+
# Prevent any runtime downloads
130+
ENV UV_PYTHON_DOWNLOADS=never
131+
132+
# Install tools with uv in isolated environments
133+
RUN uv tool install tox==4.23.2 --with tox-uv && \
134+
uv tool install ruff && \
135+
uv tool install pre-commit --with pre-commit-uv && \
136+
uv tool install asv --with virtualenv

.github/containers/Makefile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
# Override constants
1616
PLATFORM_OVERRIDE:=
17-
PYTHON_VERSIONS_OVERRIDE:=
1817

1918
# Computed variables
2019
IMAGE_NAME:=ghcr.io/newrelic/newrelic-python-agent-ci
@@ -23,8 +22,6 @@ REPO_ROOT:=$(realpath ${MAKEFILE_DIR}../../)
2322
UNAME_P:=$(shell uname -p)
2423
PLATFORM_AUTOMATIC:=$(if $(findstring arm,${UNAME_P}),linux/arm64,linux/amd64)
2524
PLATFORM:=$(if ${PLATFORM_OVERRIDE},${PLATFORM_OVERRIDE},${PLATFORM_AUTOMATIC})
26-
PYTHON_VERSIONS_AUTOMATIC:=3.10
27-
PYTHON_VERSIONS:=$(if ${PYTHON_VERSIONS_OVERRIDE},${PYTHON_VERSIONS_OVERRIDE},${PYTHON_VERSIONS_AUTOMATIC})
2825

2926
.PHONY: default
3027
default: test
@@ -33,8 +30,7 @@ default: test
3330
build:
3431
@docker build ${MAKEFILE_DIR} \
3532
--platform=${PLATFORM} \
36-
-t ${IMAGE_NAME}:local \
37-
--build-arg='PYTHON_VERSIONS=${PYTHON_VERSIONS}'
33+
-t ${IMAGE_NAME}:local
3834

3935
# Run the local tag as a container.
4036
.PHONY: run
@@ -62,12 +58,12 @@ run.%:
6258
-e GITHUB_ACTIONS="true" \
6359
${IMAGE_NAME}:$* /bin/bash
6460

65-
# Ensure python versions are usable. Cannot be automatically used with PYTHON_VERSIONS_OVERRIDE.
61+
# Ensures python versions are usable.
6662
.PHONY: test
6763
test: build
6864
@docker run --rm \
6965
--platform=${PLATFORM} \
70-
ghcr.io/newrelic/python-agent-ci:local \
66+
${IMAGE_NAME}:local \
7167
/bin/bash -c '\
7268
python3.10 --version && \
7369
touch tox.ini && tox --version && \

.github/containers/install-python.sh

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

.github/containers/requirements-tools.txt

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

.github/containers/requirements-tox.txt

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

.github/containers/requirements.txt

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

.github/workflows/benchmarks.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copyright 2010 New Relic, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
---
15+
name: Benchmarks
16+
17+
on:
18+
pull_request:
19+
20+
permissions:
21+
contents: read
22+
23+
concurrency:
24+
group: ${{ github.ref || github.run_id }}-${{ github.workflow }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
# Benchmarks
29+
benchmark:
30+
runs-on: ubuntu-24.04
31+
timeout-minutes: 30
32+
strategy:
33+
matrix:
34+
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
35+
36+
env:
37+
ASV_FACTOR: "1.1"
38+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
39+
40+
steps:
41+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
42+
with:
43+
fetch-depth: 0
44+
45+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # 6.0.0
46+
with:
47+
python-version: "${{ matrix.python }}"
48+
49+
- name: Fetch git tags
50+
run: |
51+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
52+
git fetch --tags origin
53+
54+
- name: Install Dependencies
55+
run: |
56+
pip install --upgrade pip
57+
pip install asv virtualenv
58+
59+
- name: Configure Machine Information
60+
run: |
61+
asv machine --yes
62+
63+
- name: Run Benchmark
64+
run: |
65+
asv continuous \
66+
--show-stderr \
67+
--split \
68+
--factor "${ASV_FACTOR}" \
69+
--python=${{ matrix.python }} \
70+
"${BASE_SHA}" "${GITHUB_SHA}"

0 commit comments

Comments
 (0)