Skip to content

Commit f6bbda3

Browse files
authored
feature: add support to python 3.13 (#366)
1 parent 320ef70 commit f6bbda3

File tree

7 files changed

+36
-24
lines changed

7 files changed

+36
-24
lines changed

.github/workflows/CI.yaml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,15 @@ jobs:
3636
runs-on: ubuntu-latest
3737
steps:
3838
- name: Checkout source codes
39-
uses: actions/checkout@v3
39+
uses: actions/checkout@v4
4040
with:
4141
submodules: true
4242
- name: Check License
4343
uses: apache/skywalking-eyes/header@501a28d2fb4a9b962661987e50cf0219631b32ff
44+
- name: Set up Python
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: 3.8
4448
- name: Lint codes
4549
run: |
4650
make poetry
@@ -54,9 +58,13 @@ jobs:
5458
runs-on: ubuntu-latest
5559
steps:
5660
- name: Checkout source codes
57-
uses: actions/checkout@v3
61+
uses: actions/checkout@v4
5862
with:
5963
submodules: true
64+
- name: Set up Python
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version: 3.8
6068
- name: Check plugin doc
6169
run: |
6270
make env
@@ -73,7 +81,7 @@ jobs:
7381
outputs:
7482
agent: ${{ steps.filter.outputs.agent }}
7583
steps:
76-
- uses: actions/checkout@v3 # required for push event
84+
- uses: actions/checkout@v4 # required for push event
7785
- name: Check for file changes
7886
uses: getsentry/[email protected]
7987
id: filter
@@ -107,7 +115,7 @@ jobs:
107115
((github.event_name == 'schedule' && github.repository == 'apache/skywalking-python') || needs.changes.outputs.agent == 'true')
108116
runs-on: ubuntu-latest
109117
steps:
110-
- uses: actions/checkout@v3
118+
- uses: actions/checkout@v4
111119
- id: set-matrix
112120
run: |
113121
sudo apt-get install jq
@@ -131,15 +139,15 @@ jobs:
131139
BASE_PYTHON_IMAGE: ${{ matrix.python-version }}
132140
steps:
133141
- name: Checkout source codes
134-
uses: actions/checkout@v3
142+
uses: actions/checkout@v4
135143
with:
136144
submodules: true
137145
- name: Build SkyWalking Python agent base plugin image
138146
run: |
139147
docker build --build-arg BASE_PYTHON_IMAGE -t apache/skywalking-python-agent:latest-plugin --no-cache . -f tests/plugin/Dockerfile.plugin
140148
docker save -o docker-images-skywalking-python-plugin-${{ matrix.python-version }}.tar apache/skywalking-python-agent:latest-plugin
141149
- name: Upload docker image with specific python version
142-
uses: actions/upload-artifact@v3
150+
uses: actions/upload-artifact@v4
143151
with:
144152
name: docker-images-skywalking-python-plugin-${{ matrix.python-version }}
145153
path: docker-images-skywalking-python-plugin-${{ matrix.python-version }}.tar
@@ -164,7 +172,7 @@ jobs:
164172
BASE_PYTHON_IMAGE: ${{ matrix.python-version }}
165173
steps:
166174
- name: Checkout source codes
167-
uses: actions/checkout@v3
175+
uses: actions/checkout@v4
168176
with:
169177
submodules: true
170178
- name: Install docker-compose
@@ -177,15 +185,15 @@ jobs:
177185
sudo chmod +x /usr/local/bin/docker-compose
178186
fi
179187
- name: Pull SkyWalking Python agent base image
180-
uses: actions/download-artifact@v3
188+
uses: actions/download-artifact@v4
181189
with:
182190
name: docker-images-skywalking-python-plugin-${{ matrix.python-version }}-slim
183191
path: docker-images
184192
- name: Load docker images
185193
run: find docker-images -name "*.tar" -exec docker load -i {} \;
186194
- name: Set up Python ${{ matrix.python-version }}
187195
# This step is crucial for correct plugin matrix in test orchestration
188-
uses: actions/setup-python@v4
196+
uses: actions/setup-python@v5
189197
with:
190198
python-version: ${{ matrix.python-version }}
191199
- name: Run unit tests
@@ -210,15 +218,15 @@ jobs:
210218
BASE_PYTHON_IMAGE: ${{ matrix.python-image-variant }}
211219
steps:
212220
- name: Checkout source codes
213-
uses: actions/checkout@v3
221+
uses: actions/checkout@v4
214222
with:
215223
submodules: true
216224
- name: Build SkyWalking Python agent base e2e image
217225
run: |
218226
docker build --build-arg BASE_PYTHON_IMAGE -t apache/skywalking-python-agent:latest-e2e --no-cache . -f tests/e2e/base/Dockerfile.e2e
219227
docker save -o docker-images-skywalking-python-e2e-${{ matrix.python-image-variant }}.tar apache/skywalking-python-agent:latest-e2e
220228
- name: Upload docker image
221-
uses: actions/upload-artifact@v3
229+
uses: actions/upload-artifact@v4
222230
with:
223231
name: docker-images-skywalking-python-e2e-${{ matrix.python-image-variant }}
224232
path: docker-images-skywalking-python-e2e-${{ matrix.python-image-variant }}.tar
@@ -262,11 +270,11 @@ jobs:
262270
fail-fast: false
263271
steps:
264272
- name: Checkout source codes
265-
uses: actions/checkout@v3
273+
uses: actions/checkout@v4
266274
with:
267275
submodules: true
268276
- name: Pull SkyWalking Python agent base image
269-
uses: actions/download-artifact@v3
277+
uses: actions/download-artifact@v4
270278
with:
271279
name: docker-images-skywalking-python-e2e-${{ matrix.python-image-variant }}
272280
path: docker-images
@@ -278,7 +286,7 @@ jobs:
278286
log-dir: /tmp/e2e-logs
279287
e2e-file: ${{ matrix.case.path }}
280288
- name: Upload Logs
281-
uses: actions/upload-artifact@v3
289+
uses: actions/upload-artifact@v4
282290
if: ${{ failure() }}
283291
with:
284292
name: e2e_logs_${{ matrix.case.name }}_${{ matrix.python-image-variant }}

.github/workflows/dead-link-checker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
timeout-minutes: 30
3636
if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking-python') || (github.event_name != 'schedule')
3737
steps:
38-
- uses: actions/checkout@v3
38+
- uses: actions/checkout@v4
3939
- uses: gaurav-nelson/github-action-markdown-link-check@v1
4040
with:
4141
use-quiet-mode: 'no'

.github/workflows/publish-docker.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
packages: write
3535
timeout-minutes: 120
3636
steps:
37-
- uses: actions/checkout@v2
37+
- uses: actions/checkout@v4
3838
with:
3939
submodules: true
4040
- name: Set environment variables
@@ -54,14 +54,14 @@ jobs:
5454
echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
5555
fi
5656
- name: Log in to the Container registry
57-
uses: docker/login-action@v2
57+
uses: docker/login-action@v3
5858
with:
5959
registry: ${{ env.DOCKER_REGISTRY }}
6060
username: ${{ env.DOCKER_USERNAME }}
6161
password: ${{ env.DOCKER_PASSWORD }}
6262
- name: Set up QEMU
63-
uses: docker/setup-qemu-action@v1
63+
uses: docker/setup-qemu-action@v3
6464
- name: Set up Docker Buildx
65-
uses: docker/setup-buildx-action@v1
65+
uses: docker/setup-buildx-action@v3
6666
- name: Build and push docker image
6767
run: make push-image -j 5

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Feature:
66
- Drop support for 3.7 (#356)
77
- Support sampling rate setup. Provide `SW_SAMPLE_N_PER_3_SECS` environment variable to control it (#357)
8+
- Add suport for 3.13 (#366)
89

910
- Plugins:
1011
- Add gRPC plugin (#362)

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@ endif
5252

5353
.PHONY: gen
5454
gen:
55-
poetry run pip install grpcio-tools packaging
55+
poetry run pip install grpcio-tools==1.68.0 packaging
5656
poetry run python3 tools/grpc_code_gen.py
5757

5858
.PHONY: gen-basic
5959
gen-basic:
60-
python3 -m pip install grpcio-tools packaging
60+
python3 -m pip install grpcio-tools==1.68.0 packaging
6161
python3 tools/grpc_code_gen.py
6262

6363
.PHONY: install
6464
install: gen-basic
6565
python3 -m pip install --upgrade pip
66-
python3 -m pip install .[all]
66+
python3 -m pip install -e .[all]
6767

6868
.PHONY: lint
6969
# flake8 configurations should go to the file setup.cfg

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ sw-python = 'skywalking.bootstrap.cli.sw_python:start'
6969

7070

7171
[tool.poetry.dependencies]
72-
python = ">=3.8, <3.12"
72+
python = ">=3.8, <=3.13"
7373
grpcio = '*'
7474
grpcio-tools = '*'
7575
packaging = '*'

skywalking/plugins/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ def install():
5656
logger.info("plugin %s is disabled and thus won't be installed", modname)
5757
continue
5858
logger.debug('installing plugin %s', modname)
59-
plugin = importer.find_module(modname).load_module(modname)
59+
if sys.version_info < (3, 12):
60+
plugin = importer.find_module(modname).load_module(modname)
61+
else:
62+
plugin = importlib.util.module_from_spec(importer.find_spec(modname))
6063

6164
# todo: refactor the version checker, currently it doesn't really work as intended
6265
supported = pkg_version_check(plugin)

0 commit comments

Comments
 (0)