Skip to content

API docs: be more explicit about driver factory parameters #883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The :class:`neo4j.Driver` construction is done via a ``classmethod`` on the :cla
.. autoclass:: neo4j.GraphDatabase
:members: bookmark_manager

.. method:: driver
.. automethod:: driver

Driver creation example:

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

This setting is only available for URI schemes ``bolt://`` and ``neo4j://`` (:ref:`uri-ref`).

This setting does not have any effect if a custom ``ssl_context`` is configured.

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

This setting is only available for URI schemes ``bolt://`` and ``neo4j://`` (:ref:`uri-ref`).

This setting does not have any effect if ``encrypted`` is set to ``False``.

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

This setting is only available for URI schemes ``bolt://`` and ``neo4j://`` (:ref:`uri-ref`).

If given, ``encrypted`` and ``trusted_certificates`` have no effect.

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

This setting is only available for URI schemes ``bolt://`` and ``neo4j://`` (:ref:`uri-ref`).

This setting does not have any effect if ``encrypted`` is set to ``False`` or a
custom ``ssl_context`` is configured.

Expand Down
16 changes: 12 additions & 4 deletions src/neo4j/_async/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,20 @@ def driver(
else:

@classmethod
def driver(cls, uri, *, auth=None, **config) -> AsyncDriver:
def driver(
cls, uri: str, *,
auth: t.Union[t.Tuple[t.Any, t.Any], Auth, None] = None,
**config
) -> AsyncDriver:
"""Create a driver.

:param uri: the connection URI for the driver, see :ref:`async-uri-ref` for available URIs.
:param auth: the authentication details, see :ref:`auth-ref` for available authentication details.
:param config: driver configuration key-word arguments, see :ref:`async-driver-configuration-ref` for available key-word arguments.
:param uri: the connection URI for the driver,
see :ref:`async-uri-ref` for available URIs.
:param auth: the authentication details,
see :ref:`auth-ref` for available authentication details.
:param config: driver configuration key-word arguments,
see :ref:`async-driver-configuration-ref` for available
key-word arguments.
"""

driver_type, security_type, parsed = parse_neo4j_uri(uri)
Expand Down
16 changes: 12 additions & 4 deletions src/neo4j/_sync/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,20 @@ def driver(
else:

@classmethod
def driver(cls, uri, *, auth=None, **config) -> Driver:
def driver(
cls, uri: str, *,
auth: t.Union[t.Tuple[t.Any, t.Any], Auth, None] = None,
**config
) -> Driver:
"""Create a driver.

:param uri: the connection URI for the driver, see :ref:`uri-ref` for available URIs.
:param auth: the authentication details, see :ref:`auth-ref` for available authentication details.
:param config: driver configuration key-word arguments, see :ref:`driver-configuration-ref` for available key-word arguments.
:param uri: the connection URI for the driver,
see :ref:`uri-ref` for available URIs.
:param auth: the authentication details,
see :ref:`auth-ref` for available authentication details.
:param config: driver configuration key-word arguments,
see :ref:`driver-configuration-ref` for available
key-word arguments.
"""

driver_type, security_type, parsed = parse_neo4j_uri(uri)
Expand Down