Skip to content

Commit 0e9d09a

Browse files
authored
API docs: be more explicit about driver factory parameters (#883)
* API docs: be more explicit about driver factory parameters * API docs: cannot combine +s/+ssc schemes with some settings * Minor tweak: add ref to URI when talking about schemes
1 parent d92aa8e commit 0e9d09a

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

docs/source/api.rst

+9-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The :class:`neo4j.Driver` construction is done via a ``classmethod`` on the :cla
1616
.. autoclass:: neo4j.GraphDatabase
1717
:members: bookmark_manager
1818

19-
.. method:: driver
19+
.. automethod:: driver
2020

2121
Driver creation example:
2222

@@ -212,6 +212,8 @@ connection can be used to perform database related work.
212212
-------------
213213
Specify whether to use an encrypted connection between the driver and server.
214214

215+
This setting is only available for URI schemes ``bolt://`` and ``neo4j://`` (:ref:`uri-ref`).
216+
215217
This setting does not have any effect if a custom ``ssl_context`` is configured.
216218

217219
:Type: ``bool``
@@ -312,6 +314,8 @@ For example:
312314
---------
313315
Specify how to determine the authenticity of encryption certificates provided by the Neo4j instance on connection.
314316

317+
This setting is only available for URI schemes ``bolt://`` and ``neo4j://`` (:ref:`uri-ref`).
318+
315319
This setting does not have any effect if ``encrypted`` is set to ``False``.
316320

317321
:Type: ``neo4j.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES``, ``neo4j.TRUST_ALL_CERTIFICATES``
@@ -342,6 +346,8 @@ This setting does not have any effect if ``encrypted`` is set to ``False``.
342346
---------------
343347
Specify a custom SSL context to use for wrapping connections.
344348

349+
This setting is only available for URI schemes ``bolt://`` and ``neo4j://`` (:ref:`uri-ref`).
350+
345351
If given, ``encrypted`` and ``trusted_certificates`` have no effect.
346352

347353
.. warning::
@@ -361,6 +367,8 @@ If given, ``encrypted`` and ``trusted_certificates`` have no effect.
361367
------------------------
362368
Specify how to determine the authenticity of encryption certificates provided by the Neo4j instance on connection.
363369

370+
This setting is only available for URI schemes ``bolt://`` and ``neo4j://`` (:ref:`uri-ref`).
371+
364372
This setting does not have any effect if ``encrypted`` is set to ``False`` or a
365373
custom ``ssl_context`` is configured.
366374

src/neo4j/_async/driver.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,20 @@ def driver(
122122
else:
123123

124124
@classmethod
125-
def driver(cls, uri, *, auth=None, **config) -> AsyncDriver:
125+
def driver(
126+
cls, uri: str, *,
127+
auth: t.Union[t.Tuple[t.Any, t.Any], Auth, None] = None,
128+
**config
129+
) -> AsyncDriver:
126130
"""Create a driver.
127131
128-
:param uri: the connection URI for the driver, see :ref:`async-uri-ref` for available URIs.
129-
:param auth: the authentication details, see :ref:`auth-ref` for available authentication details.
130-
:param config: driver configuration key-word arguments, see :ref:`async-driver-configuration-ref` for available key-word arguments.
132+
:param uri: the connection URI for the driver,
133+
see :ref:`async-uri-ref` for available URIs.
134+
:param auth: the authentication details,
135+
see :ref:`auth-ref` for available authentication details.
136+
:param config: driver configuration key-word arguments,
137+
see :ref:`async-driver-configuration-ref` for available
138+
key-word arguments.
131139
"""
132140

133141
driver_type, security_type, parsed = parse_neo4j_uri(uri)

src/neo4j/_sync/driver.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,20 @@ def driver(
119119
else:
120120

121121
@classmethod
122-
def driver(cls, uri, *, auth=None, **config) -> Driver:
122+
def driver(
123+
cls, uri: str, *,
124+
auth: t.Union[t.Tuple[t.Any, t.Any], Auth, None] = None,
125+
**config
126+
) -> Driver:
123127
"""Create a driver.
124128
125-
:param uri: the connection URI for the driver, see :ref:`uri-ref` for available URIs.
126-
:param auth: the authentication details, see :ref:`auth-ref` for available authentication details.
127-
:param config: driver configuration key-word arguments, see :ref:`driver-configuration-ref` for available key-word arguments.
129+
:param uri: the connection URI for the driver,
130+
see :ref:`uri-ref` for available URIs.
131+
:param auth: the authentication details,
132+
see :ref:`auth-ref` for available authentication details.
133+
:param config: driver configuration key-word arguments,
134+
see :ref:`driver-configuration-ref` for available
135+
key-word arguments.
128136
"""
129137

130138
driver_type, security_type, parsed = parse_neo4j_uri(uri)

0 commit comments

Comments
 (0)