From 33f49417b415deb7ea3c495a404b78c9d3743c03 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Sat, 15 Jun 2024 18:30:28 +0200 Subject: [PATCH 1/5] remove six dependency --- ci/environment-py38.yml | 1 - ci/environment-py39.yml | 1 - requirements.txt | 3 +-- streamz/core.py | 9 ++++----- streamz/utils_test.py | 4 ++-- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/ci/environment-py38.yml b/ci/environment-py38.yml index 990e4347..22a2171d 100644 --- a/ci/environment-py38.yml +++ b/ci/environment-py38.yml @@ -11,7 +11,6 @@ dependencies: - tornado - toolz - zict - - six - librdkafka=1.5.3 - dask - distributed diff --git a/ci/environment-py39.yml b/ci/environment-py39.yml index 8d4bfc47..6bbbf3b6 100644 --- a/ci/environment-py39.yml +++ b/ci/environment-py39.yml @@ -11,7 +11,6 @@ dependencies: - tornado - toolz - zict - - six - librdkafka=1.5.3 - dask - distributed diff --git a/requirements.txt b/requirements.txt index 485632c5..ed49d32a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ tornado toolz zict -six -setuptools \ No newline at end of file +setuptools diff --git a/streamz/core.py b/streamz/core.py index 140644e7..02d77dfc 100644 --- a/streamz/core.py +++ b/streamz/core.py @@ -4,8 +4,6 @@ from itertools import chain import functools import logging -import six -import sys import threading from time import time from typing import Any, Callable, Hashable, Union @@ -1947,8 +1945,8 @@ def f(): if timeout is not None: future = gen.with_timeout(timedelta(seconds=timeout), future) result[0] = yield future - except Exception: - error[0] = sys.exc_info() + except Exception as exc: + error[0] = exc finally: thread_state.asynchronous = False e.set() @@ -1960,7 +1958,8 @@ def f(): else: while not e.is_set(): e.wait(10) + if error[0]: - six.reraise(*error[0]) + raise error[0] else: return result[0] diff --git a/streamz/utils_test.py b/streamz/utils_test.py index 3742574b..9dbc1749 100644 --- a/streamz/utils_test.py +++ b/streamz/utils_test.py @@ -1,8 +1,8 @@ import asyncio from contextlib import contextmanager +import io import logging import os -import six import shutil import tempfile from time import time, sleep @@ -85,7 +85,7 @@ def captured_logger(logger, level=logging.INFO, propagate=None): if propagate is not None: orig_propagate = logger.propagate logger.propagate = propagate - sio = six.StringIO() + sio = io.StringIO() logger.handlers[:] = [logging.StreamHandler(sio)] logger.setLevel(level) try: From 6551475ad0b2dbc9f5a98bc444553aaf2450547e Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Mon, 17 Jun 2024 16:12:52 +0200 Subject: [PATCH 2/5] support py3.9 -> 3.12, refresh CI --- .github/workflows/main.yaml | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index aec5f6ba..9126b58a 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - CONDA_ENV: [py38, py39, py310] + CONDA_ENV: [py39, py310, py311, py312] # env: # STREAMZ_LAUNCH_KAFKA: true @@ -45,7 +45,7 @@ jobs: - name: coveralls shell: bash -l {0} - if: ${{ matrix.os == 'ubuntu-latest' && matrix.CONDA_ENV == 'py38' }} + if: ${{ matrix.os == 'ubuntu-latest' && matrix.CONDA_ENV == 'py312' }} run: coveralls lint: diff --git a/setup.py b/setup.py index 7b1823a5..ebbede61 100755 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ license='BSD', keywords='streams', packages=packages + tests, - python_requires='>=3.8', + python_requires='>=3.9', long_description=(open('README.rst').read() if exists('README.rst') else ''), install_requires=list(open('requirements.txt').read().strip().split('\n')), From bd4dab1af1b83d35d8ec8ac958381239d0c2b071 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Mon, 17 Jun 2024 17:10:14 +0200 Subject: [PATCH 3/5] remove py3.8 environment --- ci/environment-py38.yml | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 ci/environment-py38.yml diff --git a/ci/environment-py38.yml b/ci/environment-py38.yml deleted file mode 100644 index 22a2171d..00000000 --- a/ci/environment-py38.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: test_env -channels: - - conda-forge - - defaults -dependencies: - - python=3.8 - - pytest - - flake8 - - black - - isort - - tornado - - toolz - - zict - - librdkafka=1.5.3 - - dask - - distributed - - pandas - - python-confluent-kafka=1.5.0 - - numpydoc - - sphinx - - sphinx_rtd_theme - - codecov - - coverage - - networkx - - graphviz - - python-graphviz - - pytest-asyncio - - bokeh - - ipython - - ipykernel - - ipywidgets - - flaky - - pytest-cov - - coveralls - - paho-mqtt - - websockets From 2786e08c2514fc30c274944e5bac5178a9d93055 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Mon, 17 Jun 2024 17:10:31 +0200 Subject: [PATCH 4/5] add CI environment for Py 3.11 & 3.12 --- ci/environment-py311.yml | 27 +++++++++++++++++++++++++++ ci/environment-py312.yml | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 ci/environment-py311.yml create mode 100644 ci/environment-py312.yml diff --git a/ci/environment-py311.yml b/ci/environment-py311.yml new file mode 100644 index 00000000..275fb62d --- /dev/null +++ b/ci/environment-py311.yml @@ -0,0 +1,27 @@ +name: test_env +channels: + - conda-forge + - defaults +dependencies: + - python=3.11 + - pytest + - flake8 + - black + - isort + - tornado + - toolz + - librdkafka + - dask + - distributed + - pandas + - python-confluent-kafka + - codecov + - coverage + - networkx + - graphviz + - pytest-asyncio + - python-graphviz + - bokeh + - ipywidgets + - flaky + - pytest-cov diff --git a/ci/environment-py312.yml b/ci/environment-py312.yml new file mode 100644 index 00000000..6de4e3b8 --- /dev/null +++ b/ci/environment-py312.yml @@ -0,0 +1,27 @@ +name: test_env +channels: + - conda-forge + - defaults +dependencies: + - python=3.12 + - pytest + - flake8 + - black + - isort + - tornado + - toolz + - librdkafka + - dask + - distributed + - pandas + - python-confluent-kafka + - codecov + - coverage + - networkx + - graphviz + - pytest-asyncio + - python-graphviz + - bokeh + - ipywidgets + - flaky + - pytest-cov From 38e72c51bc78104da8f2773175a6eff0507460b4 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Tue, 18 Jun 2024 06:54:10 +0200 Subject: [PATCH 5/5] hybridize usage of importlib.metadata for Python3.10+ --- streamz/plugins.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/streamz/plugins.py b/streamz/plugins.py index 2be1a356..e27ffc9d 100644 --- a/streamz/plugins.py +++ b/streamz/plugins.py @@ -13,11 +13,18 @@ def try_register(cls, entry_point, *modifier): ) +def get_entry_point(eps, group): + if hasattr(eps, "select"): # Python 3.10+ / importlib_metadata >= 3.9.0 + return eps.select(group=group) + else: + return eps.get(group, []) + def load_plugins(cls): eps = importlib.metadata.entry_points() - for entry_point in eps.get("streamz.sources", []): + + for entry_point in get_entry_point(eps, "streamz.sources"): try_register(cls, entry_point, staticmethod) - for entry_point in eps.get("streamz.nodes", []): + for entry_point in get_entry_point(eps, "streamz.nodes"): try_register(cls, entry_point) - for entry_point in eps.get("streamz.sinks", []): + for entry_point in get_entry_point(eps, "streamz.sinks"): try_register(cls, entry_point)