Skip to content

Commit a959c96

Browse files
authored
Merge pull request #748 from robsdedude/bolt-utc-datetimes-refactoring
Add support for new temporal packstream encoding (UTC)
2 parents 2b4f1c7 + e31cf92 commit a959c96

File tree

143 files changed

+6434
-4379
lines changed

Some content is hidden

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

143 files changed

+6434
-4379
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,26 @@
9696
- ANSI colour codes for log output are now opt-in
9797
- Prepend log format with log-level (if colours are disabled)
9898
- Prepend log format with thread name and id
99+
- Importing submodules from `neo4j.time` (`neo4j.time.xyz`) has been deprecated.
100+
Everything needed should be imported from `neo4j.time` directly.
101+
- `neo4j.spatial.hydrate_point` and `neo4j.spatial.dehydrate_point` have been
102+
deprecated without replacement. They are internal functions.
103+
- Importing `neo4j.packstream` has been deprecated. It's internal and should not
104+
be used by client code.
105+
- Importing `neo4j.routing` has been deprecated. It's internal and should not
106+
be used by client code.
107+
- Importing `neo4j.config` has been deprecated. It's internal and should not
108+
be used by client code.
109+
- `neoj4.Config`, `neoj4.PoolConfig`, `neoj4.SessionConfig`, and
110+
`neoj4.WorkspaceConfig` have been deprecated without replacement. They are
111+
internal classes.
112+
- Importing `neo4j.meta` has been deprecated. It's internal and should not
113+
be used by client code. `ExperimantalWarning` should be imported directly from
114+
`neo4j`. `neo4j.meta.version` is exposed through `neo4j.__vesrion__`
115+
- Importing `neo4j.data` has been deprecated. It's internal and should not
116+
be used by client code. `Record` should be imported directly from `neo4j`
117+
instead. `neo4j.data.DataHydrator` and `neo4j.data.DataDeydrator` have been
118+
removed without replacement.
99119

100120

101121
## Version 4.4

bin/dist-functions

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ DIST="${ROOT}/dist"
66

77
function get_package
88
{
9-
python -c "from neo4j.meta import package; print(package)"
9+
python -c "from neo4j._meta import package; print(package)"
1010
}
1111

1212
function set_package
1313
{
14-
sed -i 's/^package = .*/package = "'$1'"/g' neo4j/meta.py
14+
sed -i 's/^package = .*/package = "'$1'"/g' neo4j/_meta.py
1515
}
1616

1717
function get_version
1818
{
19-
python -c "from neo4j.meta import version; print(version)"
19+
python -c "from neo4j._meta import version; print(version)"
2020
}
2121

2222
function set_version
2323
{
24-
sed -i 's/^version = .*/version = "'$1'"/g' neo4j/meta.py
24+
sed -i 's/^version = .*/version = "'$1'"/g' neo4j/_meta.py
2525
}
2626

2727
function check_file
@@ -49,8 +49,8 @@ function set_metadata_and_setup
4949
ORIGINAL_VERSION=$(get_version)
5050
echo "Source code originally configured for package ${ORIGINAL_PACKAGE}/${ORIGINAL_VERSION}"
5151
echo "----------------------------------------"
52-
grep "package\s\+=" neo4j/meta.py
53-
grep "version\s\+=" neo4j/meta.py
52+
grep "package\s\+=" neo4j/_meta.py
53+
grep "version\s\+=" neo4j/_meta.py
5454
echo "----------------------------------------"
5555

5656
function cleanup() {
@@ -59,8 +59,8 @@ function set_metadata_and_setup
5959
set_version "${ORIGINAL_VERSION}"
6060
echo "Source code reconfigured back to original package ${ORIGINAL_PACKAGE}/${ORIGINAL_VERSION}"
6161
echo "----------------------------------------"
62-
grep "package\s\+=" neo4j/meta.py
63-
grep "version\s\+=" neo4j/meta.py
62+
grep "package\s\+=" neo4j/_meta.py
63+
grep "version\s\+=" neo4j/_meta.py
6464
echo "----------------------------------------"
6565
}
6666
trap cleanup EXIT
@@ -70,8 +70,8 @@ function set_metadata_and_setup
7070
set_version "${VERSION}"
7171
echo "Source code reconfigured for package ${PACKAGE}/${VERSION}"
7272
echo "----------------------------------------"
73-
grep "package\s\+=" neo4j/meta.py
74-
grep "version\s\+=" neo4j/meta.py
73+
grep "package\s\+=" neo4j/_meta.py
74+
grep "version\s\+=" neo4j/_meta.py
7575
echo "----------------------------------------"
7676

7777
# Create source distribution

bin/make-unasync

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
import collections
2222
import errno
2323
import os
24-
from pathlib import Path
2524
import re
2625
import sys
2726
import tokenize as std_tokenize
27+
from pathlib import Path
2828

2929
import isort
3030
import isort.files

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
sys.path.insert(0, os.path.abspath(os.path.join("..", "..")))
2222

2323

24-
from neo4j.meta import version as project_version
24+
from neo4j import __version__ as project_version
2525

2626

2727
# -- General configuration ------------------------------------------------

neo4j/__init__.py

Lines changed: 85 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -16,60 +16,7 @@
1616
# limitations under the License.
1717

1818

19-
__all__ = [
20-
"__version__",
21-
"Address",
22-
"AsyncBoltDriver",
23-
"AsyncDriver",
24-
"AsyncGraphDatabase",
25-
"AsyncManagedTransaction",
26-
"AsyncNeo4jDriver",
27-
"AsyncResult",
28-
"AsyncSession",
29-
"AsyncTransaction",
30-
"Auth",
31-
"AuthToken",
32-
"basic_auth",
33-
"bearer_auth",
34-
"BoltDriver",
35-
"Bookmark",
36-
"Bookmarks",
37-
"Config",
38-
"custom_auth",
39-
"DEFAULT_DATABASE",
40-
"Driver",
41-
"ExperimentalWarning",
42-
"get_user_agent",
43-
"GraphDatabase",
44-
"IPv4Address",
45-
"IPv6Address",
46-
"kerberos_auth",
47-
"ManagedTransaction",
48-
"Neo4jDriver",
49-
"PoolConfig",
50-
"Query",
51-
"READ_ACCESS",
52-
"Record",
53-
"Result",
54-
"ResultSummary",
55-
"ServerInfo",
56-
"Session",
57-
"SessionConfig",
58-
"SummaryCounters",
59-
"Transaction",
60-
"TRUST_ALL_CERTIFICATES",
61-
"TRUST_SYSTEM_CA_SIGNED_CERTIFICATES",
62-
"TrustAll",
63-
"TrustCustomCAs",
64-
"TrustSystemCAs",
65-
"unit_of_work",
66-
"Version",
67-
"WorkspaceConfig",
68-
"WRITE_ACCESS",
69-
]
70-
71-
72-
from logging import getLogger
19+
from logging import getLogger as _getLogger
7320

7421
from ._async.driver import (
7522
AsyncBoltDriver,
@@ -84,9 +31,19 @@
8431
AsyncTransaction,
8532
)
8633
from ._conf import (
34+
Config as _Config,
35+
PoolConfig as _PoolConfig,
36+
SessionConfig as _SessionConfig,
8737
TrustAll,
8838
TrustCustomCAs,
8939
TrustSystemCAs,
40+
WorkspaceConfig as _WorkspaceConfig,
41+
)
42+
from ._data import Record
43+
from ._meta import (
44+
ExperimentalWarning,
45+
get_user_agent,
46+
version as __version__,
9047
)
9148
from ._sync.driver import (
9249
BoltDriver,
@@ -125,19 +82,6 @@
12582
Version,
12683
WRITE_ACCESS,
12784
)
128-
from .conf import (
129-
Config,
130-
PoolConfig,
131-
SessionConfig,
132-
WorkspaceConfig,
133-
)
134-
from .data import Record
135-
from .meta import (
136-
experimental,
137-
ExperimentalWarning,
138-
get_user_agent,
139-
version as __version__,
140-
)
14185
from .work import (
14286
Query,
14387
ResultSummary,
@@ -146,4 +90,77 @@
14690
)
14791

14892

149-
log = getLogger("neo4j")
93+
__all__ = [
94+
"__version__",
95+
"Address",
96+
"AsyncBoltDriver",
97+
"AsyncDriver",
98+
"AsyncGraphDatabase",
99+
"AsyncManagedTransaction",
100+
"AsyncNeo4jDriver",
101+
"AsyncResult",
102+
"AsyncSession",
103+
"AsyncTransaction",
104+
"Auth",
105+
"AuthToken",
106+
"basic_auth",
107+
"bearer_auth",
108+
"BoltDriver",
109+
"Bookmark",
110+
"Bookmarks",
111+
"Config",
112+
"custom_auth",
113+
"DEFAULT_DATABASE",
114+
"Driver",
115+
"ExperimentalWarning",
116+
"get_user_agent",
117+
"GraphDatabase",
118+
"IPv4Address",
119+
"IPv6Address",
120+
"kerberos_auth",
121+
"ManagedTransaction",
122+
"Neo4jDriver",
123+
"PoolConfig",
124+
"Query",
125+
"READ_ACCESS",
126+
"Record",
127+
"Result",
128+
"ResultSummary",
129+
"ServerInfo",
130+
"Session",
131+
"SessionConfig",
132+
"SummaryCounters",
133+
"Transaction",
134+
"TRUST_ALL_CERTIFICATES",
135+
"TRUST_SYSTEM_CA_SIGNED_CERTIFICATES",
136+
"TrustAll",
137+
"TrustCustomCAs",
138+
"TrustSystemCAs",
139+
"unit_of_work",
140+
"Version",
141+
"WorkspaceConfig",
142+
"WRITE_ACCESS",
143+
]
144+
145+
146+
_log = _getLogger("neo4j")
147+
148+
149+
def __getattr__(name):
150+
# TODO 6.0 - remove this
151+
if name in (
152+
"log", "Config", "PoolConfig", "SessionConfig", "WorkspaceConfig"
153+
):
154+
from ._meta import deprecation_warn
155+
deprecation_warn(
156+
"Importing {} from neo4j is deprecated without replacement. It's "
157+
"internal and will be removed in a future version."
158+
.format(name),
159+
stack_level=2
160+
)
161+
return globals()[f"_{name}"]
162+
raise AttributeError(f"module {__name__} has no attribute {name}")
163+
164+
165+
def __dir__():
166+
return __all__

neo4j/_async/driver.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,27 @@
1616
# limitations under the License.
1717

1818

19-
import warnings
20-
2119
from .._async_compat.util import AsyncUtil
2220
from .._conf import (
23-
TrustAll,
24-
TrustStore,
25-
)
26-
from ..addressing import Address
27-
from ..api import (
28-
READ_ACCESS,
29-
TRUST_ALL_CERTIFICATES,
30-
TRUST_SYSTEM_CA_SIGNED_CERTIFICATES,
31-
)
32-
from ..conf import (
3321
Config,
3422
PoolConfig,
3523
SessionConfig,
24+
TrustAll,
25+
TrustStore,
3626
WorkspaceConfig,
3727
)
38-
from ..meta import (
28+
from .._meta import (
3929
deprecation_warn,
4030
experimental,
4131
experimental_warn,
42-
ExperimentalWarning,
4332
unclosed_resource_warn,
4433
)
34+
from ..addressing import Address
35+
from ..api import (
36+
READ_ACCESS,
37+
TRUST_ALL_CERTIFICATES,
38+
TRUST_SYSTEM_CA_SIGNED_CERTIFICATES,
39+
)
4540

4641

4742
class AsyncGraphDatabase:
@@ -145,7 +140,8 @@ def driver(cls, uri, *, auth=None, **config):
145140
"Creating a direct driver (`bolt://` scheme) with routing "
146141
"context (URI parameters) is deprecated. They will be "
147142
"ignored. This will raise an error in a future release. "
148-
'Given URI "{}"'.format(uri)
143+
'Given URI "{}"'.format(uri),
144+
stack_level=2
149145
)
150146
# TODO: 6.0 - raise instead of warning
151147
# raise ValueError(

0 commit comments

Comments
 (0)