Skip to content

Commit 5b9a2ed

Browse files
authored
Add support for 3.11 and 3.12 (#315)
* Add support for 3.11 and 3.12 * Updates for new dep versions * Conditional lint * pylint * lint updates * lint * docker-compose -> docker compose * Use proto script * add protobuf * Remove proto build step * lint fix for proto * docker compose * tox * mysql version
1 parent 61007fa commit 5b9a2ed

File tree

29 files changed

+381
-963
lines changed

29 files changed

+381
-963
lines changed

.github/workflows/merge.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
strategy:
2323
matrix:
24-
python-version: ["3.7", "3.8.9", "3.9", "3.10"]
24+
python-version: ["3.8.9", "3.9", "3.10", "3.11", "3.12"]
2525

2626
steps:
2727
- name: Run apt-get update
@@ -31,11 +31,11 @@ jobs:
3131
run: sudo apt-get install make
3232

3333
- name: Set up Python ${{ matrix.python-version }}
34-
uses: actions/setup-python@v3
34+
uses: actions/setup-python@v5
3535
with:
3636
python-version: ${{ matrix.python-version }}
3737

38-
- uses: actions/checkout@v3
38+
- uses: actions/checkout@v4
3939

4040
- name: Install dependencies
4141
run: |
@@ -44,15 +44,10 @@ jobs:
4444
pip install -r requirements.txt -r dev-requirements.txt
4545
4646
- name: Lint files
47-
run: make lint
48-
49-
- name: Install protobuf compiler
47+
if: startsWith(matrix.python-version, '3.9') || startsWith(matrix.python-version, '3.10') || startsWith(matrix.python-version, '3.11') || startsWith(matrix.python-version, '3.12')
5048
run: |
51-
sudo apt-get install -y protobuf-compiler
52-
protoc --version
53-
pip uninstall --yes protobuf python3-protobuf
54-
pip install --upgrade --no-input pip
55-
pip install --upgrade --no-input protobuf==3.19.6
49+
pip install pylint==3.3.1
50+
make lint
5651
5752
- name: Run unit tests
5853
run: |

.github/workflows/release.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ jobs:
88
runs-on: ubuntu-20.04
99
steps:
1010
- name: Checkout code
11-
uses: actions/checkout@v3
11+
uses: actions/checkout@v4
1212
with:
1313
submodules: recursive
1414

1515
- name: Set up Python 3.9
16-
uses: actions/setup-python@v3
16+
uses: actions/setup-python@v4
1717
with:
1818
python-version: 3.9
1919

@@ -23,14 +23,6 @@ jobs:
2323
pip install build
2424
pip install -r requirements.txt
2525
26-
- name: Install protobuf compiler
27-
run: |
28-
sudo apt-get install -y protobuf-compiler
29-
protoc --version
30-
pip uninstall --yes protobuf python3-protobuf
31-
pip install --no-input --upgrade pip
32-
pip install --no-input --upgrade protobuf==3.19.6
33-
3426
- name: Build package
3527
run: make build
3628

.pylintrc

Lines changed: 3 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -60,85 +60,15 @@ confidence=
6060
# --enable=similarities". If you want to run only the classes checker, but have
6161
# no Warning level messages displayed, use "--disable=all --enable=classes
6262
# --disable=W".
63-
disable=print-statement,
64-
parameter-unpacking,
65-
unpacking-in-except,
66-
old-raise-syntax,
67-
backtick,
68-
long-suffix,
69-
old-ne-operator,
70-
old-octal-literal,
71-
import-star-module-level,
72-
non-ascii-bytes-literal,
73-
raw-checker-failed,
63+
disable=raw-checker-failed,
7464
bad-inline-option,
7565
locally-disabled,
7666
file-ignored,
7767
suppressed-message,
7868
useless-suppression,
7969
deprecated-pragma,
8070
use-symbolic-message-instead,
81-
apply-builtin,
82-
basestring-builtin,
83-
buffer-builtin,
84-
cmp-builtin,
85-
coerce-builtin,
86-
execfile-builtin,
87-
file-builtin,
88-
long-builtin,
89-
raw_input-builtin,
90-
reduce-builtin,
91-
standarderror-builtin,
92-
unicode-builtin,
93-
xrange-builtin,
94-
coerce-method,
95-
delslice-method,
96-
getslice-method,
97-
setslice-method,
98-
no-absolute-import,
99-
old-division,
100-
dict-iter-method,
101-
dict-view-method,
102-
next-method-called,
103-
metaclass-assignment,
104-
indexing-exception,
105-
raising-string,
106-
reload-builtin,
107-
oct-method,
108-
hex-method,
109-
nonzero-method,
110-
cmp-method,
111-
input-builtin,
112-
round-builtin,
113-
intern-builtin,
114-
unichr-builtin,
115-
map-builtin-not-iterating,
116-
zip-builtin-not-iterating,
117-
range-builtin-not-iterating,
118-
filter-builtin-not-iterating,
119-
using-cmp-argument,
120-
eq-without-hash,
121-
div-method,
122-
idiv-method,
123-
rdiv-method,
124-
exception-message-attribute,
125-
invalid-str-codec,
126-
sys-max-int,
127-
bad-python3-import,
128-
deprecated-string-function,
129-
deprecated-str-translate-call,
130-
deprecated-itertools-function,
131-
deprecated-types-field,
132-
next-method-defined,
133-
dict-items-not-iterating,
134-
dict-keys-not-iterating,
135-
dict-values-not-iterating,
136-
deprecated-operator-function,
137-
deprecated-urllib-function,
138-
xreadlines-attribute,
139-
deprecated-sys-function,
140-
exception-escape,
141-
comprehension-escape
71+
E1101
14272

14373
# Enable the message, report, category or checker with the given id(s). You can
14474
# either give multiple identifier separated by comma (,) or put this option
@@ -458,13 +388,6 @@ max-line-length=120
458388
# Maximum number of lines in a module.
459389
max-module-lines=1000
460390

461-
# List of optional constructs for which whitespace checking is disabled. `dict-
462-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
463-
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
464-
# `empty-line` allows space-only lines.
465-
no-space-check=trailing-comma,
466-
dict-separator
467-
468391
# Allow the body of a class to be on the same line as the declaration if body
469392
# contains single statement.
470393
single-line-class-stmt=no
@@ -583,4 +506,4 @@ preferred-modules=
583506
# Exceptions that will emit a warning when being caught. Defaults to
584507
# "BaseException, Exception".
585508
overgeneral-exceptions=BaseException,
586-
Exception
509+
builtins.Exception

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ LOG_LEVEL ?= INFO
88

99
.PHONY: unit-test
1010
unit-test:
11-
cd tests/externalServices && docker-compose up -d && cd ../../
11+
cd tests/externalServices && docker compose up -d && cd ../../
1212
python3 setup.py develop
1313
python3 -m pytest tests/hypertrace --cov-report=xml --cov=hypertrace
14-
cd tests/externalServices && docker-compose down
14+
cd tests/externalServices && docker compose down
1515

1616
.PHONY: integration-test
1717
integration-test:

dev-requirements.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,22 @@ google>=3.0.0
44
pyyaml
55
pytest==7.4.3
66
pytest-cov==3.0.0
7-
protobuf<=3.19.4
87
tox>=3.23.0
9-
pylint==2.8.2
108
pdoc3>=0.9.2
119
fastapi>=0.75.0
1210
flask>=1.0.1
1311
Django==3.2.7
1412
pytest-django==4.4.0
1513
psycopg2>=2.9.1
1614
mysql-connector-python==8.0.26
17-
setuptools==49.2.1
15+
setuptools==75.2.0
1816
boto==2.49.0
19-
boto3==1.20.51
17+
boto3==1.35.43
2018
moto==3.0.3
2119
docker
2220
psycopg2
2321
psycopg2-binary
22+
psycopg[binary,pool]
2423
pytest-postgresql
2524
pytest-asyncio
2625
httpx

proto.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# /bin/sh
2-
PROTO_VERSION=3.13.0
2+
PROTO_VERSION=3.20.2
33
OS=$1 #osx for local
44

55
rm -rf ./protoc

requirements.txt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
opentelemetry-api==1.20.0
2-
opentelemetry-exporter-otlp==1.20.0
3-
opentelemetry-exporter-zipkin==1.20.0
4-
opentelemetry-instrumentation==0.41b0
5-
opentelemetry-instrumentation-aiohttp-client==0.41b0
6-
opentelemetry-instrumentation-boto==0.41b0
7-
opentelemetry-instrumentation-botocore==0.41b0
8-
opentelemetry-instrumentation-wsgi==0.41b0
9-
opentelemetry-instrumentation-fastapi==0.41b0
10-
opentelemetry-instrumentation-flask==0.41b0
11-
opentelemetry-instrumentation-mysql==0.41b0
12-
opentelemetry-instrumentation-psycopg2==0.41b0
13-
opentelemetry-instrumentation-requests==0.41b0
14-
opentelemetry-instrumentation-grpc==0.41b0
15-
opentelemetry-instrumentation-django==0.41b0
16-
opentelemetry-instrumentation-aws-lambda==0.41b0
17-
opentelemetry-propagator-b3==1.20.0
18-
opentelemetry-sdk==1.20.0
19-
opentelemetry-util-http==0.41b0
1+
opentelemetry-api==1.26.0
2+
opentelemetry-exporter-otlp==1.26.0
3+
opentelemetry-instrumentation==0.47b0
4+
opentelemetry-instrumentation-aiohttp-client==0.47b0
5+
opentelemetry-instrumentation-boto==0.47b0
6+
opentelemetry-instrumentation-botocore==0.47b0
7+
opentelemetry-instrumentation-wsgi==0.47b0
8+
opentelemetry-instrumentation-fastapi==0.47b0
9+
opentelemetry-instrumentation-flask==0.47b0
10+
opentelemetry-instrumentation-mysql==0.47b0
11+
opentelemetry-instrumentation-psycopg2==0.47b0
12+
opentelemetry-instrumentation-requests==0.47b0
13+
opentelemetry-instrumentation-grpc==0.47b0
14+
opentelemetry-instrumentation-django==0.47b0
15+
opentelemetry-instrumentation-aws-lambda==0.47b0
16+
opentelemetry-propagator-b3==1.26.0
17+
opentelemetry-proto==1.26.0
18+
opentelemetry-sdk==1.26.0
19+
opentelemetry-util-http==0.47b0
2020
google>=3.0.0
2121
pyyaml
22-
protobuf<=3.19.6
23-
deprecated==1.2.12
22+
protobuf<5
23+
deprecated==1.2.14

setup.py

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,28 @@
3434
packages=find_packages(where="src"),
3535
python_requires=">=3.6",
3636
install_requires=[
37-
"opentelemetry-api==1.20.0",
38-
"opentelemetry-exporter-otlp==1.20.0",
39-
"opentelemetry-exporter-zipkin==1.20.0",
40-
"opentelemetry-instrumentation==0.41b0",
41-
"opentelemetry-instrumentation-aiohttp-client==0.41b0",
42-
"opentelemetry-instrumentation-boto==0.41b0",
43-
"opentelemetry-instrumentation-botocore==0.41b0",
44-
"opentelemetry-instrumentation-wsgi==0.41b0",
45-
"opentelemetry-instrumentation-fastapi==0.41b0",
46-
"opentelemetry-instrumentation-flask==0.41b0",
47-
"opentelemetry-instrumentation-mysql==0.41b0",
48-
"opentelemetry-instrumentation-psycopg2==0.41b0",
49-
"opentelemetry-instrumentation-requests==0.41b0",
50-
"opentelemetry-instrumentation-grpc==0.41b0",
51-
"opentelemetry-instrumentation-django==0.41b0",
52-
"opentelemetry-instrumentation-aws-lambda==0.41b0",
53-
"opentelemetry-propagator-b3==1.20.0",
54-
"opentelemetry-sdk==1.20.0",
55-
"opentelemetry-util-http==0.41b0",
56-
"deprecated==1.2.12",
57-
"google>=3.0.0",
37+
"opentelemetry-api==1.26.0",
38+
"opentelemetry-proto==1.26.0",
39+
"opentelemetry-exporter-otlp==1.26.0",
40+
"opentelemetry-instrumentation==0.47b0",
41+
"opentelemetry-instrumentation-aiohttp-client==0.47b0",
42+
"opentelemetry-instrumentation-boto==0.47b0",
43+
"opentelemetry-instrumentation-botocore==0.47b0",
44+
"opentelemetry-instrumentation-wsgi==0.47b0",
45+
"opentelemetry-instrumentation-fastapi==0.47b0",
46+
"opentelemetry-instrumentation-flask==0.47b0",
47+
"opentelemetry-instrumentation-mysql==0.47b0",
48+
"opentelemetry-instrumentation-psycopg2==0.47b0",
49+
"opentelemetry-instrumentation-requests==0.47b0",
50+
"opentelemetry-instrumentation-grpc==0.47b0",
51+
"opentelemetry-instrumentation-django==0.47b0",
52+
"opentelemetry-instrumentation-aws-lambda==0.47b0",
53+
"opentelemetry-propagator-b3==1.26.0",
54+
"opentelemetry-sdk==1.26.0",
55+
"opentelemetry-util-http==0.47b0",
56+
"deprecated==1.2.14",
5857
"pyyaml",
59-
"protobuf<=3.19.6"
58+
"protobuf<5"
6059
],
6160
entry_points = {
6261
'console_scripts': [

src/hypertrace/agent/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import threading
55
import traceback
66
from contextlib import contextmanager
7+
from types import MethodType
78

89
from deprecated import deprecated
910
import opentelemetry.trace as ot
@@ -21,7 +22,6 @@
2122

2223
logger = custom_logger.get_custom_logger(__name__)
2324

24-
2525
class Agent:
2626
'''Top-level entry point for Hypertrace agent.'''
2727
_instance = None
@@ -141,7 +141,7 @@ def register_processor(self, processor) -> None: # pylint: disable=R1710
141141
return None
142142
return self._init.register_processor(processor)
143143

144-
def is_enabled(self) -> bool: # pylint: disable=R0201
144+
def is_enabled(self) -> bool:
145145
'''Is agent enabled?'''
146146
enabled = get_env_value('ENABLED')
147147
if enabled:
@@ -150,7 +150,7 @@ def is_enabled(self) -> bool: # pylint: disable=R0201
150150
return False
151151
return True
152152

153-
def is_initialized(self) -> bool: # pylint: disable=R0201
153+
def is_initialized(self) -> bool:
154154
'''Is agent initialized - if an agent fails to init we should let the app continue'''
155155
if not self.is_enabled():
156156
return False

src/hypertrace/agent/config/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import logging
66
from google.protobuf import json_format as jf
77
from google.protobuf.wrappers_pb2 import BoolValue # pylint:disable=E0611
8-
from hypertrace.agent.config import config_pb2
8+
from hypertrace.agent.config import config_pb2 # pylint:disable=W0406
99
from hypertrace.agent.config.default import *
1010
from hypertrace.env_var_settings import get_env_value
1111
from .file import load_config_from_file

0 commit comments

Comments
 (0)