Skip to content

Commit e7f75ea

Browse files
committed
Stabilize re-auth feature from preview
1 parent 222b107 commit e7f75ea

22 files changed

+114
-225
lines changed

docs/source/api.rst

+7-11
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,6 @@ Closing a driver will immediately shut down all connections in the pool.
280280

281281
By default, the driver configuration is used.
282282

283-
**This is a preview** (see :ref:`filter-warnings-ref`).
284-
It might be changed without following the deprecation policy.
285-
See also
286-
https://github.com/neo4j/neo4j-python-driver/wiki/preview-features
287-
288283
See also the Session config :ref:`session-auth-ref`.
289284
:type auth_: typing.Tuple[typing.Any, typing.Any] | Auth | None
290285
:param result_transformer_:
@@ -374,9 +369,12 @@ Closing a driver will immediately shut down all connections in the pool.
374369

375370
.. versionchanged:: 5.8
376371

377-
* Added the ``auth_`` parameter.
372+
* Added ``auth_`` parameter in preview.
378373
* Stabilized from experimental.
379374

375+
.. versionchanged:: 5.14
376+
Stabilized ``auth_`` parameter from preview.
377+
380378

381379
.. _driver-configuration-ref:
382380

@@ -1044,7 +1042,7 @@ See :class:`.BookmarkManager` for more information.
10441042

10451043
.. versionadded:: 5.0
10461044

1047-
.. versionchanged:: 5.8 stabilized from experimental
1045+
.. versionchanged:: 5.8 Stabilized from experimental.
10481046

10491047

10501048
.. _session-auth-ref:
@@ -1060,15 +1058,13 @@ It is not possible to overwrite the authentication information for the session w
10601058
i.e., downgrade the authentication at session level.
10611059
Instead, you should create a driver with no authentication and upgrade the authentication at session level as needed.
10621060

1063-
**This is a preview** (see :ref:`filter-warnings-ref`).
1064-
It might be changed without following the deprecation policy.
1065-
See also https://github.com/neo4j/neo4j-python-driver/wiki/preview-features
1066-
10671061
:Type: :data:`None`, :class:`.Auth` or ``(user, password)``-tuple
10681062
:Default: :data:`None` - use the authentication information provided during driver creation.
10691063

10701064
.. versionadded:: 5.8
10711065

1066+
.. versionchanged:: 5.14 Stabilized from preview.
1067+
10721068

10731069
.. _session-notifications-min-severity-ref:
10741070

docs/source/async_api.rst

+5-7
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,6 @@ Closing a driver will immediately shut down all connections in the pool.
267267

268268
By default, the driver configuration is used.
269269

270-
**This is a preview** (see :ref:`filter-warnings-ref`).
271-
It might be changed without following the deprecation policy.
272-
See also
273-
https://github.com/neo4j/neo4j-python-driver/wiki/preview-features
274-
275270
See also the Session config :ref:`session-auth-ref`.
276271
:type auth_: typing.Tuple[typing.Any, typing.Any] | Auth | None
277272
:param result_transformer_:
@@ -361,9 +356,12 @@ Closing a driver will immediately shut down all connections in the pool.
361356

362357
.. versionchanged:: 5.8
363358

364-
* Added the ``auth_`` parameter.
359+
* Added ``auth_`` parameter in preview.
365360
* Stabilized from experimental.
366361

362+
.. versionchanged:: 5.14
363+
Stabilized ``auth_`` parameter from preview.
364+
367365

368366
.. _async-driver-configuration-ref:
369367

@@ -651,7 +649,7 @@ See :class:`BookmarkManager` for more information.
651649
:Type: :data:`None`, :class:`BookmarkManager`, or :class:`AsyncBookmarkManager`
652650
:Default: :data:`None`
653651

654-
.. versionchanged:: 5.8 stabilized from experimental
652+
.. versionchanged:: 5.8 Stabilized from experimental.
655653

656654

657655

src/neo4j/_api.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ class RoutingControl(str, Enum):
229229
230230
.. versionchanged:: 5.8
231231
232-
* renamed ``READERS`` to ``READ`` and ``WRITERS`` to ``WRITE``
233-
* stabilized from experimental
232+
* Renamed ``READERS`` to ``READ`` and ``WRITERS`` to ``WRITE``.
233+
* Stabilized from experimental.
234234
"""
235235
READ = "r"
236236
WRITE = "w"

src/neo4j/_async/auth_management.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
expiring_auth_has_expired,
2828
ExpiringAuth,
2929
)
30-
from .._meta import preview
3130

3231

3332
if t.TYPE_CHECKING:
@@ -105,20 +104,17 @@ async def handle_security_exception(
105104
class AsyncAuthManagers:
106105
"""A collection of :class:`.AsyncAuthManager` factories.
107106
108-
**This is a preview** (see :ref:`filter-warnings-ref`).
109-
It might be changed without following the deprecation policy.
110-
See also https://github.com/neo4j/neo4j-python-driver/wiki/preview-features
111-
112107
.. versionadded:: 5.8
113108
114109
.. versionchanged:: 5.12
115110
116111
* Method ``expiration_based()`` was renamed to :meth:`bearer`.
117112
* Added :meth:`basic`.
113+
114+
.. versionchanged:: 5.14 Stabilized from preview.
118115
"""
119116

120117
@staticmethod
121-
@preview("Auth managers are a preview feature.")
122118
def static(auth: _TAuth) -> AsyncAuthManager:
123119
"""Create a static auth manager.
124120
@@ -146,11 +142,14 @@ def static(auth: _TAuth) -> AsyncAuthManager:
146142
:returns:
147143
An instance of an implementation of :class:`.AsyncAuthManager` that
148144
always returns the same auth.
145+
146+
.. versionadded:: 5.8
147+
148+
.. versionchanged:: 5.14 Stabilized from preview.
149149
"""
150150
return AsyncStaticAuthManager(auth)
151151

152152
@staticmethod
153-
@preview("Auth managers are a preview feature.")
154153
def basic(
155154
provider: t.Callable[[], t.Awaitable[_TAuth]]
156155
) -> AsyncAuthManager:
@@ -203,6 +202,8 @@ async def auth_provider():
203202
flagged it as expired).
204203
205204
.. versionadded:: 5.12
205+
206+
.. versionchanged:: 5.14 Stabilized from preview.
206207
"""
207208
handled_codes = frozenset(("Neo.ClientError.Security.Unauthorized",))
208209

@@ -214,7 +215,6 @@ async def wrapped_provider() -> ExpiringAuth:
214215
return AsyncNeo4jAuthTokenManager(wrapped_provider, handled_codes)
215216

216217
@staticmethod
217-
@preview("Auth managers are a preview feature.")
218218
def bearer(
219219
provider: t.Callable[[], t.Awaitable[ExpiringAuth]]
220220
) -> AsyncAuthManager:
@@ -277,6 +277,8 @@ async def auth_provider():
277277
expired).
278278
279279
.. versionadded:: 5.12
280+
281+
.. versionchanged:: 5.14 Stabilized from preview.
280282
"""
281283
handled_codes = frozenset((
282284
"Neo.ClientError.Security.TokenExpired",

src/neo4j/_async/driver.py

+14-29
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747
from .._meta import (
4848
deprecation_warn,
4949
experimental_warn,
50-
preview,
51-
preview_warn,
5250
unclosed_resource_warn,
5351
)
5452
from .._work import EagerResult
@@ -193,10 +191,7 @@ def driver(
193191
driver_type, security_type, parsed = parse_neo4j_uri(uri)
194192

195193
if not isinstance(auth, AsyncAuthManager):
196-
auth = AsyncAuthManagers.static._without_warning(auth)
197-
else:
198-
preview_warn("Auth managers are a preview feature.",
199-
stack_level=2)
194+
auth = AsyncAuthManagers.static(auth)
200195
config["auth"] = auth
201196

202197
# TODO: 6.0 - remove "trust" config option
@@ -357,7 +352,7 @@ def bookmark_manager(
357352
* ``bookmarks_consumer`` no longer receives the database name as
358353
an argument.
359354
360-
.. versionchanged:: 5.8 stabilized from experimental
355+
.. versionchanged:: 5.8 Stabilized from experimental.
361356
"""
362357
return AsyncNeo4jBookmarkManager(
363358
initial_bookmarks=initial_bookmarks,
@@ -551,17 +546,14 @@ def session(self, **config) -> AsyncSession:
551546
def _session(self, session_config) -> AsyncSession:
552547
return AsyncSession(self._pool, session_config)
553548

554-
def _read_session_config(self, config_kwargs, preview_check=True):
555-
config = self._prepare_session_config(preview_check, config_kwargs)
549+
def _read_session_config(self, config_kwargs):
550+
config = self._prepare_session_config(config_kwargs)
556551
session_config = SessionConfig(self._default_workspace_config,
557552
config)
558553
return session_config
559554

560555
@classmethod
561-
def _prepare_session_config(cls, preview_check, config_kwargs):
562-
if preview_check and "auth" in config_kwargs:
563-
preview_warn("User switching is a preview feature.",
564-
stack_level=5)
556+
def _prepare_session_config(cls, config_kwargs):
565557
_normalize_notifications_config(config_kwargs)
566558
return config_kwargs
567559

@@ -745,11 +737,6 @@ async def example(driver: neo4j.AsyncDriver) -> int:
745737
746738
By default, the driver configuration is used.
747739
748-
**This is a preview** (see :ref:`filter-warnings-ref`).
749-
It might be changed without following the deprecation policy.
750-
See also
751-
https://github.com/neo4j/neo4j-python-driver/wiki/preview-features
752-
753740
See also the Session config :ref:`session-auth-ref`.
754741
:type auth_: typing.Tuple[typing.Any, typing.Any] | Auth | None
755742
:param result_transformer_:
@@ -839,8 +826,11 @@ async def example(driver: neo4j.AsyncDriver) -> neo4j.Record::
839826
840827
.. versionchanged:: 5.8
841828
842-
* Added the ``auth_`` parameter.
829+
* Added ``auth_`` parameter in preview.
843830
* Stabilized from experimental.
831+
832+
.. versionchanged:: 5.14
833+
Stabilized ``auth_`` parameter from preview.
844834
"""
845835
self._check_state()
846836
invalid_kwargs = [k for k in kwargs if
@@ -865,8 +855,7 @@ async def example(driver: neo4j.AsyncDriver) -> neo4j.Record::
865855
"impersonated_user": impersonated_user_,
866856
"bookmark_manager": bookmark_manager_,
867857
"auth": auth_,
868-
},
869-
preview_check=False
858+
}
870859
)
871860
session = self._session(session_config)
872861
async with session:
@@ -1072,7 +1061,7 @@ async def supports_multi_db(self) -> bool:
10721061
driver feature.
10731062
"""
10741063
self._check_state()
1075-
session_config = self._read_session_config({}, preview_check=False)
1064+
session_config = self._read_session_config({})
10761065
async with self._session(session_config) as session:
10771066
await session._connect(READ_ACCESS)
10781067
assert session._connection
@@ -1106,7 +1095,6 @@ async def verify_authentication(
11061095

11071096
else:
11081097

1109-
@preview("User switching is a preview feature.")
11101098
async def verify_authentication(
11111099
self,
11121100
auth: t.Union[Auth, t.Tuple[t.Any, t.Any], None] = None,
@@ -1140,12 +1128,9 @@ async def verify_authentication(
11401128
Use the exception to further understand the cause of the
11411129
connectivity problem.
11421130
1143-
**This is a preview** (see :ref:`filter-warnings-ref`).
1144-
It might be changed without following the deprecation policy.
1145-
See also
1146-
https://github.com/neo4j/neo4j-python-driver/wiki/preview-features
1147-
11481131
.. versionadded:: 5.8
1132+
1133+
.. versionchanged:: 5.14 Stabilized from experimental.
11491134
"""
11501135
self._check_state()
11511136
if config:
@@ -1190,7 +1175,7 @@ async def supports_session_auth(self) -> bool:
11901175
.. versionadded:: 5.8
11911176
"""
11921177
self._check_state()
1193-
session_config = self._read_session_config({}, preview_check=False)
1178+
session_config = self._read_session_config({})
11941179
async with self._session(session_config) as session:
11951180
await session._connect(READ_ACCESS)
11961181
assert session._connection

src/neo4j/_async/work/result.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ async def to_eager_result(self) -> EagerResult:
642642
643643
.. versionadded:: 5.5
644644
645-
.. versionchanged:: 5.8 stabilized from experimental
645+
.. versionchanged:: 5.8 Stabilized from experimental.
646646
"""
647647

648648
await self._buffer_all()

src/neo4j/_auth_management.py

+9-20
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@
2323
import typing as t
2424
from dataclasses import dataclass
2525

26-
from ._meta import preview
2726
from .exceptions import Neo4jError
2827

2928

3029
if t.TYPE_CHECKING:
3130
from .api import _TAuth
3231

3332

34-
@preview("Auth managers are a preview feature.")
3533
@dataclass
3634
class ExpiringAuth:
3735
"""Represents potentially expiring authentication information.
@@ -46,21 +44,20 @@ class ExpiringAuth:
4644
If :data:`None`, the authentication information is considered to not
4745
expire until the server explicitly indicates so.
4846
49-
**This is a preview** (see :ref:`filter-warnings-ref`).
50-
It might be changed without following the deprecation policy.
51-
See also https://github.com/neo4j/neo4j-python-driver/wiki/preview-features
52-
5347
.. seealso::
5448
:meth:`.AuthManagers.expiration_based`,
5549
:meth:`.AsyncAuthManagers.expiration_based`
5650
5751
.. versionadded:: 5.8
5852
5953
.. versionchanged:: 5.9
60-
Removed parameter and attribute ``expires_in`` (relative expiration
61-
time). Replaced with ``expires_at`` (absolute expiration time).
62-
:meth:`.expires_in` can be used to create an :class:`.ExpiringAuth`
63-
with a relative expiration time.
54+
55+
* Removed parameter and attribute ``expires_in`` (relative expiration
56+
time). Replaced with ``expires_at`` (absolute expiration time).
57+
* :meth:`.expires_in` can be used to create an :class:`.ExpiringAuth`
58+
with a relative expiration time.
59+
60+
.. versionchanged:: 5.14 Stabilized from preview.
6461
"""
6562
auth: _TAuth
6663
expires_at: t.Optional[float] = None
@@ -116,19 +113,15 @@ class AuthManager(metaclass=abc.ABCMeta):
116113
You may use session-level authentication for such use-cases
117114
:ref:`session-auth-ref`.
118115
119-
**This is a preview** (see :ref:`filter-warnings-ref`).
120-
It might be changed without following the deprecation policy.
121-
See also https://github.com/neo4j/neo4j-python-driver/wiki/preview-features
122-
123116
.. seealso:: :class:`.AuthManagers`
124117
125118
.. versionadded:: 5.8
126119
127120
.. versionchanged:: 5.12
128121
``on_auth_expired`` was removed from the interface and replaced by
129-
:meth:`handle_security_exception`. The new method is called when the
122+
:meth:`handle_security_exception`. The new method is called when the
130123
server returns any `Neo.ClientError.Security.*` error. It's signature
131-
differs in that it additionally received the error returned by the
124+
differs in that it additionally receives the error returned by the
132125
server and returns a boolean indicating whether the error was handled.
133126
"""
134127

@@ -178,10 +171,6 @@ def handle_security_exception(
178171
class AsyncAuthManager(metaclass=abc.ABCMeta):
179172
"""Async version of :class:`.AuthManager`.
180173
181-
**This is a preview** (see :ref:`filter-warnings-ref`).
182-
It might be changed without following the deprecation policy.
183-
See also https://github.com/neo4j/neo4j-python-driver/wiki/preview-features
184-
185174
.. seealso:: :class:`.AuthManager`
186175
187176
.. versionadded:: 5.8

0 commit comments

Comments
 (0)