Skip to content

Commit

Permalink
update latest dev@726b (#697)
Browse files Browse the repository at this point in the history
* use python:3.13

* update mysql-connector-python  (#695)

* [py] python version

> https://devguide.python.org/versions/

- remove python3.8

* [#693]  update mysql-connector-python

> #693
# Conflicts:
#	setup.py
#	setup_pypi_test.py

* add CIBW_SKIP

* fix build failed

* update upload-artifact

* fix action script

* Update setup-php-sdk action (#696)
  • Loading branch information
eeliu authored Nov 6, 2024
1 parent bbfa106 commit c770778
Show file tree
Hide file tree
Showing 16 changed files with 129 additions and 42 deletions.
37 changes: 24 additions & 13 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,41 +45,48 @@ jobs:
python -m build -s --outdir wheelhouse
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
run: python -m pip install cibuildwheel==2.21.3

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_WINDOWS: ARM64 AMD64 x86
CIBW_ARCHS_MACOS: auto x86_64 arm64
CIBW_SKIP: cp37-* cp38-* cp36-* pp*

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: pypi_test
name: pypi_test-${{ matrix.os }}
path: ./wheelhouse/*
retention-days: 1
if-no-files-found: error

publish-pypitest:
needs: build_wheels_pypitest
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4.1.7
- uses: actions/download-artifact@v4
with:
name: pypi_test
pattern: pypi_test-*
merge-multiple: true
path: ./wheelhouse/

- name: show all artifact
run: |
ls -R ./wheelhouse/
ls -alR ./wheelhouse/
- name: Publish package to pypitest
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.EELIUTEST }}
packages_dir: ./wheelhouse/
repository_url: https://test.pypi.org/legacy/

packages-dir: ./wheelhouse/
repository-url: https://test.pypi.org/legacy/
skip_existing: true
verbose: true
print_hash: true
attestations: true
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -114,24 +121,28 @@ jobs:
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_WINDOWS: ARM64 AMD64 x86
CIBW_ARCHS_MACOS: auto x86_64 arm64
CIBW_SKIP: cp37-* cp38-* cp36-* pp*

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: pypi
name: pypi-${{ matrix.os }}
path: ./wheelhouse/*
retention-days: 1
if-no-files-found: error

publish:
needs: build_wheels
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
name: pypi
pattern: pypi-*
merge-multiple: true
path: ./wheelhouse/

- name: show all artifact
run: |
ls -R ./wheelhouse/
ls -alR ./wheelhouse/
- name: Publish package to pypitest
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-13]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11","3.12","3.13"]
runs-on: ${{ matrix.os }}
needs: [cpp, cpp-windows]
steps:
Expand Down Expand Up @@ -277,10 +277,13 @@ jobs:
# run: docker-compose -f "testapps/compose.yaml" build python-plugins
# - name: build python-plugins
- name: start test environment
run: ./docker-compose-linux-x86_64 -f "testapps/compose.yaml" up python-plugins --exit-code-from python-plugins
run: |
./docker-compose-linux-x86_64 -f "testapps/compose.yaml" up py3.9-plugins --exit-code-from py3.9-plugins
./docker-compose-linux-x86_64 -f "testapps/compose.yaml" up py-plugins --exit-code-from py-plugins
./docker-compose-linux-x86_64 -f "testapps/compose.yaml" up py3.11-plugins --exit-code-from py3.11-plugins
- name: Stop containers
# if: always()
run: ./docker-compose-linux-x86_64 -f "testapps/compose.yaml" down python-plugins
run: ./docker-compose-linux-x86_64 -f "testapps/compose.yaml" down py3.11-plugins py-plugins py3.9-plugins

Collector-agent:
strategy:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Our advantage:

## Python Agent

> py 3.8+
> py 3.9+
`pip install pinpointPy`

Expand Down
2 changes: 1 addition & 1 deletion Readme-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Pinpoint-c-agent 帮助您接入 [pinpoint-apm](https://github.com/pinpoint-apm/

## Python Agent

> py 3.8+
> py 3.9+
`pip install pinpointPy`

Expand Down
2 changes: 1 addition & 1 deletion Readme-KR.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Pinpoint-c-agent는 [pinpoint-apm](https://github.com/pinpoint-apm/pinpoint) 모

## Python Agent

> py 3.8+
> py 3.9+
`pip install pinpointPy`

Expand Down
9 changes: 8 additions & 1 deletion plugins/PY/pinpointPy/libs/_MysqlConnector/CMysqlPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@
# ------------------------------------------------------------------------------

from pinpointPy import Common, Defines, pinpoint
import mysql
import warnings

#


class CMysqlPlugin(Common.PinTrace):

def __init__(self, name):
warnings.warn(
"CMysqlPlugin is deprecated, please use MysqlPlugin instead", DeprecationWarning)
super().__init__(name)

# -> tuple[Any, tuple[Any, ...], dict[str, Any]]:
Expand Down Expand Up @@ -48,4 +54,5 @@ def onException(self, traceId, e):
pinpoint.add_exception(f'{e}', traceId)

def get_cursor_host(self, cursor):
return f'{cursor._cnx.server_host}:{cursor._cnx.server_port}'
# https://github.com/mysql/mysql-connector-python/blob/4fbf521f1c6c71621f882f89c0c4946c10ee13ac/mysql-connector-python/lib/mysql/connector/abstracts.py#L692
return f'{cursor._connection._host}:{cursor._connection._host}'
6 changes: 5 additions & 1 deletion plugins/PY/pinpointPy/libs/_MysqlConnector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,9 @@ def monkey_patch():


__all__ = ['monkey_patch']
__version__ = '0.0.5'
__version__ = '0.0.6'
__author__ = '[email protected]'

# Changes
# ## 0.0.6
# - remove `CMySQLCursor` and `CMySQLCursorPrepared`
26 changes: 13 additions & 13 deletions plugins/PY/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
bottle==0.12.25
fastapi==0.111.0
flask==3.0.0
httpx==0.25.1
mysql-connector-python==8.0.31
pymongo==4.6.3
PyMySQL==1.1.1
redis==5.0.1
requests==2.31.0
SQLAlchemy==2.0.23
starlette-context==0.3.6
mysqlclient==2.2.0
bottle
fastapi
flask
httpx
mysql-connector-python
pymongo
PyMySQL
redis
requests
SQLAlchemy
starlette-context
mysqlclient
grpcio
grpc-interceptor==0.15.4
grpc-interceptor
psycopg2
pinpointPy
36 changes: 34 additions & 2 deletions testapps/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,41 @@ services:
ports:
- 27017:27017

python-plugins:
py3.9-plugins:
build:
dockerfile: testapps/python-plugins.dockerfile
dockerfile: testapps/python-plugins/py3.9-plugins.dockerfile
context: ../
profiles:
- testing
depends_on:
redis:
condition: service_healthy
httpbin:
condition: service_healthy
mongodb:
condition: service_healthy
postgres:
condition: service_healthy

py3.11-plugins:
build:
dockerfile: testapps/python-plugins/py3.11-plugins.dockerfile
context: ../
profiles:
- testing
depends_on:
redis:
condition: service_healthy
httpbin:
condition: service_healthy
mongodb:
condition: service_healthy
postgres:
condition: service_healthy

py-plugins:
build:
dockerfile: testapps/python-plugins/py-plugins.dockerfile
context: ../
profiles:
- testing
Expand Down
2 changes: 1 addition & 1 deletion testapps/django.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8
FROM python:3.12
WORKDIR /app/

COPY testapps/django/mysite/ /app/
Expand Down
2 changes: 1 addition & 1 deletion testapps/fastapi.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8
FROM python:3.12
WORKDIR /app/

COPY testapps/fastapi/ /app/
Expand Down
2 changes: 1 addition & 1 deletion testapps/grpc_py.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8
FROM python:3.12
WORKDIR /app/

COPY testapps/grpc-py/ /app/
Expand Down
2 changes: 1 addition & 1 deletion testapps/grpc_py_client.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8
FROM python:3.12
WORKDIR /app/

COPY testapps/grpc-py/ /app/
Expand Down
15 changes: 15 additions & 0 deletions testapps/python-plugins/py-plugins.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:latest

COPY setup.py /pinpoint-c-agent/setup.py
COPY common/ /pinpoint-c-agent/common
COPY README /pinpoint-c-agent/README
COPY plugins/PY /pinpoint-c-agent/plugins/PY
COPY src/PY /pinpoint-c-agent/src/PY


RUN pip install -r /pinpoint-c-agent/plugins/PY/requirements.txt
RUN cd /pinpoint-c-agent && pip install -e .
CMD ["python","-m","unittest","discover","-s","/pinpoint-c-agent/plugins/PY/pinpointPy/"]
# CMD [ "python","-m","unittest","pinpointPy.libs._MysqlConnector.test_case.Test_Case" ]
# CMD [ "sleep","infinity" ]
# python -m unittest discover -s /pinpoint-c-agent/plugins/PY/pinpointPy/
15 changes: 15 additions & 0 deletions testapps/python-plugins/py3.11-plugins.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:latest

COPY setup.py /pinpoint-c-agent/setup.py
COPY common/ /pinpoint-c-agent/common
COPY README /pinpoint-c-agent/README
COPY plugins/PY /pinpoint-c-agent/plugins/PY
COPY src/PY /pinpoint-c-agent/src/PY


RUN pip install -r /pinpoint-c-agent/plugins/PY/requirements.txt
RUN cd /pinpoint-c-agent && pip install -e .
CMD ["python","-m","unittest","discover","-s","/pinpoint-c-agent/plugins/PY/pinpointPy/"]
# CMD [ "python","-m","unittest","pinpointPy.libs._MysqlConnector.test_case.Test_Case" ]
# CMD [ "sleep","infinity" ]
# python -m unittest discover -s /pinpoint-c-agent/plugins/PY/pinpointPy/
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8
FROM python:3.9

COPY setup.py /pinpoint-c-agent/setup.py
COPY common/ /pinpoint-c-agent/common
Expand All @@ -11,5 +11,5 @@ RUN pip install -r /pinpoint-c-agent/plugins/PY/requirements.txt
RUN cd /pinpoint-c-agent && pip install -e .
CMD ["python","-m","unittest","discover","-s","/pinpoint-c-agent/plugins/PY/pinpointPy/"]
# CMD [ "python","-m","unittest","pinpointPy.libs._MysqlConnector.test_case.Test_Case" ]
# CMD [ "bash" ]
# CMD [ "sleep","infinity" ]
# python -m unittest discover -s /pinpoint-c-agent/plugins/PY/pinpointPy/

0 comments on commit c770778

Please sign in to comment.