Skip to content

Commit a0e8850

Browse files
committed
feat: Add script to determine lowest supported version
1 parent ceefa69 commit a0e8850

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

scripts/populate_tox/populate_tox.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ def _normalize_release(release: dict) -> dict:
665665
return normalized
666666

667667

668-
def main(fail_on_changes: bool = False) -> None:
668+
def main(fail_on_changes: bool = False) -> dict[str, list]:
669669
"""
670670
Generate tox.ini from the tox.jinja template.
671671
@@ -825,6 +825,8 @@ def main(fail_on_changes: bool = False) -> None:
825825
"files to reflect the new test targets."
826826
)
827827

828+
return packages
829+
828830

829831
if __name__ == "__main__":
830832
fail_on_changes = len(sys.argv) == 2 and sys.argv[1] == "--fail-on-changes"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"""
2+
Find out what the actual minimum supported version of each framework/library is.
3+
"""
4+
5+
import os
6+
import sys
7+
8+
populate_tox_dir = os.path.join(
9+
os.path.dirname(os.path.abspath(__file__)), "populate_tox"
10+
)
11+
sys.path.append(populate_tox_dir)
12+
13+
from populate_tox import main
14+
15+
16+
def update():
17+
print("Running populate_tox.py...")
18+
packages = main()
19+
20+
print("Figuring out the lowest supported version of integrations...")
21+
min_versions = []
22+
23+
for _, integrations in packages.items():
24+
for integration in integrations:
25+
min_versions.append(
26+
(integration["integration_name"], str(integration["releases"][0]))
27+
)
28+
29+
min_versions = sorted(
30+
set(
31+
[
32+
(integration, tuple([int(v) for v in min_version.split(".")]))
33+
for integration, min_version in min_versions
34+
]
35+
)
36+
)
37+
38+
print()
39+
print("Effective minimal versions:")
40+
print(
41+
"(The format is the same as _MIN_VERSIONS in sentry_sdk/integrations/__init__.py for easy replacing.)"
42+
)
43+
print(
44+
"(When updating these, make sure to also update the docs page for the integration.)"
45+
)
46+
print()
47+
for integration, min_version in min_versions:
48+
print(f'"{integration}": {min_version},')
49+
50+
51+
if __name__ == "__main__":
52+
update()

0 commit comments

Comments
 (0)