Skip to content

Commit

Permalink
Add support for 3.11 and 3.12 (#315)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
prodion23 authored Oct 23, 2024
1 parent 61007fa commit 5b9a2ed
Show file tree
Hide file tree
Showing 29 changed files with 381 additions and 963 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

strategy:
matrix:
python-version: ["3.7", "3.8.9", "3.9", "3.10"]
python-version: ["3.8.9", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Run apt-get update
Expand All @@ -31,11 +31,11 @@ jobs:
run: sudo apt-get install make

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install dependencies
run: |
Expand All @@ -44,15 +44,10 @@ jobs:
pip install -r requirements.txt -r dev-requirements.txt
- name: Lint files
run: make lint

- name: Install protobuf compiler
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')
run: |
sudo apt-get install -y protobuf-compiler
protoc --version
pip uninstall --yes protobuf python3-protobuf
pip install --upgrade --no-input pip
pip install --upgrade --no-input protobuf==3.19.6
pip install pylint==3.3.1
make lint
- name: Run unit tests
run: |
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Python 3.9
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.9

Expand All @@ -23,14 +23,6 @@ jobs:
pip install build
pip install -r requirements.txt
- name: Install protobuf compiler
run: |
sudo apt-get install -y protobuf-compiler
protoc --version
pip uninstall --yes protobuf python3-protobuf
pip install --no-input --upgrade pip
pip install --no-input --upgrade protobuf==3.19.6
- name: Build package
run: make build

Expand Down
83 changes: 3 additions & 80 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,85 +60,15 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
raw-checker-failed,
disable=raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating,
deprecated-operator-function,
deprecated-urllib-function,
xreadlines-attribute,
deprecated-sys-function,
exception-escape,
comprehension-escape
E1101

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

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator

# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
Expand Down Expand Up @@ -583,4 +506,4 @@ preferred-modules=
# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
builtins.Exception
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ LOG_LEVEL ?= INFO

.PHONY: unit-test
unit-test:
cd tests/externalServices && docker-compose up -d && cd ../../
cd tests/externalServices && docker compose up -d && cd ../../
python3 setup.py develop
python3 -m pytest tests/hypertrace --cov-report=xml --cov=hypertrace
cd tests/externalServices && docker-compose down
cd tests/externalServices && docker compose down

.PHONY: integration-test
integration-test:
Expand Down
7 changes: 3 additions & 4 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@ google>=3.0.0
pyyaml
pytest==7.4.3
pytest-cov==3.0.0
protobuf<=3.19.4
tox>=3.23.0
pylint==2.8.2
pdoc3>=0.9.2
fastapi>=0.75.0
flask>=1.0.1
Django==3.2.7
pytest-django==4.4.0
psycopg2>=2.9.1
mysql-connector-python==8.0.26
setuptools==49.2.1
setuptools==75.2.0
boto==2.49.0
boto3==1.20.51
boto3==1.35.43
moto==3.0.3
docker
psycopg2
psycopg2-binary
psycopg[binary,pool]
pytest-postgresql
pytest-asyncio
httpx
2 changes: 1 addition & 1 deletion proto.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# /bin/sh
PROTO_VERSION=3.13.0
PROTO_VERSION=3.20.2
OS=$1 #osx for local

rm -rf ./protoc
Expand Down
42 changes: 21 additions & 21 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
opentelemetry-api==1.20.0
opentelemetry-exporter-otlp==1.20.0
opentelemetry-exporter-zipkin==1.20.0
opentelemetry-instrumentation==0.41b0
opentelemetry-instrumentation-aiohttp-client==0.41b0
opentelemetry-instrumentation-boto==0.41b0
opentelemetry-instrumentation-botocore==0.41b0
opentelemetry-instrumentation-wsgi==0.41b0
opentelemetry-instrumentation-fastapi==0.41b0
opentelemetry-instrumentation-flask==0.41b0
opentelemetry-instrumentation-mysql==0.41b0
opentelemetry-instrumentation-psycopg2==0.41b0
opentelemetry-instrumentation-requests==0.41b0
opentelemetry-instrumentation-grpc==0.41b0
opentelemetry-instrumentation-django==0.41b0
opentelemetry-instrumentation-aws-lambda==0.41b0
opentelemetry-propagator-b3==1.20.0
opentelemetry-sdk==1.20.0
opentelemetry-util-http==0.41b0
opentelemetry-api==1.26.0
opentelemetry-exporter-otlp==1.26.0
opentelemetry-instrumentation==0.47b0
opentelemetry-instrumentation-aiohttp-client==0.47b0
opentelemetry-instrumentation-boto==0.47b0
opentelemetry-instrumentation-botocore==0.47b0
opentelemetry-instrumentation-wsgi==0.47b0
opentelemetry-instrumentation-fastapi==0.47b0
opentelemetry-instrumentation-flask==0.47b0
opentelemetry-instrumentation-mysql==0.47b0
opentelemetry-instrumentation-psycopg2==0.47b0
opentelemetry-instrumentation-requests==0.47b0
opentelemetry-instrumentation-grpc==0.47b0
opentelemetry-instrumentation-django==0.47b0
opentelemetry-instrumentation-aws-lambda==0.47b0
opentelemetry-propagator-b3==1.26.0
opentelemetry-proto==1.26.0
opentelemetry-sdk==1.26.0
opentelemetry-util-http==0.47b0
google>=3.0.0
pyyaml
protobuf<=3.19.6
deprecated==1.2.12
protobuf<5
deprecated==1.2.14
43 changes: 21 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,28 @@
packages=find_packages(where="src"),
python_requires=">=3.6",
install_requires=[
"opentelemetry-api==1.20.0",
"opentelemetry-exporter-otlp==1.20.0",
"opentelemetry-exporter-zipkin==1.20.0",
"opentelemetry-instrumentation==0.41b0",
"opentelemetry-instrumentation-aiohttp-client==0.41b0",
"opentelemetry-instrumentation-boto==0.41b0",
"opentelemetry-instrumentation-botocore==0.41b0",
"opentelemetry-instrumentation-wsgi==0.41b0",
"opentelemetry-instrumentation-fastapi==0.41b0",
"opentelemetry-instrumentation-flask==0.41b0",
"opentelemetry-instrumentation-mysql==0.41b0",
"opentelemetry-instrumentation-psycopg2==0.41b0",
"opentelemetry-instrumentation-requests==0.41b0",
"opentelemetry-instrumentation-grpc==0.41b0",
"opentelemetry-instrumentation-django==0.41b0",
"opentelemetry-instrumentation-aws-lambda==0.41b0",
"opentelemetry-propagator-b3==1.20.0",
"opentelemetry-sdk==1.20.0",
"opentelemetry-util-http==0.41b0",
"deprecated==1.2.12",
"google>=3.0.0",
"opentelemetry-api==1.26.0",
"opentelemetry-proto==1.26.0",
"opentelemetry-exporter-otlp==1.26.0",
"opentelemetry-instrumentation==0.47b0",
"opentelemetry-instrumentation-aiohttp-client==0.47b0",
"opentelemetry-instrumentation-boto==0.47b0",
"opentelemetry-instrumentation-botocore==0.47b0",
"opentelemetry-instrumentation-wsgi==0.47b0",
"opentelemetry-instrumentation-fastapi==0.47b0",
"opentelemetry-instrumentation-flask==0.47b0",
"opentelemetry-instrumentation-mysql==0.47b0",
"opentelemetry-instrumentation-psycopg2==0.47b0",
"opentelemetry-instrumentation-requests==0.47b0",
"opentelemetry-instrumentation-grpc==0.47b0",
"opentelemetry-instrumentation-django==0.47b0",
"opentelemetry-instrumentation-aws-lambda==0.47b0",
"opentelemetry-propagator-b3==1.26.0",
"opentelemetry-sdk==1.26.0",
"opentelemetry-util-http==0.47b0",
"deprecated==1.2.14",
"pyyaml",
"protobuf<=3.19.6"
"protobuf<5"
],
entry_points = {
'console_scripts': [
Expand Down
6 changes: 3 additions & 3 deletions src/hypertrace/agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import threading
import traceback
from contextlib import contextmanager
from types import MethodType

from deprecated import deprecated
import opentelemetry.trace as ot
Expand All @@ -21,7 +22,6 @@

logger = custom_logger.get_custom_logger(__name__)


class Agent:
'''Top-level entry point for Hypertrace agent.'''
_instance = None
Expand Down Expand Up @@ -141,7 +141,7 @@ def register_processor(self, processor) -> None: # pylint: disable=R1710
return None
return self._init.register_processor(processor)

def is_enabled(self) -> bool: # pylint: disable=R0201
def is_enabled(self) -> bool:
'''Is agent enabled?'''
enabled = get_env_value('ENABLED')
if enabled:
Expand All @@ -150,7 +150,7 @@ def is_enabled(self) -> bool: # pylint: disable=R0201
return False
return True

def is_initialized(self) -> bool: # pylint: disable=R0201
def is_initialized(self) -> bool:
'''Is agent initialized - if an agent fails to init we should let the app continue'''
if not self.is_enabled():
return False
Expand Down
2 changes: 1 addition & 1 deletion src/hypertrace/agent/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import logging
from google.protobuf import json_format as jf
from google.protobuf.wrappers_pb2 import BoolValue # pylint:disable=E0611
from hypertrace.agent.config import config_pb2
from hypertrace.agent.config import config_pb2 # pylint:disable=W0406
from hypertrace.agent.config.default import *
from hypertrace.env_var_settings import get_env_value
from .file import load_config_from_file
Expand Down
Loading

0 comments on commit 5b9a2ed

Please sign in to comment.