Skip to content

Commit c484358

Browse files
committed
Remove deprecated modules
1 parent cb4cf6d commit c484358

File tree

3 files changed

+5
-67
lines changed

3 files changed

+5
-67
lines changed

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog.
44

55
## NEXT RELEASE
6-
- No breaking or major changes.
6+
- Remove deprecated exports from `neo4j`:
7+
- `log`, `Config`, `PoolConfig`, `SessionConfig`, `WorkspaceConfig` (internal - no replacement)
8+
- `SummaryNotificationPosition` (use `SummaryInputPosition` instead)
79

810

911
## Version 5.28

src/neo4j/__init__.py

+1-38
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616

1717
import typing as _t
18-
from logging import getLogger as _getLogger
1918

2019
from ._api import ( # noqa: F401 dynamic attributes
2120
NotificationCategory,
@@ -37,13 +36,10 @@
3736
AsyncSession,
3837
AsyncTransaction,
3938
)
40-
from ._conf import ( # noqa: F401 dynamic attribute
41-
Config as _Config,
42-
SessionConfig as _SessionConfig,
39+
from ._conf import (
4340
TrustAll,
4441
TrustCustomCAs,
4542
TrustSystemCAs,
46-
WorkspaceConfig as _WorkspaceConfig,
4743
)
4844
from ._data import Record
4945
from ._meta import (
@@ -55,9 +51,6 @@
5551
PreviewWarning,
5652
version as __version__,
5753
)
58-
from ._sync.config import ( # noqa: F401 dynamic attribute
59-
PoolConfig as _PoolConfig,
60-
)
6154
from ._sync.driver import (
6255
BoltDriver,
6356
Driver,
@@ -88,7 +81,6 @@
8881
from ._work import (
8982
GqlStatusObject, # noqa: TCH004 false positive (dynamic attribute)
9083
NotificationClassification, # noqa: TCH004 false positive (dynamic attribute)
91-
SummaryInputPosition as SummaryNotificationPosition, # noqa: TCH004 false positive (dynamic attribute)
9284
)
9385

9486
from .addressing import (
@@ -139,7 +131,6 @@
139131
"BoltDriver",
140132
"Bookmark",
141133
"Bookmarks",
142-
"Config", # noqa: F822 dynamic attribute
143134
"Driver",
144135
"EagerResult",
145136
"ExperimentalWarning",
@@ -155,7 +146,6 @@
155146
"NotificationDisabledClassification",
156147
"NotificationMinimumSeverity",
157148
"NotificationSeverity",
158-
"PoolConfig", # noqa: F822 dynamic attribute
159149
"PreviewWarning",
160150
"Query",
161151
"Record",
@@ -164,53 +154,26 @@
164154
"RoutingControl",
165155
"ServerInfo",
166156
"Session",
167-
"SessionConfig", # noqa: F822 dynamic attribute
168157
"SummaryCounters",
169158
"SummaryInputPosition",
170159
"SummaryNotification",
171-
"SummaryNotificationPosition",
172160
"Transaction",
173161
"TrustAll",
174162
"TrustCustomCAs",
175163
"TrustSystemCAs",
176164
"Version",
177-
"WorkspaceConfig", # noqa: F822 dynamic attribute
178165
"__version__",
179166
"basic_auth",
180167
"bearer_auth",
181168
"custom_auth",
182169
"get_user_agent",
183170
"kerberos_auth",
184-
"log", # noqa: F822 dynamic attribute
185171
"unit_of_work",
186172
]
187173

188174

189-
_log = _getLogger("neo4j")
190-
191-
192175
def __getattr__(name) -> _t.Any:
193176
# TODO: 6.0 - remove this
194-
if name in {
195-
"log",
196-
"Config",
197-
"PoolConfig",
198-
"SessionConfig",
199-
"WorkspaceConfig",
200-
}:
201-
_deprecation_warn(
202-
f"Importing {name} from neo4j is deprecated without replacement. "
203-
"It's internal and will be removed in a future version.",
204-
stack_level=2,
205-
)
206-
return globals()[f"_{name}"]
207-
if name == "SummaryNotificationPosition":
208-
_deprecation_warn(
209-
"SummaryNotificationPosition is deprecated. "
210-
"Use SummaryInputPosition instead.",
211-
stack_level=2,
212-
)
213-
return SummaryInputPosition
214177
if name in {
215178
"NotificationClassification",
216179
"GqlStatusObject",

tests/unit/common/test_import_neo4j.py

+1-28
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def test_import_neo4j():
4545
("BoltDriver", None),
4646
("Bookmark", None),
4747
("Bookmarks", None),
48-
("Config", DeprecationWarning),
4948
("custom_auth", None),
5049
("DEFAULT_DATABASE", None),
5150
("Driver", None),
@@ -57,7 +56,6 @@ def test_import_neo4j():
5756
("IPv4Address", None),
5857
("IPv6Address", None),
5958
("kerberos_auth", None),
60-
("log", DeprecationWarning),
6159
("ManagedTransaction", None),
6260
("Neo4jDriver", None),
6361
("NotificationCategory", None),
@@ -66,7 +64,6 @@ def test_import_neo4j():
6664
("NotificationDisabledClassification", PreviewWarning),
6765
("NotificationMinimumSeverity", None),
6866
("NotificationSeverity", None),
69-
("PoolConfig", DeprecationWarning),
7067
("PreviewWarning", None),
7168
("Query", None),
7269
("READ_ACCESS", None),
@@ -76,11 +73,9 @@ def test_import_neo4j():
7673
("RoutingControl", None),
7774
("ServerInfo", None),
7875
("Session", None),
79-
("SessionConfig", DeprecationWarning),
8076
("SummaryCounters", None),
8177
("SummaryInputPosition", None),
8278
("SummaryNotification", None),
83-
("SummaryNotificationPosition", DeprecationWarning),
8479
("SYSTEM_DATABASE", None),
8580
("Transaction", None),
8681
("TRUST_ALL_CERTIFICATES", None),
@@ -90,7 +85,6 @@ def test_import_neo4j():
9085
("TrustSystemCAs", None),
9186
("unit_of_work", None),
9287
("Version", None),
93-
("WorkspaceConfig", DeprecationWarning),
9488
("WRITE_ACCESS", None),
9589
)
9690

@@ -129,28 +123,7 @@ def test_dir():
129123
def test_import_star():
130124
with pytest.warns() as warnings:
131125
importlib.__import__("neo4j", fromlist=("*",))
132-
assert len(warnings) == 9
133-
assert all(
134-
issubclass(w.category, (DeprecationWarning, PreviewWarning))
135-
for w in warnings
136-
)
137-
138-
for name in (
139-
"log",
140-
"Config",
141-
"PoolConfig",
142-
"SessionConfig",
143-
"WorkspaceConfig",
144-
"SummaryNotificationPosition",
145-
):
146-
assert (
147-
sum(
148-
bool(re.match(rf".*\b{name}\b.*", str(w.message)))
149-
for w in warnings
150-
if issubclass(w.category, DeprecationWarning)
151-
)
152-
== 1
153-
)
126+
assert len(warnings) == 3
154127

155128
for name in (
156129
"NotificationClassification",

0 commit comments

Comments
 (0)