Skip to content

Commit 258a319

Browse files
robsdedudeMaxAake
andauthored
Clean-ups and meta data bump for 6.0 (#1200)
Co-authored-by: Max Gustafsson <[email protected]>
1 parent fc43f30 commit 258a319

File tree

32 files changed

+250
-257
lines changed

32 files changed

+250
-257
lines changed

CHANGELOG.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog.
5656
- It is now the same error raised as when trying to start an explicit transaction while another explicit transaction
5757
is already active.
5858
- Slightly change `Neo4jError` and `ClientError`:
59-
- Properties `message` and `code` are always a `str` (instead of `str | None`).
60-
- Remove possibility to override/set `message` and `code` properties.
61-
- Remove undocumented, internal methods `Neo4jError.hydrate`, `Neo4jError.invalidates_all_connections`,
62-
and `Neo4jError.is_fatal_during_discovery`.
63-
- Remove deprecated method `Neo4jError.is_retriable`.
64-
Use `Neo4jError.is_retryable` instead.
65-
- Change string representation of `Neo4jError` to include GQL error information.
59+
- Properties `message` and `code` are always a `str` (instead of `str | None`).
60+
- Remove possibility to override/set `message` and `code` properties.
61+
- Remove undocumented, internal methods `Neo4jError.hydrate`, `Neo4jError.invalidates_all_connections`,
62+
and `Neo4jError.is_fatal_during_discovery`.
63+
- Remove deprecated method `Neo4jError.is_retriable`.
64+
Use `Neo4jError.is_retryable` instead.
65+
- Change string representation of `Neo4jError` to include GQL error information.
6666
- Remove deprecated `Record.__getslice__`. This magic method has been removed in Python 3.0.
6767
If you were calling it directly, please use `Record.__getitem__(slice(...))` or simply `record[...]` instead.
6868
- Bookmarks

README.rst

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,10 @@ Neo4j Bolt Driver for Python
44

55
This repository contains the official Neo4j driver for Python.
66

7-
Starting with 5.0, the Neo4j Drivers will be moving to a monthly release
8-
cadence. A minor version will be released on the last Friday of each month so
9-
as to maintain versioning consistency with the core product (Neo4j DBMS) which
10-
has also moved to a monthly cadence.
7+
Driver upgrades within a major version will never contain breaking API changes.
118

12-
As a policy, patch versions will not be released except on rare occasions. Bug
13-
fixes and updates will go into the latest minor version and users should
14-
upgrade to that. Driver upgrades within a major version will never contain
15-
breaking API changes.
16-
17-
See also: https://neo4j.com/developer/kb/neo4j-supported-versions/
9+
For version compatibility with Neo4j server, please refer to:
10+
https://neo4j.com/developer/kb/neo4j-supported-versions/
1811

1912
+ Python 3.13 supported.
2013
+ Python 3.12 supported.

docs/source/api.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ Each supported scheme maps to a particular :class:`neo4j.Driver` subclass that i
8282
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
8383
| URI Scheme | Driver Object and Setting |
8484
+========================+=======================================================================================================================================+
85-
| bolt | :ref:`bolt-driver-ref` with no encryption. |
85+
| bolt | :ref:`bolt-driver-ref` with no encryption or with custom encryption configuration, see :ref:`driver-configuration-ref`. |
8686
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
8787
| bolt+ssc | :ref:`bolt-driver-ref` with encryption (accepts self signed certificates). |
8888
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
8989
| bolt+s | :ref:`bolt-driver-ref` with encryption (accepts only certificates signed by a certificate authority), full certificate checks. |
9090
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
91-
| neo4j | :ref:`neo4j-driver-ref` with no encryption. |
91+
| neo4j | :ref:`neo4j-driver-ref` with no encryption or with custom encryption configuration, see :ref:`driver-configuration-ref`. |
9292
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
9393
| neo4j+ssc | :ref:`neo4j-driver-ref` with encryption (accepts self signed certificates). |
9494
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
@@ -804,9 +804,8 @@ For example:
804804
self.driver.close()
805805
806806
Connection details held by the :class:`neo4j.Driver` are immutable.
807-
Therefore if, for example, a password is changed, a replacement :class:`neo4j.Driver` object must be created.
808-
More than one :class:`.Driver` may be required if connections to multiple remotes, or connections as multiple users, are required,
809-
unless when using impersonation (:ref:`impersonated-user-ref`).
807+
Therefore if, for example, the server URI is changed, a replacement :class:`neo4j.Driver` object must be created.
808+
More than one :class:`.Driver` may be required if connections to multiple remotes.
810809

811810
:class:`neo4j.Driver` objects are thread-safe but cannot be shared across processes.
812811
Therefore, ``multithreading`` should generally be preferred over ``multiprocessing`` for parallel database access.
@@ -964,7 +963,8 @@ more information.
964963
:class:`neo4j.Bookmarks` object instead.
965964

966965
.. versionchanged:: 6.0
967-
Only accepts :class:`neo4j.Bookmarks` objects or :data:`None`.
966+
No longer accepts an iterable of strings.
967+
Pass a :class:`neo4j.Bookmarks` objects or :data:`None` instead.
968968

969969

970970
.. _database-ref:
@@ -985,7 +985,7 @@ Name of the database to query.
985985
straightforward way and potentially simplifies driver logic as well as
986986
reduces network communication resulting in better performance.
987987

988-
Usage of Cypher clauses like `USE` is not a replacement for this option.
988+
Usage of Cypher clauses like ``USE`` is not a replacement for this option.
989989
The driver does not parse any Cypher.
990990

991991
When no explicit name is set, the driver behavior depends on the connection
@@ -1384,7 +1384,7 @@ Example:
13841384
13851385
.. _managed-transactions-ref:
13861386

1387-
Managed Transactions (`transaction functions`)
1387+
Managed Transactions (*transaction functions*)
13881388
==============================================
13891389
Transaction functions are the most powerful form of transaction, providing access mode override and retry capabilities.
13901390

docs/source/async_api.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ Each supported scheme maps to a particular :class:`neo4j.AsyncDriver` subclass t
9595
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
9696
| URI Scheme | Driver Object and Setting |
9797
+========================+=============================================================================================================================================+
98-
| bolt | :ref:`async-bolt-driver-ref` with no encryption. |
98+
| bolt | :ref:`async-bolt-driver-ref` with no encryption or with custom encryption configuration, see :ref:`async-driver-configuration-ref`. |
9999
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
100100
| bolt+ssc | :ref:`async-bolt-driver-ref` with encryption (accepts self signed certificates). |
101101
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
102102
| bolt+s | :ref:`async-bolt-driver-ref` with encryption (accepts only certificates signed by a certificate authority), full certificate checks. |
103103
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
104-
| neo4j | :ref:`async-neo4j-driver-ref` with no encryption. |
104+
| neo4j | :ref:`async-neo4j-driver-ref` with no encryption or with custom encryption configuration, see :ref:`async-driver-configuration-ref`. |
105105
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
106106
| neo4j+ssc | :ref:`async-neo4j-driver-ref` with encryption (accepts self signed certificates). |
107107
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
@@ -487,9 +487,7 @@ For example:
487487
await self.driver.close()
488488
489489
Connection details held by the :class:`neo4j.AsyncDriver` are immutable.
490-
Therefore if, for example, a password is changed, a replacement :class:`neo4j.AsyncDriver` object must be created.
491-
More than one :class:`.AsyncDriver` may be required if connections to multiple remotes, or connections as multiple users, are required,
492-
unless when using impersonation (:ref:`impersonated-user-ref`).
490+
Therefore if, for example, the server URI is changed, a replacement :class:`neo4j.AsyncDriver` object must be created.
493491

494492
:class:`neo4j.AsyncDriver` objects are safe to be used in concurrent coroutines.
495493
They are not thread-safe.
@@ -837,7 +835,7 @@ Example:
837835
.. _async-managed-transactions-ref:
838836

839837

840-
Managed Transactions (`transaction functions`)
838+
Managed Transactions (*transaction functions*)
841839
==============================================
842840
Transaction functions are the most powerful form of transaction, providing access mode override and retry capabilities.
843841

docs/source/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ Specifically for this driver, this will:
126126
* enable :class:`DeprecationWarning`, which the driver emits if deprecated APIs are used.
127127
* enable the driver's debug mode (this can also be achieved by setting the environment variable ``PYTHONNEO4JDEBUG``):
128128

129-
It might be changed or removed any time even without prior notice.
130129
* the driver will raise an exception if non-concurrency-safe methods are used concurrently.
131130
* the driver will emit warnings if the server sends back notification
132131
(see also :ref:`driver-warn-notification-severity-ref`).

src/neo4j/_addressing.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,6 @@ def __str__(self) -> str:
341341
return "[{}]:{}".format(*self)
342342

343343

344-
# TODO: 6.0 - make this class private
345344
class ResolvedAddress(Address):
346345
_unresolved_host_name: str
347346

@@ -360,11 +359,9 @@ def __new__(cls, iterable, *, host_name: str) -> ResolvedAddress:
360359
return new
361360

362361

363-
# TODO: 6.0 - make this class private
364362
class ResolvedIPv4Address(IPv4Address, ResolvedAddress):
365363
pass
366364

367365

368-
# TODO: 6.0 - make this class private
369366
class ResolvedIPv6Address(IPv6Address, ResolvedAddress):
370367
pass

src/neo4j/_async/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ class AsyncPoolConfig(Config):
6767
trusted_certificates = TrustSystemCAs()
6868
# Specify how to determine the authenticity of encryption certificates
6969
# provided by the Neo4j instance on connection.
70-
# * `neo4j.TrustSystemCAs()`: Use system trust store. (default)
71-
# * `neo4j.TrustAll()`: Trust any certificate.
72-
# * `neo4j.TrustCustomCAs("<path>", ...)`:
70+
# * ``neo4j.TrustSystemCAs()``: Use system trust store. (default)
71+
# * ``neo4j.TrustAll()``: Trust any certificate.
72+
# * ``neo4j.TrustCustomCAs("<path>", ...)``:
7373
# Trust the specified certificate(s).
7474

7575
#: Certificate to use for mTLS as 2nd authentication factor.
@@ -78,7 +78,7 @@ class AsyncPoolConfig(Config):
7878
#: Custom SSL context to use for wrapping sockets
7979
ssl_context = None
8080
# Use any custom SSL context to wrap sockets.
81-
# Overwrites `trusted_certificates` and `encrypted`.
81+
# Overwrites ``trusted_certificates`` and ``encrypted``.
8282
# The use of this option is strongly discouraged.
8383

8484
#: User Agent (Python Driver Specific)

src/neo4j/_async/driver.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -301,18 +301,18 @@ def bookmark_manager(
301301
driver = neo4j.AsyncGraphDatabase.driver(...)
302302
bookmark_manager = neo4j.AsyncGraphDatabase.bookmark_manager(...)
303303
304-
async with driver.session(
305-
bookmark_manager=bookmark_manager
306-
) as session1:
307-
async with driver.session(
304+
async with (
305+
driver.session(bookmark_manager=bookmark_manager) as session1,
306+
driver.session(
308307
bookmark_manager=bookmark_manager,
309-
access_mode=neo4j.READ_ACCESS
310-
) as session2:
311-
result1 = await session1.run("<WRITE_QUERY>")
312-
await result1.consume()
313-
# READ_QUERY is guaranteed to see what WRITE_QUERY wrote.
314-
result2 = await session2.run("<READ_QUERY>")
315-
await result2.consume()
308+
default_access_mode=neo4j.READ_ACCESS,
309+
) as session2,
310+
):
311+
result1 = await session1.run("<WRITE_QUERY>")
312+
await result1.consume()
313+
# READ_QUERY is guaranteed to see what WRITE_QUERY wrote.
314+
result2 = await session2.run("<READ_QUERY>")
315+
await result2.consume()
316316
317317
This is a very contrived example, and in this particular case, having
318318
both queries in the same session has the exact same effect and might

src/neo4j/_async/io/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"""
1818
Low-level functionality required for speaking Bolt.
1919
20-
It is not intended to be used directly by driver users. Instead, the `session`
21-
module provides the main user-facing abstractions.
20+
It is not intended to be used directly by driver users. Instead, the
21+
``session`` module provides the main user-facing abstractions.
2222
"""
2323

2424
__all__ = [

src/neo4j/_async/io/_pool.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ async def update_routing_table(
964964
:param acquisition_timeout: connection acquisition timeout
965965
:param database_callback: A callback function that will be called with
966966
the database name as only argument when a new routing table has
967-
been acquired. This database name might different from `database`
967+
been acquired. This database name might different from ``database``
968968
if that was None and the underlying protocol supports reporting
969969
back the actual database.
970970
@@ -1065,7 +1065,8 @@ async def ensure_routing_table_is_fresh(
10651065
10661066
This method is thread-safe.
10671067
1068-
:returns: `True` if an update was required, `False` otherwise.
1068+
:returns:
1069+
:data:`True` if an update was required, :data:`False` otherwise.
10691070
"""
10701071
async with self.refresh_lock:
10711072
for database_ in list(self.routing_tables.keys()):

0 commit comments

Comments
 (0)