Skip to content

Remove experimental marking of the async driver #783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 0 additions & 8 deletions docs/source/async_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down
4 changes: 0 additions & 4 deletions neo4j/_async/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
8 changes: 0 additions & 8 deletions neo4j/_async_compat/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions neo4j/_sync/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
13 changes: 5 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
14 changes: 3 additions & 11 deletions tests/integration/async_/test_custom_ssl_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/mixed/test_async_cancellation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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!
Expand Down
14 changes: 3 additions & 11 deletions tests/integration/sync/test_custom_ssl_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down
12 changes: 1 addition & 11 deletions tests/unit/async_/test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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://"))
Expand Down
12 changes: 1 addition & 11 deletions tests/unit/sync/test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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://"))
Expand Down