Skip to content

Commit 9e8a3c2

Browse files
robsdedudefbiville
andcommitted
Docs and other suggestions by Florent
Co-authored-by: Florent Biville <florent.biville@neo4j.com>
1 parent 255b321 commit 9e8a3c2

File tree

11 files changed

+24
-74
lines changed

11 files changed

+24
-74
lines changed

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ charset = utf-8
1010
[*.{py,js,rst,txt,sh,bat}]
1111
trim_trailing_whitespace = true
1212

13-
[{Makefile,Drockerfile}]
13+
[{Makefile,Dockerfile}]
1414
trim_trailing_whitespace = true
1515

1616
[*.bat]
17-
end_of_line =crlf
17+
end_of_line = crlf
1818

1919
[*.py]
2020
max_line_length = 79

.pre-commit-config.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,6 @@ repos:
1919
- batch
2020
- id: trailing-whitespace
2121
args: [ --markdown-linebreak-ext=md ]
22-
# - repo: https://github.com/pycqa/flake8
23-
# rev: 4.0.1
24-
# hooks:
25-
# - id: flake8
26-
# additional_dependencies:
27-
# - flake8-bugbear
28-
# - flake8-builtins
29-
# - flake8-docstrings
30-
# - flake8-quotes
31-
# - pep8-naming
3222
- repo: https://github.com/pycqa/isort
3323
rev: 5.10.0
3424
hooks:

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
- Python 3.10 support added
66
- Python 3.6 support has been dropped.
7-
- `Result`, `Session`, and `Transaction`, can no longer be imported from
7+
- `Result`, `Session`, and `Transaction` can no longer be imported from
88
`neo4j.work`. They should've been imported from `neo4j` all along.
99
- Experimental pipelines feature has been removed.
1010
- Experimental async driver has been added.

CONTRIBUTING.md

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ install the pre-commit hooks as described below insted. They will take care of
5858
updating the code if necessary.
5959

6060
Setting up the development environment:
61-
* Install Python 3.6+
61+
* Install Python 3.7+
6262
* Install the requirements
6363
```bash
6464
$ python3 -m pip install -U pip
@@ -69,33 +69,14 @@ Setting up the development environment:
6969
```bash
7070
$ pre-commit install
7171
```
72-
Note that this is not an auto-formatter. It will alter some code, but
73-
mostly it will just complain about non-compliant code.
74-
You can disable a certain check for a single line of code if you think
75-
your code-style if preferable. E.g.
76-
```python
77-
assume_this_line(violates_rule_e123, and_w321) # noqa: E123,W321
78-
```
79-
Or use just `# noqa` to disable all checks for this line.
80-
If you use `# noqa` on its own line, it will disable *all* checks for the
81-
whole file. Don't do that.
82-
To disable certain rules for a whole file, check out
83-
`setup.cfg`.
84-
If you want to run the checks manually, you can do so:
85-
```bash
86-
$ pre-commit run --all-files
87-
# or
88-
$ pre-commit run --file path/to/a/file
89-
```
90-
For more details see [flake8](https://flake8.pycqa.org/).
9172

9273

9374
## Got an idea for a new project?
9475

9576
If you have an idea for a new tool or library, start by talking to other people in the community.
9677
Chances are that someone has a similar idea or may have already started working on it.
9778
The best software comes from getting like minds together to solve a problem.
98-
And we'll do our best to help you promote and co-ordinate your Neo ecosystem projects.
79+
And we'll do our best to help you promote and co-ordinate your Neo4j ecosystem projects.
9980

10081

10182
## Further reading

docs/source/api.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The :class:`neo4j.Driver` construction is done via a `classmethod` on the :class
1717
:members: driver
1818

1919

20-
Example, driver creation:
20+
Driver creation example:
2121

2222
.. code-block:: python
2323
@@ -39,7 +39,7 @@ This will implicitly create a :class:`neo4j.Auth` with a ``scheme="basic"``.
3939
Other authentication methods are described under :ref:`auth-ref`.
4040

4141

42-
Example, with block context:
42+
``with`` block context example:
4343

4444
.. code-block:: python
4545
@@ -331,7 +331,8 @@ For example:
331331
332332
Connection details held by the :class:`neo4j.Driver` are immutable.
333333
Therefore if, for example, a password is changed, a replacement :class:`neo4j.Driver` object must be created.
334-
More than one :class:`.Driver` may be required if connections to multiple databases, or connections as multiple users, are required.
334+
More than one :class:`.Driver` may be required if connections to multiple databases, or connections as multiple users, are required,
335+
unless when using impersonation (:ref:`impersonated-user-ref`).
335336

336337
:class:`neo4j.Driver` objects are thread-safe but cannot be shared across processes.
337338
Therefore, ``multithreading`` should generally be preferred over ``multiprocessing`` for parallel database access.
@@ -371,7 +372,7 @@ All database activity is co-ordinated through two mechanisms: the :class:`neo4j.
371372

372373
A :class:`neo4j.Session` is a logical container for any number of causally-related transactional units of work.
373374
Sessions automatically provide guarantees of causal consistency within a clustered environment but multiple sessions can also be causally chained if required.
374-
Sessions provide the top-level of containment for database activity.
375+
Sessions provide the top level of containment for database activity.
375376
Session creation is a lightweight operation and *sessions are not thread safe*.
376377

377378
Connections are drawn from the :class:`neo4j.Driver` connection pool as required.

docs/source/async_api.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The :class:`neo4j.AsyncDriver` construction is done via a `classmethod` on the :
2323
:members: driver
2424

2525

26-
Example, driver creation:
26+
Driver creation example:
2727

2828
.. code-block:: python
2929
@@ -49,7 +49,7 @@ For basic authentication, ``auth`` can be a simple tuple, for example:
4949
This will implicitly create a :class:`neo4j.Auth` with a ``scheme="basic"``.
5050
Other authentication methods are described under :ref:`auth-ref`.
5151

52-
Example, with block context:
52+
``with`` block context example:
5353

5454
.. code-block:: python
5555
@@ -197,7 +197,8 @@ For example:
197197
198198
Connection details held by the :class:`neo4j.AsyncDriver` are immutable.
199199
Therefore if, for example, a password is changed, a replacement :class:`neo4j.AsyncDriver` object must be created.
200-
More than one :class:`.AsyncDriver` may be required if connections to multiple databases, or connections as multiple users, are required.
200+
More than one :class:`.AsyncDriver` may be required if connections to multiple databases, or connections as multiple users, are required,
201+
unless when using impersonation (:ref:`impersonated-user-ref`).
201202

202203
:class:`neo4j.AsyncDriver` objects are safe to be used in concurrent coroutines.
203204
They are not thread-safe.
@@ -236,7 +237,7 @@ All database activity is co-ordinated through two mechanisms: the :class:`neo4j.
236237

237238
A :class:`neo4j.AsyncSession` is a logical container for any number of causally-related transactional units of work.
238239
Sessions automatically provide guarantees of causal consistency within a clustered environment but multiple sessions can also be causally chained if required.
239-
Sessions provide the top-level of containment for database activity.
240+
Sessions provide the top level of containment for database activity.
240241
Session creation is a lightweight operation and *sessions cannot be shared between coroutines*.
241242

242243
Connections are drawn from the :class:`neo4j.AsyncDriver` connection pool as required.

docs/source/transactions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Sessions automatically provide guarantees of causal consistency within a cluster
1111
Sessions
1212
========
1313

14-
Sessions provide the top-level of containment for database activity.
14+
Sessions provide the top level of containment for database activity.
1515
Session creation is a lightweight operation and sessions are `not` thread safe.
1616

1717
Connections are drawn from the :class:`neo4j.Driver` connection pool as required; an idle session will not hold onto a connection.

neo4j/_async/driver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class AsyncGraphDatabase:
4040

4141
@classmethod
4242
@AsyncUtil.experimental_async(
43-
"neo4j async is in experimental phase. It might be removed or change "
44-
"its API at any time (including patch releases)."
43+
"neo4j async is in experimental phase. It might be removed or changed "
44+
"at any time (including patch releases)."
4545
)
4646
def driver(cls, uri, *, auth=None, **config):
4747
"""Create a driver.

neo4j/_async/io/_bolt.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,9 @@ async def route(self, database=None, imp_user=None, bookmarks=None):
350350
sent to the network, and a response is fetched.
351351
352352
:param database: database for which to fetch a routing table
353+
Requires Bolt 4.0+.
353354
:param imp_user: the user to impersonate
355+
Requires Bolt 4.4+.
354356
:param bookmarks: iterable of bookmark values after which this
355357
transaction should begin
356358
:return: dictionary of raw routing data
@@ -369,7 +371,9 @@ def run(self, query, parameters=None, mode=None, bookmarks=None,
369371
:param metadata: custom metadata dictionary to attach to the transaction
370372
:param timeout: timeout for transaction execution (seconds)
371373
:param db: name of the database against which to begin the transaction
374+
Requires Bolt 4.0+.
372375
:param imp_user: the user to impersonate
376+
Requires Bolt 4.4+.
373377
:param handlers: handler functions passed into the returned Response object
374378
:return: Response object
375379
"""
@@ -407,7 +411,9 @@ def begin(self, mode=None, bookmarks=None, metadata=None, timeout=None,
407411
:param metadata: custom metadata dictionary to attach to the transaction
408412
:param timeout: timeout for transaction execution (seconds)
409413
:param db: name of the database against which to begin the transaction
414+
Requires Bolt 4.0+.
410415
:param imp_user: the user to impersonate
416+
Requires Bolt 4.4+
411417
:param handlers: handler functions passed into the returned Response object
412418
:return: Response object
413419
"""

neo4j/_async_compat/concurrency.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -229,29 +229,3 @@ def notify_all(self):
229229

230230
Condition = threading.Condition
231231
RLock = threading.RLock
232-
233-
234-
# async def main():
235-
# lock = AsyncRLock()
236-
#
237-
# async def say_after(delay, what):
238-
# await asyncio.sleep(delay)
239-
# print(what, repr(lock))
240-
# async with lock:
241-
# print(what, repr(lock))
242-
# async with lock:
243-
# print(what, repr(lock))
244-
# await asyncio.sleep(delay)
245-
# print(what)
246-
#
247-
# task_1 = asyncio.create_task(say_after(0.5, "1"))
248-
# task_2 = asyncio.create_task(say_after(0.5, "2"))
249-
# task_3 = asyncio.create_task(say_after(0.5, "3"))
250-
#
251-
# await task_1
252-
# await task_2
253-
# await task_3
254-
#
255-
#
256-
# if __name__ == "__main__":
257-
# asyncio.run(main())

setup.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,3 @@ multi_line_output=3
1111
order_by_type=false
1212
remove_redundant_aliases=true
1313
use_parentheses=true
14-
15-
[flake8]
16-
inline-quotes=double

0 commit comments

Comments
 (0)