From 8de44f1c8e608812152c00e33e6a12f200ed8b28 Mon Sep 17 00:00:00 2001 From: Robsdedude Date: Tue, 20 May 2025 17:16:34 +0200 Subject: [PATCH 1/2] Remove deprecated `ServerInfo.connection_id`. There is no replacement as this is considered internal information. --- CHANGELOG.md | 2 ++ src/neo4j/api.py | 16 +--------------- tests/integration/test_bolt_driver.py | 10 ---------- tests/unit/common/test_api.py | 4 ++-- 4 files changed, 5 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3314642f..2324d98dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,8 @@ See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog. If you were calling it directly, please use `Record.__getitem__(slice(...))` or simply `record[...]` instead. - Remove deprecated class `neo4j.Bookmark` in favor of `neo4j.Bookmarks`. - Remove deprecated class `session.last_bookmark()` in favor of `last_bookmarks()`. +- Remove deprecated `ServerInfo.connection_id`. + There is no replacement as this is considered internal information. - Remove deprecated driver configuration option `trust`. Use `trusted_certificates` instead. - Remove the associated constants `neo4j.TRUST_ALL_CERTIFICATES` and `neo4j.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES`. diff --git a/src/neo4j/api.py b/src/neo4j/api.py index 9e8e05fc5..10663f2b0 100644 --- a/src/neo4j/api.py +++ b/src/neo4j/api.py @@ -24,15 +24,10 @@ if t.TYPE_CHECKING: import typing_extensions as te - from typing_extensions import ( - deprecated, - Protocol as _Protocol, - ) + from typing_extensions import Protocol as _Protocol from ._addressing import Address else: - from ._warnings import deprecated - _Protocol = object @@ -311,15 +306,6 @@ def agent(self) -> str: """Server agent string by which the remote server identifies itself.""" return str(self._metadata.get("server")) - @property # type: ignore - @deprecated( - "The connection id is considered internal information " - "and will no longer be exposed in future versions." - ) - def connection_id(self): - """Unique identifier for the remote server connection.""" - return self._metadata.get("connection_id") - def update(self, metadata: dict) -> None: """ Update server information with extra metadata. diff --git a/tests/integration/test_bolt_driver.py b/tests/integration/test_bolt_driver.py index 0f212b635..282b5fb1c 100644 --- a/tests/integration/test_bolt_driver.py +++ b/tests/integration/test_bolt_driver.py @@ -30,13 +30,3 @@ def server_info(driver): with driver.session() as session: summary = session.run("RETURN 1").consume() yield summary.server - - -# TODO: 6.0 - -# This test will stay as python is currently the only driver exposing -# the connection id. This will be removed in 6.0 -def test_server_connection_id(driver): - server_info = driver.get_server_info() - with pytest.warns(DeprecationWarning): - cid = server_info.connection_id - assert cid.startswith("bolt-") and cid[5:].isdigit() diff --git a/tests/unit/common/test_api.py b/tests/unit/common/test_api.py index e891233bb..ea2c1a2c4 100644 --- a/tests/unit/common/test_api.py +++ b/tests/unit/common/test_api.py @@ -137,8 +137,8 @@ def test_serverinfo_initialization() -> None: server_info = neo4j.ServerInfo(address, version) assert server_info.address is address assert server_info.protocol_version is version - with pytest.warns(DeprecationWarning): - assert server_info.connection_id is None + with pytest.raises(AttributeError): + _ = server_info.connection_id # type: ignore # expected to fail @pytest.mark.parametrize( From 936045369c9f6883fad71e522bce50a3ffe2a40e Mon Sep 17 00:00:00 2001 From: Robsdedude Date: Thu, 22 May 2025 14:00:01 +0200 Subject: [PATCH 2/2] Changelog formatting --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2324d98dd..8dd2e1644 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,7 +64,7 @@ See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog. If you were calling it directly, please use `Record.__getitem__(slice(...))` or simply `record[...]` instead. - Remove deprecated class `neo4j.Bookmark` in favor of `neo4j.Bookmarks`. - Remove deprecated class `session.last_bookmark()` in favor of `last_bookmarks()`. -- Remove deprecated `ServerInfo.connection_id`. +- Remove deprecated `ServerInfo.connection_id`. There is no replacement as this is considered internal information. - Remove deprecated driver configuration option `trust`. Use `trusted_certificates` instead.