diff --git a/CHANGELOG.md b/CHANGELOG.md index e61d40cb0..61106f6af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ Remark: It's recommended to import everything needed directly from `noe4j` if available, not its submodules or subpackages. - Experimental pipelines feature has been removed. -- Experimental async driver has been added. +- Async driver (i.e., support for asyncio) has been added. - `ResultSummary.server.version_info` has been removed. Use `ResultSummary.server.agent`, `ResultSummary.server.protocol_version`, or call the `dbms.components` procedure instead. diff --git a/docs/source/async_api.rst b/docs/source/async_api.rst index 61f2bb2c3..5b7c5ea3e 100644 --- a/docs/source/async_api.rst +++ b/docs/source/async_api.rst @@ -4,14 +4,6 @@ Async API Documentation ####################### -.. warning:: - The whole async API is currently in experimental phase. - - This means everything documented on this page might be removed or change - its API at any time (including in patch releases). - - (See :ref:`filter-warnings-ref`) - .. versionadded:: 5.0 .. warning:: diff --git a/neo4j/_async/driver.py b/neo4j/_async/driver.py index 98647a513..3efe3920f 100644 --- a/neo4j/_async/driver.py +++ b/neo4j/_async/driver.py @@ -110,10 +110,6 @@ def driver( else: @classmethod - @AsyncUtil.experimental_async( - "neo4j async is in experimental phase. It might be removed or " - "changed at any time (including patch releases)." - ) def driver(cls, uri, *, auth=None, **config) -> AsyncDriver: """Create a driver. diff --git a/neo4j/_async_compat/util.py b/neo4j/_async_compat/util.py index f8c116556..aaecf02e3 100644 --- a/neo4j/_async_compat/util.py +++ b/neo4j/_async_compat/util.py @@ -51,8 +51,6 @@ async def callback(cb, *args, **kwargs): return await res return res - experimental_async = experimental - @staticmethod def shielded(coro_function): assert asyncio.iscoroutinefunction(coro_function) @@ -76,12 +74,6 @@ def callback(cb, *args, **kwargs): if callable(cb): return cb(*args, **kwargs) - @staticmethod - def experimental_async(message): - def f_(f): - return f - return f_ - @staticmethod def shielded(coro_function): return coro_function diff --git a/neo4j/_sync/driver.py b/neo4j/_sync/driver.py index 50fbda656..e6096b3d7 100644 --- a/neo4j/_sync/driver.py +++ b/neo4j/_sync/driver.py @@ -110,10 +110,6 @@ def driver( else: @classmethod - @Util.experimental_async( - "neo4j is in experimental phase. It might be removed or " - "changed at any time (including patch releases)." - ) def driver(cls, uri, *, auth=None, **config) -> Driver: """Create a driver. diff --git a/tests/conftest.py b/tests/conftest.py index b8b87b34e..eebfcf0d1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -94,28 +94,25 @@ def neo4j_driver(neo4j_uri, auth): @wraps(AsyncGraphDatabase.driver) -def get_async_driver_no_warning(*args, **kwargs): - # with warnings.catch_warnings(): - # warnings.filterwarnings("ignore", "neo4j async", ExperimentalWarning) - with pytest.warns(ExperimentalWarning, match="neo4j async"): - return AsyncGraphDatabase.driver(*args, **kwargs) +def get_async_driver(*args, **kwargs): + return AsyncGraphDatabase.driver(*args, **kwargs) @pytest_asyncio.fixture async def async_driver(uri, auth): - async with get_async_driver_no_warning(uri, auth=auth) as driver: + async with get_async_driver(uri, auth=auth) as driver: yield driver @pytest_asyncio.fixture async def async_bolt_driver(bolt_uri, auth): - async with get_async_driver_no_warning(bolt_uri, auth=auth) as driver: + async with get_async_driver(bolt_uri, auth=auth) as driver: yield driver @pytest_asyncio.fixture async def async_neo4j_driver(neo4j_uri, auth): - async with get_async_driver_no_warning(neo4j_uri, auth=auth) as driver: + async with get_async_driver(neo4j_uri, auth=auth) as driver: yield driver diff --git a/tests/integration/async_/test_custom_ssl_context.py b/tests/integration/async_/test_custom_ssl_context.py index be89e9509..1954255a1 100644 --- a/tests/integration/async_/test_custom_ssl_context.py +++ b/tests/integration/async_/test_custom_ssl_context.py @@ -21,10 +21,8 @@ import pytest import neo4j -from neo4j._async_compat.util import AsyncUtil from ..._async_compat import mark_async_test -from ...conftest import get_async_driver_no_warning @mark_async_test @@ -42,15 +40,9 @@ def wrap_fail(*_, **__): fake_ssl_context.wrap_socket.side_effect = wrap_fail fake_ssl_context.wrap_bio.side_effect = wrap_fail - if AsyncUtil.is_async_code: - driver = get_async_driver_no_warning( - uri, auth=auth, ssl_context=fake_ssl_context - ) - else: - driver = neo4j.GraphDatabase.driver( - uri, auth=auth, ssl_context=fake_ssl_context - ) - async with driver: + async with neo4j.AsyncGraphDatabase.driver( + uri, auth=auth, ssl_context=fake_ssl_context + ) as driver: async with driver.session() as session: with pytest.raises(NoNeedToGoFurtherException): await session.run("RETURN 1") diff --git a/tests/integration/mixed/test_async_cancellation.py b/tests/integration/mixed/test_async_cancellation.py index abb8ff3f1..b56443d94 100644 --- a/tests/integration/mixed/test_async_cancellation.py +++ b/tests/integration/mixed/test_async_cancellation.py @@ -26,7 +26,7 @@ from neo4j import exceptions as neo4j_exceptions from ..._async_compat import mark_async_test -from ...conftest import get_async_driver_no_warning +from ...conftest import get_async_driver def _get_work(): @@ -118,7 +118,7 @@ async def _do_the_read(session_, i=1): async def test_async_cancellation( uri, auth, mocker, read_func, waits, cancel_count, i ): - async with get_async_driver_no_warning( + async with get_async_driver( uri, auth=auth, connection_acquisition_timeout=10 ) as driver: async with driver.session() as session: @@ -181,7 +181,7 @@ async def test_async_cancellation( @mark_async_test async def test_async_cancellation_does_not_leak(uri, auth): - async with get_async_driver_no_warning( + async with get_async_driver( uri, auth=auth, connection_acquisition_timeout=10, # driver needs to cope with a single connection in the pool! diff --git a/tests/integration/sync/test_custom_ssl_context.py b/tests/integration/sync/test_custom_ssl_context.py index e1ecbf23f..14b0e0647 100644 --- a/tests/integration/sync/test_custom_ssl_context.py +++ b/tests/integration/sync/test_custom_ssl_context.py @@ -21,10 +21,8 @@ import pytest import neo4j -from neo4j._async_compat.util import Util from ..._async_compat import mark_sync_test -from ...conftest import get_async_driver_no_warning @mark_sync_test @@ -42,15 +40,9 @@ def wrap_fail(*_, **__): fake_ssl_context.wrap_socket.side_effect = wrap_fail fake_ssl_context.wrap_bio.side_effect = wrap_fail - if Util.is_async_code: - driver = get_async_driver_no_warning( - uri, auth=auth, ssl_context=fake_ssl_context - ) - else: - driver = neo4j.GraphDatabase.driver( - uri, auth=auth, ssl_context=fake_ssl_context - ) - with driver: + with neo4j.GraphDatabase.driver( + uri, auth=auth, ssl_context=fake_ssl_context + ) as driver: with driver.session() as session: with pytest.raises(NoNeedToGoFurtherException): session.run("RETURN 1") diff --git a/tests/unit/async_/test_driver.py b/tests/unit/async_/test_driver.py index 8003ee1c1..488c61dd3 100644 --- a/tests/unit/async_/test_driver.py +++ b/tests/unit/async_/test_driver.py @@ -44,17 +44,7 @@ @wraps(AsyncGraphDatabase.driver) def create_driver(*args, **kwargs): - if AsyncUtil.is_async_code: - with pytest.warns(ExperimentalWarning, match="async") as warnings: - driver = AsyncGraphDatabase.driver(*args, **kwargs) - print(warnings) - return driver - else: - return AsyncGraphDatabase.driver(*args, **kwargs) - - -def driver(*args, **kwargs): - return AsyncNeo4jDriver(*args, **kwargs) + return AsyncGraphDatabase.driver(*args, **kwargs) @pytest.mark.parametrize("protocol", ("bolt://", "bolt+s://", "bolt+ssc://")) diff --git a/tests/unit/sync/test_driver.py b/tests/unit/sync/test_driver.py index 81297c174..07a85a841 100644 --- a/tests/unit/sync/test_driver.py +++ b/tests/unit/sync/test_driver.py @@ -44,17 +44,7 @@ @wraps(GraphDatabase.driver) def create_driver(*args, **kwargs): - if Util.is_async_code: - with pytest.warns(ExperimentalWarning, match="async") as warnings: - driver = GraphDatabase.driver(*args, **kwargs) - print(warnings) - return driver - else: - return GraphDatabase.driver(*args, **kwargs) - - -def driver(*args, **kwargs): - return Neo4jDriver(*args, **kwargs) + return GraphDatabase.driver(*args, **kwargs) @pytest.mark.parametrize("protocol", ("bolt://", "bolt+s://", "bolt+ssc://"))