Skip to content

Commit 7a3c785

Browse files
chore: Remove changelog validation (#2314)
1 parent bcefcfd commit 7a3c785

2 files changed

Lines changed: 1 addition & 51 deletions

File tree

scripts/custom_checks/version.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
import re
2-
from collections.abc import Iterator
3-
from datetime import datetime
4-
from itertools import pairwise
51
from pathlib import Path
6-
from re import Match
72

83
import toml
9-
from packaging.version import Version
104

115
from cognite.client import __version__
126

@@ -23,39 +17,3 @@ def pyproj_version_matches() -> str | None:
2317
f"cognite/client/_version.py: ({__version__})"
2418
)
2519
return None
26-
27-
28-
def _parse_changelog() -> Iterator[Match[str]]:
29-
changelog = (CWD / "CHANGELOG.md").read_text(encoding="utf-8")
30-
return re.finditer(r"##\s\[(\d+\.\d+\.\d+)\]\s-\s(\d+-\d+-\d+)", changelog)
31-
32-
33-
def changelog_entry_version_matches() -> str | None:
34-
match = next(_parse_changelog())
35-
version = match.group(1)
36-
if version != __version__:
37-
return (
38-
f"The latest entry in 'CHANGELOG.md' has a different version ({version}) than "
39-
f"cognite/client/_version.py: ({__version__}). Did you forgot to add a new entry? "
40-
"Or maybe you haven't followed the required format?"
41-
)
42-
return None
43-
44-
45-
def changelog_entry_date() -> str | None:
46-
match = next(_parse_changelog())
47-
try:
48-
datetime.strptime(date := match.group(2), "%Y-%m-%d")
49-
return None
50-
except Exception:
51-
return f"Date given in the newest entry in 'CHANGELOG.md', {date!r}, is not valid/parsable (YYYY-MM-DD)"
52-
53-
54-
def version_number_and_date_is_increasing() -> str | None:
55-
versions_and_dates = [(Version(m.group(1)), datetime.strptime(m.group(2), "%Y-%m-%d")) for m in _parse_changelog()]
56-
for (new_v, new_d), (old_v, old_d) in pairwise(versions_and_dates):
57-
if new_v < old_v:
58-
return f"Versions must be strictly increasing: {new_v} is not higher than the previous, {old_v}."
59-
if new_d < old_d:
60-
return f"Dates must be strictly increasing: {new_d.date()} is not after than the previous, {old_d.date()}."
61-
return None

scripts/run_checks.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,14 @@
66
from cognite.client import global_config
77
from scripts.custom_checks.docstr_examples import format_docstring_examples
88
from scripts.custom_checks.docstrings import format_docstrings
9-
from scripts.custom_checks.version import (
10-
changelog_entry_date,
11-
changelog_entry_version_matches,
12-
pyproj_version_matches,
13-
version_number_and_date_is_increasing,
14-
)
9+
from scripts.custom_checks.version import pyproj_version_matches
1510

1611
global_config.silence_feature_preview_warnings = True
1712

1813

1914
def run_checks(files: tuple[Path, ...]) -> list[str | None]:
2015
return [
2116
pyproj_version_matches(),
22-
changelog_entry_version_matches(),
23-
changelog_entry_date(),
24-
version_number_and_date_is_increasing(),
2517
format_docstrings(files),
2618
format_docstring_examples(files),
2719
]

0 commit comments

Comments
 (0)