Skip to content

Stabilize driver debug mode #1205

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 1 commit into from
Jun 10, 2025
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
5 changes: 2 additions & 3 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -743,14 +743,13 @@ Setting it to :data:`None` will be equivalent to ``OFF``, unless Python runs in
(e.g., with ``python -X dev ...``) or the environment variable ``PYTHONNEO4JDEBUG`` is set, in which case the driver
defaults to emitting warnings on all notification (currently equivalent to :attr:`.NotificationMinimumSeverity.INFORMATION`).

**This is experimental** (see :ref:`filter-warnings-ref`).
It might be changed or removed any time even without prior notice.

:Type: :data:`None`, :class:`.NotificationMinimumSeverity`, or :class:`str`
:Default: :data:`None`

.. versionadded:: 5.21

.. versionchanged:: 6.0 Stabilized from preview.

.. seealso:: :ref:`development-environment-ref`


Expand Down
4 changes: 3 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ Specifically for this driver, this will:
* enable :class:`DeprecationWarning`, which the driver emits if deprecated APIs are used.
* enable the driver's debug mode (this can also be achieved by setting the environment variable ``PYTHONNEO4JDEBUG``):

* **This is experimental**.
It might be changed or removed any time even without prior notice.
* the driver will raise an exception if non-concurrency-safe methods are used concurrently.
* the driver will emit warnings if the server sends back notification
Expand All @@ -137,6 +136,9 @@ Specifically for this driver, this will:
.. versionchanged:: 5.21
Added functionality to automatically emit warnings on server notifications.

.. versionchanged:: 6.0
Stabilized from preview.

.. _development mode: https://docs.python.org/3/library/devmode.html


Expand Down
5 changes: 0 additions & 5 deletions src/neo4j/_async/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,6 @@ def driver(
"is a preview feature.",
stack_level=2,
)
if "warn_notification_severity" in config:
preview_warn(
"notification warnings are a preview feature.",
stack_level=2,
)
_normalize_notifications_config(config, driver_level=True)

liveness_check_timeout = config.get("liveness_check_timeout")
Expand Down
5 changes: 0 additions & 5 deletions src/neo4j/_sync/driver.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions testkitbackend/_async/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
AsyncClientCertificateProvider,
ExpiringAuth,
)
from neo4j.warnings import PreviewWarning

from .. import (
fromtestkit,
Expand Down Expand Up @@ -219,12 +218,6 @@ async def new_driver(backend, data):
kwargs["trusted_certificates"] = neo4j.TrustCustomCAs(*cert_paths)
fromtestkit.set_notifications_config(kwargs, data)

expected_warnings.append(
(
PreviewWarning,
r"notification warnings are a preview feature\.",
)
)
with warnings_check(expected_warnings):
driver = neo4j.AsyncGraphDatabase.driver(
data["uri"],
Expand Down
7 changes: 0 additions & 7 deletions testkitbackend/_sync/requests.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions tests/unit/async_/test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,19 +728,15 @@ async def test_warn_notification_severity_driver_config(
) -> None:
if inspect.isclass(expected) and issubclass(expected, Exception):
assert min_sev is not ... # makes no sense to test
with (
pytest.raises(expected),
pytest.warns(PreviewWarning, match="notification warnings"),
):
with pytest.raises(expected):
AsyncGraphDatabase.driver(uri, warn_notification_severity=min_sev)
return
if min_sev is ...:
driver = AsyncGraphDatabase.driver(uri)
else:
with pytest.warns(PreviewWarning, match="notification warnings"):
driver = AsyncGraphDatabase.driver(
uri, warn_notification_severity=min_sev
)
driver = AsyncGraphDatabase.driver(
uri, warn_notification_severity=min_sev
)
async with driver:
if min_sev_session is ...:
session = driver.session()
Expand Down
12 changes: 4 additions & 8 deletions tests/unit/sync/test_driver.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.