Skip to content

Commit af386ac

Browse files
4.0 api docs (#363)
* renamed readme and removed aio.rst * changed theme to read the docs * changed readme to be markdown * updated the index to include breaking changes * updated breaking changes about renaming * Updated docs * the docs is building ok now. * added more patterns * improved index Renamed the headline to be Neo4j Python Driver Added the Bolt Protocol Version information for the supported Neo4j versions. * added link to migration guide on index page
1 parent 2a72d8c commit af386ac

File tree

11 files changed

+434
-57
lines changed

11 files changed

+434
-57
lines changed

docs/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
====================
2+
Sphinx Documentation
3+
====================
4+
5+
```
6+
pip install -r requirements.txt
7+
```
8+
9+
```
10+
make -C docs html
11+
```
12+

docs/README.rst

Lines changed: 0 additions & 10 deletions
This file was deleted.

docs/requirements.txt

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

docs/source/aio.rst

Lines changed: 0 additions & 2 deletions
This file was deleted.

docs/source/conf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import sys
1717
import os
1818
import shlex
19+
import sphinx_rtd_theme
1920

2021
# If extensions (or modules to document with autodoc) are in another directory,
2122
# add these directories to sys.path here. If the directory is relative to the
@@ -38,6 +39,7 @@
3839
'sphinx.ext.coverage',
3940
'sphinx.ext.ifconfig',
4041
'sphinx.ext.intersphinx',
42+
"sphinx_rtd_theme",
4143
]
4244

4345
# Add any paths that contain templates here, relative to this directory.
@@ -118,7 +120,8 @@
118120

119121
# The theme to use for HTML and HTML Help pages. See the documentation for
120122
# a list of builtin themes.
121-
html_theme = 'nature'
123+
# html_theme = 'nature'
124+
html_theme = "sphinx_rtd_theme"
122125

123126
# Theme options are theme-specific and customize the look and feel of a theme
124127
# further. For a list of options available for each theme, see the
@@ -302,6 +305,5 @@ def setup(app):
302305

303306
intersphinx_mapping = {
304307
'python': ('https://docs.python.org/3', None),
305-
'neobolt': ('https://neobolt.readthedocs.io/en/latest/', None),
306308
'neotime': ('https://neotime.readthedocs.io/en/latest/', None),
307309
}

docs/source/index.rst

Lines changed: 123 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,107 @@
1-
**************************************
2-
Neo4j Bolt Driver |version| for Python
3-
**************************************
1+
#############################
2+
Neo4j Python Driver |version|
3+
#############################
44

5-
The Official Neo4j Driver for Python supports Neo4j 3.2 and above and requires Python version 2.7 or 3.4+.
6-
Note that support for Python 2.7 will be removed in the 2.0 driver.
5+
.. warning::
6+
This API docs is not production ready!
77

88

9+
The Official Neo4j Driver for Python.
10+
11+
Neo4j versions supported:
12+
13+
* Neo4j 4.0 - Using the Bolt Protocol Version 4.0
14+
* Neo4j 3.5 - Using the Bolt Protocol Version 3
15+
16+
Python versions supported:
17+
18+
* Python 3.8
19+
* Python 3.7
20+
* Python 3.6
21+
* Python 3.5
22+
23+
24+
**Note:** Python 2.7 support has been dropped.
25+
26+
.. note::
27+
The driver may still work with older versions of python.
28+
29+
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.
31+
32+
33+
****************
34+
Breaking Changes
35+
****************
36+
37+
Version Scheme Changes
38+
======================
39+
40+
The version number have jumped from :code:`1.7` to :code:`Python Driver 4.0` to align with the Neo4j Database version scheme.
41+
42+
43+
Namespace Changes
44+
=================
45+
46+
:code:`import neo4j.v1` have changed namespace to be :code:`import neo4j`
47+
48+
49+
Secure Connection
50+
=================
51+
52+
Neo4j 4.0 is by default configured to use a non secure connection.
53+
54+
The Driver Configuration argument :code:`encrypted` is by default set to :code:`False`.
55+
56+
To be able to connect to Neo4j 3.5 set :code:`encrypted=True` to have it configured as the default for that setup.
57+
58+
59+
Bookmark Changes
60+
================
61+
62+
Bookmarks is now a Bookmark class instead of a string.
63+
64+
65+
Exceptions Changes
66+
==================
67+
68+
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.
69+
70+
71+
URI Changes
72+
===========
73+
74+
`bolt+routing` have been renamed to `neo4j`
75+
76+
77+
Class Renaming Changes
78+
======================
79+
80+
* :code:`BoltStatementResult` is now :code:`Result`
81+
* :code:`StatementResultSummary` is now :code:`ResultSummary`
82+
* :code:`Statement` is now :code:`Query`
83+
84+
85+
Argument Renaming Changes
86+
=========================
87+
88+
* :code:`statement` is now :code:`query`
89+
* :code:`cypher` is now :code:`query`
90+
* :code:`Session.run(cypher, ...` is now :code:`Session.run(query, ...`
91+
* :code:`Transaction.run(statement, ...` is now :code:`Transaction.run(query, ...`
92+
* :code:`StatementResultSummary.statement` is now :code:`ResultSummary.query`
93+
* :code:`StatementResultSummary.statement_type` is now :code:`ResultSummary.query_type`
94+
95+
96+
Dependency Changes
97+
==================
98+
99+
The dependency :code:`neobolt` have been removed.
100+
101+
102+
*************
9103
Quick Example
10-
=============
104+
*************
11105

12106
.. code-block:: python
13107
@@ -26,45 +120,50 @@ Quick Example
26120
session.read_transaction(print_friends_of, "Alice")
27121
28122
29-
.. note::
30-
31-
While imports from ``neo4j.v1`` still work, these will be removed in the 2.0 driver.
32-
It is therefore recommended to change all imports from ``neo4j.v1`` to ``neo4j``.
33-
34-
123+
************
35124
Installation
36-
============
125+
************
37126

38127
To install the latest stable driver release, use:
39128

40129
.. code:: bash
41130
42-
pip install neo4j
43-
44-
.. note::
45-
46-
The driver is currently released under two package names on `PyPI <https://pypi.org/>`_: ``neo4j`` and ``neo4j-driver``.
47-
Installing from ``neo4j`` is recommended since ``neo4j-driver`` will be removed in a future release.
131+
python -m pip install neo4j
48132
49133
134+
*****************
50135
API Documentation
51-
=================
136+
*****************
52137

53138
.. toctree::
54139
:maxdepth: 1
55140

56-
aio
141+
driver
142+
errors
143+
results
144+
transactions
145+
usage_patterns
146+
types/core
147+
types/graph
148+
types/spatial
149+
types/temporal
57150

58151

152+
*****************
59153
Other Information
60-
=================
154+
*****************
61155

62-
* `Neo4j Manual`_
156+
* `Neo4j Documentation`_
157+
* `The Neo4j Drivers Manual`_
63158
* `Neo4j Quick Reference Card`_
64159
* `Example Project`_
65160
* `Driver Wiki`_ (includes change logs)
161+
* `Migration Guide - Upgrade Neo4j drivers`_
66162

67-
.. _`Neo4j Manual`: https://neo4j.com/docs/
163+
.. _`Python Driver 1.7`: https://neo4j.com/docs/api/python-driver/1.7/
164+
.. _`Neo4j Documentation`: https://neo4j.com/docs/
165+
.. _`The Neo4j Drivers Manual`: https://neo4j.com/docs/driver-manual/current/
68166
.. _`Neo4j Quick Reference Card`: https://neo4j.com/docs/cypher-refcard/current/
69167
.. _`Example Project`: https://github.com/neo4j-examples/movies-python-bolt
70168
.. _`Driver Wiki`: https://github.com/neo4j/neo4j-python-driver/wiki
169+
.. _`Migration Guide - Upgrade Neo4j drivers`: https://neo4j.com/docs/migration-guide/4.0/upgrade-driver/

docs/source/results.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
Consuming Results
33
*****************
44

5-
Every time Cypher is executed, a :class:`neo4j.Result` is returned.
5+
Every time a query is executed, a :class:`.Result` is returned.
6+
67
This provides a handle to the result of the query, giving access to the records within it as well as the result metadata.
78

89
Each result consists of header metadata, zero or more :class:`.Record` objects and footer metadata (the summary).
910
Results also contain a buffer that automatically stores unconsumed records when results are consumed out of order.
10-
A :class:`neo4j.Result` is attached to an active connection, through a :class:`.Session`, until all its content has been buffered or consumed.
1111

12-
.. class:: neo4j.Result
12+
A :class:`.Result` is attached to an active connection, through a :class:`.Session`, until all its content has been buffered or consumed.
13+
14+
.. class:: .Result
1315

1416
.. describe:: iter(result)
1517

@@ -40,7 +42,7 @@ A :class:`neo4j.Result` is attached to an active connection, through a :class:`.
4042
.. automethod:: data
4143

4244

43-
.. class:: neo4j.Record
45+
.. class:: .Record
4446

4547
A :class:`.Record` is an immutable ordered collection of key-value
4648
pairs. It is generally closer to a :py:class:`namedtuple` than to a
@@ -103,8 +105,8 @@ A :class:`neo4j.Result` is attached to an active connection, through a :class:`.
103105
Summary Details
104106
---------------
105107

106-
.. autoclass:: neo4j.ResultSummary
108+
.. autoclass:: .ResultSummary
107109
:members:
108110

109-
.. autoclass:: neo4j.SummaryCounters
111+
.. autoclass:: .SummaryCounters
110112
:members:

docs/source/transactions.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ For example::
2525

2626
To construct a :class:`.Session` use the :meth:`.Driver.session` method.
2727

28-
.. class:: neo4j.Session
28+
.. class:: .Session
2929

3030
.. automethod:: close
3131

@@ -75,7 +75,7 @@ Explicit transactions support multiple statements and must be created with an ex
7575
This creates a new :class:`.Transaction` object that can be used to run Cypher.
7676
It also gives applications the ability to directly control `commit` and `rollback` activity.
7777

78-
.. class:: neo4j.Transaction
78+
.. class:: .Transaction
7979

8080
.. automethod:: run
8181

@@ -127,7 +127,7 @@ Returning a live result object would prevent the driver from correctly managing
127127
128128
To exert more control over how a transaction function is carried out, the :func:`.unit_of_work` decorator can be used.
129129

130-
.. autofunction:: neo4j.unit_of_work
130+
.. autofunction:: neo4j.work.simple.unit_of_work
131131

132132

133133
Access modes
@@ -140,7 +140,7 @@ Note that this mode is simply a default and not a constraint.
140140
This means that transaction functions within a session can override the access mode passed to that session on construction.
141141

142142
.. note::
143-
The driver does not parse Cypher statements and cannot determine whether a statement tagged as `read` or `write` is tagged correctly.
144-
Since the access mode is not passed to the server, this can allow a `write` statement to be executed in a `read` call on a single instance.
143+
The driver does not parse Cypher queries and cannot determine whether the access mode should be :code:`ACCESS_READ` or :code:`ACCESS_WRITE`.
144+
Since the access mode is not passed to the server, this can allow a :code:`ACCESS_WRITE` statement to be executed for a :code:`ACCESS_READ` call on a single instance.
145145
Clustered environments are not susceptible to this loophole as cluster roles prevent it.
146146
This behaviour should not be relied upon as the loophole may be closed in a future release.

docs/source/types/graph.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ Relationship :class:`.Relationship`
1818
Path :class:`.Path`
1919
============= ======================
2020

21-
.. class:: neo4j.types.graph.Graph
21+
.. class:: neo4j.graph.Graph
2222

2323
A local, self-contained graph object that acts as a container for :class:`.Node` and :class:`.Relationship` instances.
24-
This is typically obtained via the :meth:`neo4j.Result.graph` method.
24+
This is typically obtained via the :meth:`.Result.graph` method.
2525

2626
.. autoattribute:: nodes
2727

@@ -30,7 +30,7 @@ Path :class:`.Path`
3030
.. automethod:: relationship_type
3131

3232

33-
.. class:: neo4j.types.graph.Node
33+
.. class:: neo4j.graph.Node
3434

3535
.. describe:: node == other
3636

@@ -76,7 +76,7 @@ Path :class:`.Path`
7676
.. automethod:: items
7777

7878

79-
.. class:: neo4j.types.graph.Relationship
79+
.. class:: neo4j.graph.Relationship
8080

8181
.. describe:: relationship == other
8282

@@ -133,7 +133,7 @@ Path :class:`.Path`
133133
.. automethod:: items
134134

135135

136-
.. class:: neo4j.types.graph.Path
136+
.. class:: neo4j.graph.Path
137137

138138
.. describe:: path == other
139139

docs/source/types/spatial.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ Cypher Type Python Type
88
Point :class:`.Point`
99
============= ======================
1010

11-
.. autoclass:: neo4j.types.spatial.Point
11+
.. autoclass:: neo4j.spatial.Point
1212
:members:
1313

14-
.. autoclass:: neo4j.types.spatial.CartesianPoint
14+
.. autoclass:: neo4j.spatial.CartesianPoint
1515
:members:
1616
:inherited-members:
1717

18-
.. autoclass:: neo4j.types.spatial.WGS84Point
18+
.. autoclass:: neo4j.spatial.WGS84Point
1919
:members:
2020
:inherited-members:

0 commit comments

Comments
 (0)