diff --git a/opensearchpy/helpers/__init__.py b/opensearchpy/helpers/__init__.py index 2aff0e3e..94771696 100644 --- a/opensearchpy/helpers/__init__.py +++ b/opensearchpy/helpers/__init__.py @@ -57,11 +57,8 @@ __all__ = [ ] -try: - # Asyncio only supported on Python 3.6+ - if sys.version_info < (3, 6): - raise ImportError - +# Asyncio only supported on Python 3.6+ +if sys.version_info >= (3, 6): from .._async.helpers import ( async_bulk, async_reindex, @@ -70,5 +67,3 @@ try: ) __all__ += ["async_scan", "async_bulk", "async_reindex", "async_streaming_bulk"] -except (ImportError, SyntaxError): - pass diff --git a/utils/build-dists.py b/utils/build-dists.py index 096505b4..e6706c57 100644 --- a/utils/build-dists.py +++ b/utils/build-dists.py @@ -105,11 +105,12 @@ def test_dist(dist): f"from {dist_name} import AsyncOpenSearch", expect_exit_code=256, ) + + # Ensure async helpers are available regardless of aiohttp installation run( venv_python, "-c", f"from {dist_name}.helpers import async_scan, async_bulk, async_streaming_bulk, async_reindex", - expect_exit_code=256, ) # Install aiohttp and see that async is now available