diff --git a/.github/workflows/python-package.yaml b/.github/workflows/python-package.yaml index 4d1136371..833e57a86 100644 --- a/.github/workflows/python-package.yaml +++ b/.github/workflows/python-package.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: ["3.8", "3.9", "3.10"] container: image: python:${{ matrix.python-version }} diff --git a/Dockerfile b/Dockerfile index da54f0961..4cc6814c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM ghcr.io/reddit/thrift-compiler:0.14.1 AS thrift +FROM ghcr.io/reddit/thrift-compiler:0.18.1 AS thrift -FROM python:3.9 +FROM python:3.10 COPY --from=thrift /usr/local/bin/thrift /usr/local/bin/thrift @@ -12,6 +12,7 @@ WORKDIR /src ENV CASS_DRIVER_NO_EXTENSIONS theytaketoolongtobuild COPY requirements*.txt ./ + RUN pip install -r requirements.txt RUN touch /baseplate-py-dev-docker-image diff --git a/baseplate/__init__.py b/baseplate/__init__.py index 53d50e8df..e9a8efd2a 100644 --- a/baseplate/__init__.py +++ b/baseplate/__init__.py @@ -160,7 +160,7 @@ def from_upstream( raise ValueError("invalid sampled value") if flags is not None: - if not 0 <= flags < 2 ** 64: + if not 0 <= flags < 2**64: raise ValueError("invalid flags value") return cls(trace_id, parent_id, span_id, sampled, flags) diff --git a/baseplate/lib/prometheus_metrics.py b/baseplate/lib/prometheus_metrics.py index d8ee37422..0161d0df0 100644 --- a/baseplate/lib/prometheus_metrics.py +++ b/baseplate/lib/prometheus_metrics.py @@ -32,7 +32,7 @@ default_size_factor = 2 default_size_count = 20 default_size_buckets = [ - default_size_start * default_size_factor ** i for i in range(default_size_count) + default_size_start * default_size_factor**i for i in range(default_size_count) ] diff --git a/baseplate/thrift/BaseplateService.py b/baseplate/thrift/BaseplateService.py index 18ff20f92..346a50c97 100644 --- a/baseplate/thrift/BaseplateService.py +++ b/baseplate/thrift/BaseplateService.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.14.1) +# Autogenerated by Thrift Compiler (0.18.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/baseplate/thrift/BaseplateServiceV2.py b/baseplate/thrift/BaseplateServiceV2.py index 423e4c0ee..fe3e9ce04 100644 --- a/baseplate/thrift/BaseplateServiceV2.py +++ b/baseplate/thrift/BaseplateServiceV2.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.14.1) +# Autogenerated by Thrift Compiler (0.18.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/baseplate/thrift/constants.py b/baseplate/thrift/constants.py index d359146bf..f34a410a1 100644 --- a/baseplate/thrift/constants.py +++ b/baseplate/thrift/constants.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.14.1) +# Autogenerated by Thrift Compiler (0.18.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/baseplate/thrift/ttypes.py b/baseplate/thrift/ttypes.py index 2ffafee8b..416c4846a 100644 --- a/baseplate/thrift/ttypes.py +++ b/baseplate/thrift/ttypes.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.14.1) +# Autogenerated by Thrift Compiler (0.18.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/requirements-transitive.txt b/requirements-transitive.txt index 73b76a742..4f9def9aa 100644 --- a/requirements-transitive.txt +++ b/requirements-transitive.txt @@ -5,9 +5,10 @@ # supported. advocate==1.0.0 alabaster==0.7.12 -amqp==2.6.1 +amqp==5.1.1 appdirs==1.4.4 aspy.refactor-imports==2.1.1 +astroid==2.12.14 attrs==20.3.0 Babel==2.9.1 beautifulsoup4==4.9.3 @@ -16,15 +17,15 @@ cassandra-driver==3.24.0 certifi==2022.12.7 cffi==1.14.5 chardet==4.0.0 -click==7.1.2 -confluent-kafka==1.6.0 +click==8.0.0 +confluent-kafka==2.1.1 coverage==5.4 cryptography==39.0.1 docutils==0.16 geomet==0.2.1.post1 -gevent==21.1.2 +gevent==22.10.2 graphviz==0.16 -greenlet==1.0.0 +greenlet==2.0.2 hupper==1.10.2 idna==2.10 imagesize==1.2.0 @@ -33,7 +34,7 @@ iniconfig==1.1.1 isort==5.7.0 Jinja2==2.11.3 kazoo==2.8.0 -kombu==4.6.11 +kombu==5.3.0 lazy-object-proxy==1.4.3 MarkupSafe==1.1.1 mccabe==0.7.0 @@ -50,7 +51,7 @@ plaster-pastedeploy==0.7 platformdirs==2.4.0 pluggy==0.13.1 posix-ipc==1.0.5 -py==1.10.0 +py==1.11.0 pyasn1==0.4.8 pycodestyle==2.9.1 pycparser==2.20 @@ -79,17 +80,17 @@ sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.4 SQLAlchemy==1.4.12 -thrift==0.14.1 +thrift==0.16.0 toml==0.10.2 tomli==1.2.2 translationstring==1.4 typing-extensions==3.10.0.2 urllib3==1.26.11 venusian==3.0.0 -vine==1.3.0 +vine==5.0.0 waitress==2.1.2 WebOb==1.8.6 -wrapt==1.12.1 +wrapt==1.14 zope.deprecation==4.4.0 zope.event==4.5.0 zope.interface==5.2.0 diff --git a/requirements.txt b/requirements.txt index f95d60adb..38c3fb7b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,16 +4,16 @@ # See install_requires and extras_require in setup.py for the range of versions # supported. -r requirements-transitive.txt -black==21.10b0 +black==22.10.0 boto3==1.21.20 flake8==5.0.4 lxml==4.9.1 mypy==0.910 prometheus-client==0.16.0 pydocstyle==5.1.1 -pylint==2.15.3 -pytest==6.2.2 -pytest-cov==2.11.1 +pylint==2.15.10 +pytest==7.3.1 +pytest-cov==4.1.0 pytz==2021.1 reorder-python-imports==2.4.0 sphinx==3.4.3 diff --git a/setup.py b/setup.py index 2e87e8c27..29aff0a94 100644 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ "posix_ipc>=1.0.0,<2.0", "python-json-logger>=2.0,<3.0", "requests>=2.21.0,<3.0", - "thrift>=0.14.1,<1.0", + "thrift<1.0", "gevent>=20.5.0", "prometheus-client>=0.12.0", ], @@ -70,9 +70,9 @@ "License :: OSI Approved :: BSD License", "Operating System :: POSIX :: Linux", "Programming Language :: Python", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.11", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Application Frameworks", ], diff --git a/tests/integration/test_thrift/TestService.py b/tests/integration/test_thrift/TestService.py index aba0221e3..4ee93b2c9 100644 --- a/tests/integration/test_thrift/TestService.py +++ b/tests/integration/test_thrift/TestService.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.14.1) +# Autogenerated by Thrift Compiler (0.18.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/tests/integration/test_thrift/constants.py b/tests/integration/test_thrift/constants.py index d359146bf..f34a410a1 100644 --- a/tests/integration/test_thrift/constants.py +++ b/tests/integration/test_thrift/constants.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.14.1) +# Autogenerated by Thrift Compiler (0.18.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/tests/integration/test_thrift/ttypes.py b/tests/integration/test_thrift/ttypes.py index ab8168384..d068f30fc 100644 --- a/tests/integration/test_thrift/ttypes.py +++ b/tests/integration/test_thrift/ttypes.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.14.1) +# Autogenerated by Thrift Compiler (0.18.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/tests/unit/frameworks/queue_consumer/kombu_tests.py b/tests/unit/frameworks/queue_consumer/kombu_tests.py index a68e72e9e..8ab638319 100644 --- a/tests/unit/frameworks/queue_consumer/kombu_tests.py +++ b/tests/unit/frameworks/queue_consumer/kombu_tests.py @@ -125,20 +125,14 @@ def test_handle(self, ttl_delta, handled, context, span, baseplate, name, messag message.ack.assert_not_called() message.reject.assert_called_once() - assert ( - REGISTRY.get_sample_value( - f"{AMQP_PROCESSING_TIME._name}_bucket", - {**prom_labels._asdict(), **{"amqp_success": "true", "le": "+Inf"}}, - ) - == (1 if handled else None) - ) - assert ( - REGISTRY.get_sample_value( - f"{AMQP_PROCESSED_TOTAL._name}_total", - {**prom_labels._asdict(), **{"amqp_success": "true"}}, - ) - == (1 if handled else None) - ) + assert REGISTRY.get_sample_value( + f"{AMQP_PROCESSING_TIME._name}_bucket", + {**prom_labels._asdict(), **{"amqp_success": "true", "le": "+Inf"}}, + ) == (1 if handled else None) + assert REGISTRY.get_sample_value( + f"{AMQP_PROCESSED_TOTAL._name}_total", + {**prom_labels._asdict(), **{"amqp_success": "true"}}, + ) == (1 if handled else None) assert ( REGISTRY.get_sample_value( f"{AMQP_REPUBLISHED_TOTAL._name}_total", @@ -153,13 +147,10 @@ def test_handle(self, ttl_delta, handled, context, span, baseplate, name, messag ) is None ) - assert ( - REGISTRY.get_sample_value( - f"{AMQP_REJECTED_TOTAL._name}_total", - {**prom_labels._asdict(), **{"reason_code": AMQP_REJECTED_REASON_TTL}}, - ) - == (None if handled else 1) - ) + assert REGISTRY.get_sample_value( + f"{AMQP_REJECTED_TOTAL._name}_total", + {**prom_labels._asdict(), **{"reason_code": AMQP_REJECTED_REASON_TTL}}, + ) == (None if handled else 1) assert REGISTRY.get_sample_value( f"{AMQP_ACTIVE_MESSAGES._name}", prom_labels._asdict() ) == (0 if handled else None) @@ -417,13 +408,10 @@ def handler_fn(ctx, body, msg): ) == 0 ) - assert ( - REGISTRY.get_sample_value( - f"{AMQP_REPUBLISHED_TOTAL._name}_total", - {**prom_labels._asdict()}, - ) - == (1 if republished else None) - ) + assert REGISTRY.get_sample_value( + f"{AMQP_REPUBLISHED_TOTAL._name}_total", + {**prom_labels._asdict()}, + ) == (1 if republished else None) retry_reached_expectation = None if attempt: if attempt >= 5 or (limit and attempt >= limit):