Skip to content

Commit 95591d6

Browse files
committed
Add type annotations to public facing APIs
1 parent e29e042 commit 95591d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2432
-1752
lines changed

.editorconfig

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ trim_trailing_whitespace = true
1616
[*.bat]
1717
end_of_line = crlf
1818

19-
[*.py]
20-
max_line_length = 79
19+
[*{.py,pyi}]
2120
indent_style = space
2221
indent_size = 4
22+
23+
[*.py]
24+
max_line_length = 79
25+
26+
[*.pyi]
27+
max_line_length = 130

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,11 @@ repos:
3434
entry: bin/make-unasync
3535
language: system
3636
files: "^(neo4j/_async|tests/(unit|integration)/async_|testkitbackend/_async)/.*"
37+
- id: mypy
38+
name: mypy static type check
39+
entry: mypy
40+
args: [ --show-error-codes, neo4j, tests, testkitbackend ]
41+
'types_or': [ python, pyi ]
42+
language: system
43+
pass_filenames: false
44+
require_serial: true

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@
118118
be used by client code. `Record` should be imported directly from `neo4j`
119119
instead. `neo4j.data.DataHydrator` and `neo4j.data.DataDeydrator` have been
120120
removed without replacement.
121+
- Removed undocumented config options that had no effect:
122+
`protocol_version` and `init_size`.
121123

122124

123125
## Version 4.4

bin/make-unasync

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ class CustomRule(unasync.Rule):
104104
def __init__(self, *args, **kwargs):
105105
super(CustomRule, self).__init__(*args, **kwargs)
106106
self.out_files = []
107+
# it's not pretty, but it works
108+
# typing.Awaitable[...] -> typing.Union[...]
109+
self.token_replacements["Awaitable"] = "Union"
107110

108111
def _unasync_tokens(self, tokens):
109112
# copy from unasync to hook into string handling

docs/source/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@
115115
# If true, `todo` and `todoList` produce output, else they produce nothing.
116116
todo_include_todos = True
117117

118+
# Don't include type hints in function signatures
119+
autodoc_typehints = "description"
120+
118121

119122
# -- Options for HTML output ----------------------------------------------
120123

neo4j/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
"BoltDriver",
109109
"Bookmark",
110110
"Bookmarks",
111+
"Config",
111112
"custom_auth",
112113
"DEFAULT_DATABASE",
113114
"Driver",
@@ -117,15 +118,18 @@
117118
"IPv4Address",
118119
"IPv6Address",
119120
"kerberos_auth",
121+
"log",
120122
"ManagedTransaction",
121123
"Neo4jDriver",
124+
"PoolConfig",
122125
"Query",
123126
"READ_ACCESS",
124127
"Record",
125128
"Result",
126129
"ResultSummary",
127130
"ServerInfo",
128131
"Session",
132+
"SessionConfig",
129133
"SummaryCounters",
130134
"Transaction",
131135
"TRUST_ALL_CERTIFICATES",
@@ -135,6 +139,7 @@
135139
"TrustSystemCAs",
136140
"unit_of_work",
137141
"Version",
142+
"WorkspaceConfig",
138143
"WRITE_ACCESS",
139144
]
140145

0 commit comments

Comments
 (0)