Skip to content

Commit 77de926

Browse files
fixed api docs (#370)
neotime references was changed to neo4j.time improved the index, conf and driver sections for API docs
1 parent efd131f commit 77de926

File tree

7 files changed

+149
-104
lines changed

7 files changed

+149
-104
lines changed

docs/requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
neotime
21
sphinx
3-
sphinx-rtd-theme

docs/source/conf.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
'sphinx.ext.coverage',
4040
'sphinx.ext.ifconfig',
4141
'sphinx.ext.intersphinx',
42-
"sphinx_rtd_theme",
4342
]
4443

4544
# Add any paths that contain templates here, relative to this directory.
@@ -57,7 +56,7 @@
5756
master_doc = 'index'
5857

5958
# General information about the project.
60-
project = 'Neo4j Bolt Driver for Python'
59+
project = 'Neo4j Python Driver'
6160
copyright = '2002-2020, Neo Technology'
6261
author = 'Neo Technology'
6362

@@ -120,8 +119,7 @@
120119

121120
# The theme to use for HTML and HTML Help pages. See the documentation for
122121
# a list of builtin themes.
123-
# html_theme = 'nature'
124-
html_theme = "sphinx_rtd_theme"
122+
html_theme = 'nature'
125123

126124
# Theme options are theme-specific and customize the look and feel of a theme
127125
# further. For a list of options available for each theme, see the
@@ -133,7 +131,7 @@
133131

134132
# The name for this set of Sphinx documents. If None, it defaults to
135133
# "<project> v<release> documentation".
136-
html_title = "Neo4j Bolt Driver %s for Python" % version
134+
html_title = "Neo4j Python Driver {}".format(version)
137135

138136
# A shorter title for the navigation bar. Default is the same as html_title.
139137
#html_short_title = None
@@ -305,5 +303,4 @@ def setup(app):
305303

306304
intersphinx_mapping = {
307305
'python': ('https://docs.python.org/3', None),
308-
'neotime': ('https://neotime.readthedocs.io/en/latest/', None),
309306
}

docs/source/driver.rst

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,67 @@
22
Driver Objects
33
==============
44

5-
Every Neo4j-backed application will require a :class:`.Driver` object.
5+
Every Neo4j-backed application will require a :class:`neo4j.Driver` object.
66
This object holds the details required to establish connections with a Neo4j database, including server URIs, credentials and other configuration.
7-
:class:`.Driver` objects hold a connection pool from which :class:`.Session` objects can borrow connections.
7+
:class:`neo4j.Driver` objects hold a connection pool from which :class:`neo4j.Session` objects can borrow connections.
88
Closing a driver will immediately shut down all connections in the pool.
99

1010
Construction
1111
============
1212

13-
:class:`.Driver` construction can either be carried out directly or via a `classmethod` on the :class:`.GraphDatabase` class.
13+
:class:`neo4j.Driver` construction can either be carried out directly or via a `classmethod` on the :class:`neo4j.GraphDatabase` class.
1414

1515
.. autoclass:: neo4j.GraphDatabase
1616
:members: driver
1717

18-
.. autoclass:: neo4j.Driver(uri, **config)
18+
.. autoclass:: neo4j.Driver()
1919
:members: session, close, closed
2020

2121

2222
URI
2323
===
2424

25-
On construction, the scheme of the URI determines the type of :class:`.Driver` object created.
26-
Each supported scheme maps to a particular :class:`.Driver` subclass that implements a specific behaviour.
27-
The remainder of the URI should be considered subclass-specific.
25+
On construction, the `scheme` of the URI determines the type of :class:`neo4j.Driver` object created.
26+
27+
Example URI::
28+
29+
uri = bolt://localhost:7676
30+
31+
Example URI::
32+
33+
uri = neo4j://localhost:7676
34+
35+
Each supported scheme maps to a particular :class:`neo4j.Driver` subclass that implements a specific behaviour.
2836

2937
The alternative behaviours are described in the subsections below.
3038

3139

32-
Bolt Direct
33-
-----------
40+
BoltDriver
41+
----------
3442

35-
URI scheme:
36-
``bolt``
43+
URI schemes:
44+
``bolt``, ``bolt+ssc``, ``bolt+s``
3745
Driver subclass:
38-
:class:`.BoltDriver`
46+
:class:`neo4j.BoltDriver`
3947

4048
.. autoclass:: neo4j.BoltDriver
4149

4250

43-
Bolt Routing
51+
Neo4jDriver
4452
------------
4553

46-
URI scheme:
47-
``neo4j``
54+
URI schemes:
55+
``neo4j``, ``neo4j+ssc``, ``neo4j+s``
4856
Driver subclass:
49-
:class:`.Neo4jDriver`
57+
:class:`neo4j.Neo4jDriver`
5058

5159
.. autoclass:: neo4j.Neo4jDriver
5260

5361

5462
Configuration
5563
=============
5664

57-
Additional configuration, including authentication details, can be provided via the :class:`.Driver` constructor.
65+
Additional configuration, including authentication details, can be provided via the :class:`neo4j.Driver` constructor.
5866

5967
``auth``
6068
--------
@@ -71,14 +79,18 @@ Alternatively, one of the auth token functions can be used.
7179
-------------
7280

7381
A boolean indicating whether or not TLS should be used for connections.
74-
Defaults to :py:const:`True` if TLS is available.
82+
83+
:Type: ``bool``
84+
:Default: :py:const:`True`
85+
7586

7687
``trust``
7788
---------
7889

7990
The trust level for certificates received from the server during TLS negotiation.
8091
This setting does not have any effect if ``encrypted`` is set to :py:const:`False`.
8192

93+
8294
.. py:attribute:: neo4j.TRUST_ALL_CERTIFICATES
8395
8496
Trust any server certificate (default). This ensures that communication
@@ -92,6 +104,8 @@ This setting does not have any effect if ``encrypted`` is set to :py:const:`Fals
92104
certificate authority. This option is primarily intended for use with
93105
full certificates.
94106

107+
:Default: ``neo4j.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES``.
108+
95109
``user_agent``
96110
--------------
97111

@@ -149,7 +163,7 @@ For example::
149163
Object Lifetime
150164
===============
151165

152-
For general applications, it is recommended to create one top-level :class:`.Driver` object that lives for the lifetime of the application.
166+
For general applications, it is recommended to create one top-level :class:`neo4j.Driver` object that lives for the lifetime of the application.
153167
For example:
154168

155169
.. code-block:: python
@@ -164,10 +178,10 @@ For example:
164178
def close(self):
165179
self.driver.close()
166180
167-
Connection details held by the :class:`.Driver` are immutable.
168-
Therefore if, for example, a password is changed, a replacement :class:`.Driver` object must be created.
181+
Connection details held by the :class:`neo4j.Driver` are immutable.
182+
Therefore if, for example, a password is changed, a replacement :class:`neo4j.Driver` object must be created.
169183
More than one :class:`.Driver` may be required if connections to multiple databases, or connections as multiple users, are required.
170184

171-
:class:`.Driver` objects are thread-safe but cannot be shared across processes.
185+
:class:`neo4j.Driver` objects are thread-safe but cannot be shared across processes.
172186
Therefore, ``multithreading`` should generally be preferred over ``multiprocessing`` for parallel database access.
173-
If using ``multiprocessing`` however, each process will require its own :class:`.Driver` object.
187+
If using ``multiprocessing`` however, each process will require its own :class:`neo4j.Driver` object.

docs/source/index.rst

Lines changed: 72 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,55 @@ Python versions supported:
2727
The driver may still work with older versions of python.
2828

2929
The previous driver `Python Driver 1.7`_ supports older versions of python,
30-
the Neo4j 4.0 will work in fallback mode (using Bolt Protocol Version 3) with that driver.
30+
the **Neo4j 4.0** will work in fallback mode (using Bolt Protocol Version 3) with that driver.
31+
32+
*************
33+
Quick Example
34+
*************
35+
36+
.. code-block:: python
37+
38+
from neo4j import GraphDatabase
39+
40+
uri = "bolt://localhost:7687"
41+
driver = GraphDatabase.driver(uri, auth=("neo4j", "password"))
42+
43+
def print_friends_of(tx, name):
44+
for record in tx.run("MATCH (a:Person)-[:KNOWS]->(f) "
45+
"WHERE a.name = {name} "
46+
"RETURN f.name", name=name):
47+
print(record["f.name"])
48+
49+
with driver.session() as session:
50+
session.read_transaction(print_friends_of, "Alice")
51+
52+
driver.close()
53+
54+
55+
************
56+
Installation
57+
************
58+
59+
To install the latest stable driver release, use:
60+
61+
.. code:: bash
62+
63+
python -m pip install neo4j
64+
65+
66+
**Note:** It is always recommended to install python packages for user space in a virtual environment.
67+
68+
.. code:: bash
69+
70+
python -m venv sandbox
71+
72+
.. code:: bash
73+
74+
source sandbox/bin/activate
75+
76+
.. code:: bash
77+
78+
deactivate
3179
3280
3381
****************
@@ -37,23 +85,38 @@ Breaking Changes
3785
Version Scheme Changes
3886
======================
3987

40-
The version number have jumped from :code:`1.7` to :code:`Python Driver 4.0` to align with the Neo4j Database version scheme.
88+
The version number have jumped from **Python Driver 1.7** to **Python Driver 4.0** to align with the Neo4j Database version scheme.
4189

4290

4391
Namespace Changes
4492
=================
4593

46-
:code:`import neo4j.v1` have changed namespace to be :code:`import neo4j`
94+
.. code-block:: python
95+
96+
import neo4j.v1
97+
98+
Have changed to
99+
100+
.. code-block:: python
101+
102+
import neo4j
47103
48104
49105
Secure Connection
50106
=================
51107

52-
Neo4j 4.0 is by default configured to use a non secure connection.
108+
**Neo4j 4.0** is by default configured to use a **non secure connection**.
109+
110+
The driver configuration argument :code:`encrypted` is by default set to :code:`False`.
53111

54-
The Driver Configuration argument :code:`encrypted` is by default set to :code:`False`.
112+
**Note:** To be able to connect to **Neo4j 3.5** set :code:`encrypted=True` to have it configured as the default for that setup.
55113

56-
To be able to connect to Neo4j 3.5 set :code:`encrypted=True` to have it configured as the default for that setup.
114+
.. code-block:: python
115+
116+
from neo4j import GraphDatabase
117+
118+
driver = GraphDatabase("bolt://localhost:7687", auth=("neo4j", "password"), encrypted=True)
119+
driver.close()
57120
58121
59122
Bookmark Changes
@@ -68,10 +131,10 @@ Exceptions Changes
68131
The exceptions in :code:`neo4j.exceptions` have been updated and there is internal exceptions starting with the naming :code:`Bolt` that should be propagated into the exceptions API.
69132

70133

71-
URI Changes
72-
===========
134+
URI Scheme Changes
135+
==================
73136

74-
`bolt+routing` have been renamed to `neo4j`
137+
**bolt+routing** have been renamed to **neo4j**.
75138

76139

77140
Class Renaming Changes
@@ -99,37 +162,8 @@ Dependency Changes
99162
The dependency :code:`neobolt` have been removed.
100163

101164

102-
*************
103-
Quick Example
104-
*************
105-
106-
.. code-block:: python
107-
108-
from neo4j import GraphDatabase
109-
110-
uri = "bolt://localhost:7687"
111-
driver = GraphDatabase.driver(uri, auth=("neo4j", "password"))
112-
113-
def print_friends_of(tx, name):
114-
for record in tx.run("MATCH (a:Person)-[:KNOWS]->(f) "
115-
"WHERE a.name = {name} "
116-
"RETURN f.name", name=name):
117-
print(record["f.name"])
118-
119-
with driver.session() as session:
120-
session.read_transaction(print_friends_of, "Alice")
121165

122166

123-
************
124-
Installation
125-
************
126-
127-
To install the latest stable driver release, use:
128-
129-
.. code:: bash
130-
131-
python -m pip install neo4j
132-
133167

134168
*****************
135169
API Documentation

docs/source/types/temporal.rst

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
.. py:currentmodule:: neotime
2-
31
===================
42
Temporal Data Types
53
===================
64

7-
Temporal data types are implemented by the `neotime <http://neotime.readthedocs.io/en/latest/>`_ package.
5+
Temporal data types are implemented by the ``neo4j.time``
6+
87
These provide a set of types compliant with ISO-8601 and Cypher, which are similar to those found in the built-in ``datetime`` module.
98
Sub-second values are measured to nanosecond precision and the types are compatible with `pytz <http://pytz.sourceforge.net/>`_.
109

1110
The table below shows the general mappings between Cypher and the temporal types provided by the driver.
1211
In addition, the built-in temporal types can be passed as parameters and will be mapped appropriately.
1312

14-
============= ========================= ================================== ============
15-
Cypher Python driver type Python built-in type ``tzinfo``
16-
============= ========================= ================================== ============
17-
Date :class:`neotime:Date` :class:`python:datetime.date`
18-
Time :class:`neotime:Time` :class:`python:datetime.time` ``not None``
19-
LocalTime :class:`neotime:Time` :class:`python:datetime.time` ``None``
20-
DateTime :class:`neotime:DateTime` :class:`python:datetime.datetime` ``not None``
21-
LocalDateTime :class:`neotime:DateTime` :class:`python:datetime.datetime` ``None``
22-
Duration :class:`neotime:Duration` :class:`python:datetime.timedelta`
23-
============= ========================= ================================== ============
13+
============= ============================ ================================== ============
14+
Cypher Python driver type Python built-in type ``tzinfo``
15+
============= ============================ ================================== ============
16+
Date :class:`neo4j.time:Date` :class:`python:datetime.date`
17+
Time :class:`neo4j.time:Time` :class:`python:datetime.time` ``not None``
18+
LocalTime :class:`neo4j.time:Time` :class:`python:datetime.time` ``None``
19+
DateTime :class:`neo4j.time:DateTime` :class:`python:datetime.datetime` ``not None``
20+
LocalDateTime :class:`neo4j.time:DateTime` :class:`python:datetime.datetime` ``None``
21+
Duration :class:`neo4j.time:Duration` :class:`python:datetime.timedelta`
22+
============= ============================ ================================== ============

0 commit comments

Comments
 (0)