diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index f3b02a839..c196b1fb6 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -12,7 +12,7 @@ env: FORCE_COLOR: '1' # Make tools pretty. PIP_DISABLE_PIP_VERSION_CHECK: '1' PIP_NO_PYTHON_VERSION_WARNING: '1' - PYTHON_LATEST: '3.13' + PYTHON_LATEST: '3.12' jobs: lint: name: Check linting @@ -45,10 +45,6 @@ jobs: python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] use-cython: ['true', 'false'] experimental: [false] - include: - - python-version: 'pypy3.9' - use-cython: false - experimental: true env: USE_CYTHON: ${{ matrix.use-cython }} continue-on-error: ${{ matrix.experimental }} @@ -71,6 +67,36 @@ jobs: uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} + test-pypy: + name: 'Python pypy3.9/Cython: false' + runs-on: ubuntu-latest + timeout-minutes: 10 + continue-on-error: true + env: + USE_CYTHON: 'false' + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-python@v5 + with: + python-version: pypy3.9 + cache: pip + cache-dependency-path: requirements/test.txt + - name: Install dependencies + id: install + continue-on-error: true + run: | + pip install -r requirements/test.txt + pip install . + - name: Run tests + if: steps.install.outcome == 'success' + run: scripts/tests + - name: Enforce coverage + if: steps.install.outcome == 'success' + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} check: # This job does nothing and is only used for the branch protection name: ✅ Ensure the required checks passing if: always() diff --git a/faust/__init__.py b/faust/__init__.py index c20b05903..f3ef14c75 100644 --- a/faust/__init__.py +++ b/faust/__init__.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- """Python Stream processing.""" + # :copyright: (c) 2017-2020, Robinhood Markets, Inc. # All rights reserved. # :license: BSD (3 Clause), see LICENSE for more details. diff --git a/faust/stores/aerospike.py b/faust/stores/aerospike.py index 291ccbe9f..198f78dc7 100644 --- a/faust/stores/aerospike.py +++ b/faust/stores/aerospike.py @@ -98,7 +98,7 @@ def _get(self, key: bytes) -> Optional[bytes]: key = (self.namespace, self.table_name, key) fun = self.client.get try: - (key, meta, bins) = self.aerospike_fun_call_with_retry(fun=fun, key=key) + key, meta, bins = self.aerospike_fun_call_with_retry(fun=fun, key=key) if bins: return bins[self.BIN_KEY] return None @@ -173,7 +173,7 @@ def _itervalues(self) -> Iterator[bytes]: fun=fun, namespace=self.namespace, set=self.table_name ) for result in scan.results(): - (key, meta, bins) = result + key, meta, bins = result if bins: yield bins[self.BIN_KEY] else: @@ -193,8 +193,8 @@ def _iteritems(self) -> Iterator[Tuple[bytes, bytes]]: fun=fun, namespace=self.namespace, set=self.table_name ) for result in scan.results(): - (key_data, meta, bins) = result - (ns, set, policy, key) = key_data + key_data, meta, bins = result + ns, set, policy, key = key_data if bins: bins = bins[self.BIN_KEY] @@ -214,7 +214,7 @@ def _contains(self, key: bytes) -> bool: try: if self.app.conf.store_check_exists: key = (self.namespace, self.table_name, key) - (key, meta) = self.aerospike_fun_call_with_retry( + key, meta = self.aerospike_fun_call_with_retry( fun=self.client.exists, key=key ) if meta: diff --git a/faust/transport/drivers/aiokafka.py b/faust/transport/drivers/aiokafka.py index 943e9ebc3..1a2a83454 100644 --- a/faust/transport/drivers/aiokafka.py +++ b/faust/transport/drivers/aiokafka.py @@ -27,9 +27,6 @@ import aiokafka import aiokafka.abc import opentracing -from packaging.version import Version - -_AIOKAFKA_HAS_API_VERSION = Version(aiokafka.__version__) < Version("0.13.0") from aiokafka import TopicPartition from aiokafka.consumer.group_coordinator import OffsetCommitRequest from aiokafka.coordinator.assignors.roundrobin import RoundRobinPartitionAssignor @@ -55,6 +52,7 @@ from mode.utils.objects import cached_property from mode.utils.times import Seconds, humanize_seconds_ago, want_seconds from opentracing.ext import tags +from packaging.version import Version from yarl import URL from faust.auth import ( @@ -88,6 +86,8 @@ from faust.types.transports import ConsumerT, PartitionerT, ProducerT from faust.utils.tracing import noop_span, set_current_span, traced_from_parent_span +_AIOKAFKA_HAS_API_VERSION = Version(aiokafka.__version__) < Version("0.13.0") + __all__ = ["Consumer", "Producer", "Transport"] # if not hasattr(aiokafka, '__robinhood__'): # pragma: no cover diff --git a/tests/unit/transport/drivers/test_aiokafka.py b/tests/unit/transport/drivers/test_aiokafka.py index a0252e1a2..fc54fbcfa 100644 --- a/tests/unit/transport/drivers/test_aiokafka.py +++ b/tests/unit/transport/drivers/test_aiokafka.py @@ -17,10 +17,10 @@ import faust from faust import auth from faust.exceptions import ImproperlyConfigured, NotReady -from faust.transport.drivers.aiokafka import _AIOKAFKA_HAS_API_VERSION from faust.sensors.monitor import Monitor from faust.transport.drivers import aiokafka as mod from faust.transport.drivers.aiokafka import ( + _AIOKAFKA_HAS_API_VERSION, SLOW_PROCESSING_CAUSE_AGENT, SLOW_PROCESSING_CAUSE_STREAM, SLOW_PROCESSING_EXPLAINED,