Skip to content

Commit dde86a9

Browse files
authored
Merge pull request #268 from technige/1.7-api-docs
[1.7.1] Updates for API docs
2 parents 6dcbc18 + 02fecd6 commit dde86a9

File tree

13 files changed

+504
-124
lines changed

13 files changed

+504
-124
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22

3-
HOME=$(dirname $0)
3+
ROOT=$(dirname "$0")/..
44

5-
pip install --upgrade sphinx
6-
make -C ${HOME}/docs html
5+
pip install --quiet --upgrade sphinx
6+
make -C ${ROOT}/docs html
77

88
echo ""
9-
INDEX_FILE="${HOME}/docs/build/html/index.html"
9+
INDEX_FILE="${ROOT}/docs/build/html/index.html"
1010
echo "Documentation index file can be found at file://$(cd "$(dirname "${INDEX_FILE}")"; pwd)/$(basename "${INDEX_FILE}")"

docs/source/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
'sphinx.ext.todo',
3838
'sphinx.ext.coverage',
3939
'sphinx.ext.ifconfig',
40-
'sphinx.ext.viewcode',
4140
'sphinx.ext.intersphinx',
4241
]
4342

docs/source/driver.rst

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ Construction
1313
:class:`.Driver` construction can either be carried out directly or via a `classmethod` on the :class:`.GraphDatabase` class.
1414

1515
.. autoclass:: neo4j.GraphDatabase
16-
:members:
16+
:members: driver
1717

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

2121

2222
URI
@@ -37,14 +37,7 @@ URI scheme:
3737
Driver subclass:
3838
:class:`.DirectDriver`
3939

40-
A Bolt :class:`.DirectDriver` is used to target a single machine.
41-
This may be a standalone server or could be a specific member of a cluster.
42-
43-
Connections established by a :class:`.DirectDriver` are always made to the exact host and port detailed in the URI.
44-
4540
.. autoclass:: neo4j.DirectDriver
46-
:members:
47-
:inherited-members:
4841

4942

5043
Bolt Routing
@@ -56,8 +49,6 @@ Driver subclass:
5649
:class:`.RoutingDriver`
5750

5851
.. autoclass:: neo4j.RoutingDriver
59-
:members:
60-
:inherited-members:
6152

6253

6354
Configuration

docs/source/errors.rst

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,42 @@
22
Errors
33
******
44

5-
.. autoclass:: neo4j.exceptions.CypherError
6-
:members:
75

8-
.. autoclass:: neo4j.exceptions.ProtocolError
9-
:members:
6+
Connectivity errors
7+
===================
108

11-
.. autoclass:: neo4j.exceptions.SecurityError
12-
:members:
9+
.. class:: neo4j.exceptions.ServiceUnavailable
1310

14-
.. autoclass:: neo4j.exceptions.ServiceUnavailable
15-
:members:
11+
Raised when a database server or service is not available.
12+
This may be due to incorrect configuration or could indicate a runtime failure of a database service that the driver is unable to route around.
13+
14+
.. class:: neo4j.exceptions.SecurityError
15+
16+
Raised when a security issue occurs, generally around TLS or authentication.
17+
18+
19+
Cypher execution errors
20+
=======================
21+
22+
.. class:: neo4j.exceptions.CypherError
23+
24+
Raised when the Cypher engine returns an error to the client.
25+
There are many possible types of Cypher error, each identified by a unique `status code <https://neo4j.com/docs/developer-manual/current/reference/status-codes/>`_.
26+
27+
The three classifications of status code are supported by the three subclasses of :class:`.CypherError`, listed below:
1628

1729
.. autoclass:: neo4j.exceptions.ClientError
18-
:show-inheritance:
19-
:members:
2030

2131
.. autoclass:: neo4j.exceptions.DatabaseError
22-
:show-inheritance:
23-
:members:
2432

2533
.. autoclass:: neo4j.exceptions.TransientError
26-
:show-inheritance:
27-
:members:
34+
35+
36+
Low-level errors
37+
================
38+
39+
.. class:: neo4j.exceptions.ProtocolError
40+
41+
Raised when an unexpected or unsupported protocol event occurs.
42+
This error generally indicates a fault with the driver or server software.
43+
If you receive this error, please raise a GitHub issue or a support ticket.

docs/source/index.rst

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
Neo4j Bolt Driver |version| for Python
33
**************************************
44

5-
The Official Neo4j Driver for Python supports Neo4j 3.1 and above and requires Python version 2.7, 3.4, 3.5 or 3.6.
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.
67

78

89
Quick Example
@@ -25,20 +26,25 @@ Quick Example
2526
session.read_transaction(print_friends_of, "Alice")
2627
2728
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+
2835
Installation
2936
============
3037

31-
To install the latest stable version, use:
38+
To install the latest stable driver release, use:
3239

3340
.. code:: bash
3441
3542
pip install neo4j
3643
37-
For the most up-to-date version (possibly unstable), use:
38-
39-
.. code:: bash
44+
.. note::
4045

41-
pip install git+https://github.com/neo4j/neo4j-python-driver.git#egg=neo4j
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.
4248

4349

4450
API Documentation

docs/source/results.rst

Lines changed: 88 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,95 @@ Each result consists of header metadata, zero or more :class:`.Record` objects a
99
Results also contain a buffer that automatically stores unconsumed records when results are consumed out of order.
1010
A :class:`.BoltStatementResult` is attached to an active connection, through a :class:`.Session`, until all its content has been buffered or consumed.
1111

12-
.. autoclass:: neo4j.BoltStatementResult
13-
:inherited-members:
14-
:members:
12+
.. class:: neo4j.BoltStatementResult
1513

16-
.. autoclass:: neo4j.Record
17-
:members:
14+
.. describe:: iter(result)
15+
16+
.. autoattribute:: session
17+
18+
.. automethod:: attached
19+
20+
.. automethod:: detach
21+
22+
.. automethod:: keys
23+
24+
.. automethod:: records
25+
26+
.. automethod:: summary
27+
28+
.. automethod:: consume
29+
30+
.. automethod:: single
31+
32+
.. automethod:: peek
33+
34+
.. automethod:: graph
35+
36+
.. automethod:: value
37+
38+
.. automethod:: values
39+
40+
.. automethod:: data
41+
42+
43+
.. class:: neo4j.Record
44+
45+
A :class:`.Record` is an immutable ordered collection of key-value
46+
pairs. It is generally closer to a :py:class:`namedtuple` than to a
47+
:py:class:`OrderedDict` inasmuch as iteration of the collection will
48+
yield values rather than keys.
49+
50+
.. describe:: Record(iterable)
51+
52+
Create a new record based on an dictionary-like iterable.
53+
This can be a dictionary itself, or may be a sequence of key-value pairs, each represented by a tuple.
54+
55+
.. describe:: record == other
56+
57+
Compare a record for equality with another value.
58+
The `other` value may be any `Sequence` or `Mapping`, or both.
59+
If comparing with a `Sequence`, the values are compared in order.
60+
If comparing with a `Mapping`, the values are compared based on their keys.
61+
If comparing with a value that exhibits both traits, both comparisons must be true for the values to be considered equal.
62+
63+
.. describe:: record != other
64+
65+
Compare a record for inequality with another value.
66+
See above for comparison rules.
67+
68+
.. describe:: hash(record)
69+
70+
Create a hash for this record.
71+
This will raise a :exc:`TypeError` if any values within the record are unhashable.
72+
73+
.. describe:: record[index]
74+
75+
Obtain a value from the record by index.
76+
This will raise an :exc:`IndexError` if the specified index is out of range.
77+
78+
.. describe:: record[i:j]
79+
80+
Derive a sub-record based on a start and end index.
81+
All keys and values within those bounds will be copied across in the same order as in the original record.
82+
83+
.. describe:: record[key]
84+
85+
Obtain a value from the record by key.
86+
This will raise a :exc:`KeyError` if the specified key does not exist.
87+
88+
.. automethod:: get(key, default=None)
89+
90+
.. automethod:: value(key=0, default=None)
91+
92+
.. automethod:: index(key)
93+
94+
.. automethod:: keys
95+
96+
.. automethod:: values
97+
98+
.. automethod:: items
99+
100+
.. automethod:: data
18101

19102

20103
Summary Details

0 commit comments

Comments
 (0)