Skip to content

Commit 63d3408

Browse files
committed
Prepare 1.18 release
1 parent 3c095f8 commit 63d3408

File tree

4 files changed

+110
-3
lines changed

4 files changed

+110
-3
lines changed

doc/modules/ROOT/pages/installation.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ The Python client supports the following versions of the other three components:
1818
|===
1919
| Python Client | GDS version | Python version | Neo4j Python Driver version
2020
.1+<.^| 1.18
21-
.1+<.^| >= 2.6, < 2.21
21+
.1+<.^| >= 2.6, < 2.24
2222
.6+<.^| >= 3.9, < 3.13
2323
.8+<.^| >= 4.4.12, < 6.0.0
2424

2525
.1+<.^| 1.17
26-
.1+<.^| >= 2.6, < 2.21
26+
.1+<.^| >= 2.6, < 2.24
2727

2828
.1+<.^| 1.16
2929
.1+<.^| >= 2.6, < 2.19

scripts/pre_release

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#!/usr/bin/env python
2+
3+
from pathlib import Path
4+
import re
5+
import requests
6+
import colorama
7+
8+
from graphdatascience.server_version.server_version import ServerVersion
9+
10+
11+
def read_library_version(repo_dir: Path) -> str:
12+
version_file = (repo_dir / "src" / "graphdatascience" / "version.py").read_text()
13+
version_regex = r'^__version__\s*=\s*"([^"]*)"'
14+
15+
match = re.search(version_regex, version_file)
16+
if not match:
17+
raise ValueError("Could not find version string in version.py")
18+
19+
return match.group(1)
20+
21+
22+
def read_min_server_version(repo_dir: Path) -> str:
23+
version_file = (repo_dir / "src" / "graphdatascience" / "version.py").read_text()
24+
version_regex = r'__min_server_version__\s*=\s*"([^"]*)"'
25+
26+
match = re.search(version_regex, version_file)
27+
if not match:
28+
raise ValueError("Could not find version string in version.py")
29+
30+
return match.group(1)
31+
32+
33+
def latest_released_plugin_version() -> ServerVersion:
34+
resp = requests.get("https://graphdatascience.ninja/versions.json")
35+
resp.raise_for_status()
36+
plugin_versions_json = resp.json()
37+
versions = [ServerVersion.from_string(v["version"]) for v in plugin_versions_json]
38+
latest_version = max(versions)
39+
return latest_version
40+
41+
42+
def verify_installation_docs(repo_dir: Path, client_version: str, min_server_version: str) -> None:
43+
latest_server_version = latest_released_plugin_version()
44+
print(f"Latest released GDS Plugin version: `{latest_server_version}`")
45+
46+
installation_doc_path = repo_dir / "doc" / "modules" / "ROOT" / "pages" / "installation.adoc"
47+
installation_doc = installation_doc_path.read_text()
48+
49+
version_table_regex = r"(?s)(\| Python Client \| GDS version[^\n]*)(.*)(\|===)"
50+
match = re.search(version_table_regex, installation_doc, re.MULTILINE)
51+
if not match:
52+
raise ValueError("Could not find installation table in installation.adoc")
53+
version_table = match.group(2)
54+
55+
latest_compat_entry = version_table.split("\n\n")[0]
56+
latest_compat_entries = [i for i in latest_compat_entry.splitlines() if len(i.strip()) > 0]
57+
latest_documented_client_version = latest_compat_entries[0]
58+
latest_documented_server_compat = latest_compat_entries[1]
59+
60+
stable_library_version = client_version.split("a")[0]
61+
62+
# Verify that the latest library version is mentioned
63+
if stable_library_version not in latest_documented_client_version:
64+
raise ValueError(
65+
f"Installation docs do not mention the latest python library version {stable_library_version}.\n"
66+
f"Found entry:\n{latest_documented_client_version}"
67+
)
68+
69+
# Verify that the minimum server version is mentioned
70+
min_server_version_minor = ".".join(min_server_version.split(".")[:2])
71+
if (
72+
min_server_version not in latest_documented_server_compat
73+
and min_server_version_minor not in latest_documented_server_compat
74+
):
75+
raise ValueError(
76+
f"Installation docs do not mention the minimum server version {min_server_version} or {min_server_version_minor}.\n"
77+
f"Found entry:\n{latest_documented_server_compat}"
78+
)
79+
80+
# Verify that the latest server version is mentioned
81+
next_server_version = ServerVersion(latest_server_version.major, latest_server_version.minor + 1, 0)
82+
expected_next_server_version_str = f"< {next_server_version.major}.{next_server_version.minor}"
83+
if expected_next_server_version_str not in latest_documented_server_compat:
84+
raise ValueError(
85+
f"Installation docs do not mention the next upcoming plugin version {expected_next_server_version_str}.\n"
86+
f"Found entry:\n{latest_documented_server_compat}"
87+
)
88+
89+
90+
def main() -> None:
91+
print("Client Pre-Release Checker")
92+
93+
repo_dir = Path(__file__).parent.parent
94+
version = read_library_version(repo_dir)
95+
print(f"Version to be released: `{colorama.Fore.GREEN}{version}{colorama.Style.RESET_ALL}`")
96+
97+
min_server_version = read_min_server_version(repo_dir)
98+
print(f"Minimum GDS Plugin version required: `{min_server_version}`")
99+
100+
verify_installation_docs(repo_dir, version, min_server_version)
101+
102+
103+
if __name__ == "__main__":
104+
main()

src/graphdatascience/server_version/server_version.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ def __ge__(self, other: ServerVersion) -> bool:
4242

4343
def __str__(self) -> str:
4444
return f"{self.major}.{self.minor}.{self.patch}"
45+
46+
def __repr__(self) -> str:
47+
return f"ServerVersion(major={self.major}, minor={self.minor}, patch={self.patch})"

src/graphdatascience/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "1.18a2"
1+
__version__ = "1.18"
22
__min_server_version__ = "2.6.0" # matches installation.adoc

0 commit comments

Comments
 (0)