Skip to content

Commit 0bb2159

Browse files
committed
take min versions into account
1 parent 984f623 commit 0bb2159

File tree

3 files changed

+83
-78
lines changed

3 files changed

+83
-78
lines changed

scripts/populate_tox/populate_tox.py

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import functools
2-
import subprocess
3-
import sys
42
import time
53
from collections import defaultdict
64
from datetime import datetime, timedelta
7-
from importlib import import_module
85
from pathlib import Path
96

107
import requests
118
from jinja2 import Environment, FileSystemLoader
129

10+
from sentry_sdk.integrations import _MIN_VERSIONS
1311
from sentry_sdk.utils import parse_version
1412

1513
from dependencies import DEPENDENCIES
@@ -147,15 +145,19 @@ def __init__(self, version, metadata=None):
147145
self.parsed = None
148146
self.python_versions = []
149147

150-
if not self.raw.split('.')[-1].isnumeric():
151-
# TODO: allow some prereleases (only the most recent one, not too old and not when an equivalent/newer stable release is available)
152-
return
148+
if isinstance(version, tuple):
149+
self.parsed = version
150+
self.raw = ".".join([str(v) for v in self.parsed])
151+
else:
152+
if not self.raw.split(".")[-1].isnumeric():
153+
# TODO: allow some prereleases (only the most recent one, not too old and not when an equivalent/newer stable release is available)
154+
return
153155

154-
try:
155-
self.parsed = parse_version(version)
156-
except Exception:
157-
print(f'Failed to parse version {version}')
158-
pass
156+
try:
157+
self.parsed = parse_version(version)
158+
except Exception:
159+
print(f"Failed to parse version {version}")
160+
pass
159161

160162
@property
161163
def major(self):
@@ -210,7 +212,16 @@ def fetch_package(package: str) -> dict:
210212
return pypi_data.json()
211213

212214

213-
def get_releases(pypi_data: dict) -> list[Version]:
215+
def get_releases(integration: str, pypi_data: dict) -> list[Version]:
216+
min_supported = _MIN_VERSIONS.get(integration)
217+
if min_supported:
218+
min_supported = Version(min_supported)
219+
print(f"Minimum supported version for {integration} is {min_supported}.")
220+
else:
221+
print(
222+
f"{integration} doesn't have a minimum version. Maybe we should define one?"
223+
)
224+
214225
versions = []
215226

216227
for release, metadata in pypi_data["releases"].items():
@@ -225,6 +236,9 @@ def get_releases(pypi_data: dict) -> list[Version]:
225236
if not version.valid:
226237
continue
227238

239+
if min_supported and version < min_supported:
240+
continue
241+
228242
# XXX don't consider yanked stuff
229243

230244
for i, saved_version in enumerate(versions):
@@ -308,9 +322,7 @@ def _requires_python_to_python_versions(
308322
return versions
309323

310324

311-
def determine_python_versions(
312-
pypi_data: dict
313-
) -> list[str]:
325+
def determine_python_versions(pypi_data: dict) -> list[str]:
314326
package = pypi_data["info"]["name"]
315327

316328
try:
@@ -375,7 +387,7 @@ def write_tox_file(packages: dict) -> None:
375387

376388

377389
if __name__ == "__main__":
378-
print('Finding out the lowest and highest Python version supported by the SDK...')
390+
print("Finding out the lowest and highest Python version supported by the SDK...")
379391
sentry_sdk_python_support = determine_python_versions(fetch_package("sentry_sdk"))
380392
LOWEST_SUPPORTED_PYTHON_VERSION = sentry_sdk_python_support[0]
381393
HIGHEST_SUPPORTED_PYTHON_VERSION = sentry_sdk_python_support[-1]
@@ -401,7 +413,7 @@ def write_tox_file(packages: dict) -> None:
401413

402414
pypi_data = fetch_package(package)
403415

404-
releases = get_releases(pypi_data)
416+
releases = get_releases(integration, pypi_data)
405417
if not releases:
406418
print("Found no supported releases.")
407419
continue
@@ -416,9 +428,7 @@ def write_tox_file(packages: dict) -> None:
416428
for release in test_releases:
417429
release_pypi_data = fetch_release(package, release)
418430
release.python_versions = pick_python_versions_to_test(
419-
determine_python_versions(
420-
release_pypi_data
421-
)
431+
determine_python_versions(release_pypi_data)
422432
)
423433
if not release.python_versions:
424434
print(f"Release {release} has no Python versions, skipping.")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
jinja2
12
requests
23
sentry_sdk

tox.ini

Lines changed: 52 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ envlist =
3232

3333
# === Integrations ===
3434
# ~~~ AI ~~~
35-
{py3.8,py3.13}-anthropic-v0.2.9
36-
{py3.7,py3.12}-anthropic-v0.14.1
37-
{py3.7,py3.12}-anthropic-v0.28.1
35+
{py3.7,py3.12}-anthropic-v0.16.0
36+
{py3.7,py3.12}-anthropic-v0.25.9
37+
{py3.7,py3.12}-anthropic-v0.34.2
3838
{py3.8,py3.12}-anthropic-v0.42.0
3939

4040
{py3.6,py3.13}-cohere-v0.0.8
@@ -68,20 +68,20 @@ envlist =
6868
{py3.6,py3.8}-aws_lambda-v2.1.3
6969

7070
# ~~~ Cloud ~~~
71-
{py3.6,py3.7}-boto3-v1.11.9
72-
{py3.6,py3.8}-boto3-v1.17.112
73-
{py3.7,py3.11}-boto3-v1.24.96
74-
{py3.8,py3.13}-boto3-v1.35.94
71+
{py3.6,py3.7}-boto3-v1.12.9
72+
{py3.6,py3.10}-boto3-v1.18.65
73+
{py3.7,py3.11}-boto3-v1.26.9
74+
{py3.8,py3.13}-boto3-v1.35.95
7575

7676
{py3.6,py3.8}-chalice-v1.13.1
7777
{py3.6,py3.8}-chalice-v1.19.0
7878
{py3.6,py3.8}-chalice-v1.25.0
7979
{py3.8,py3.12}-chalice-v1.31.3
8080

8181
# ~~~ DBs ~~~
82-
{py3.6,py3.7}-asyncpg-v0.20.1
8382
{py3.6,py3.9}-asyncpg-v0.23.0
84-
{py3.6,py3.10}-asyncpg-v0.26.0
83+
{py3.6,py3.10}-asyncpg-v0.25.0
84+
{py3.7,py3.10}-asyncpg-v0.27.0
8585
{py3.8,py3.12}-asyncpg-v0.30.0
8686

8787
{py3.6,py3.9}-clickhouse-driver-v0.1.5
@@ -121,24 +121,20 @@ envlist =
121121
{py3.8,py3.13}-unleash-v6.0.1
122122

123123
# ~~~ GraphQL ~~~
124-
{py3.6,py3.8}-ariadne-v0.10.0
125-
{py3.7,py3.10}-ariadne-v0.15.1
126124
{py3.8,py3.11}-ariadne-v0.20.1
125+
{py3.8,py3.12}-ariadne-v0.21
126+
{py3.8,py3.12}-ariadne-v0.22
127127
{py3.8,py3.12}-ariadne-v0.24.0
128128

129-
{py3.6,py3.8}-gql-v0.3.0
130-
{py3.6,py3.8}-gql-v2.0.0
131-
{py3.6,py3.10}-gql-v3.2.0
129+
{py3.6,py3.10}-gql-v3.4.1
132130
{py3.7,py3.12}-gql-v3.5.0
133131

134-
{py3.6,py3.7}-graphene-v2.1.9
135-
{py3.6,py3.10}-graphene-v3.1.1
136132
{py3.6,py3.10}-graphene-v3.3
137133
{py3.8,py3.13}-graphene-v3.4.3
138134

139-
{py3.7}-strawberry-v0.20.3
140-
{py3.7,py3.10}-strawberry-v0.96.0
141-
{py3.7,py3.11}-strawberry-v0.175.1
135+
{py3.8,py3.11}-strawberry-v0.209.8
136+
{py3.8,py3.12}-strawberry-v0.225.1
137+
{py3.8,py3.12}-strawberry-v0.241.0
142138
{py3.9,py3.13}-strawberry-v0.256.1
143139

144140
# ~~~ Network ~~~
@@ -158,19 +154,19 @@ envlist =
158154
{py3.8,py3.12}-requests-v2.32.3
159155

160156
# ~~~ Tasks ~~~
161-
{py3.6}-arq-v0.15.1
162-
{py3.6,py3.9}-arq-v0.21
157+
{py3.7,py3.10}-arq-v0.23
163158
{py3.7,py3.11}-arq-v0.24.0
159+
{py3.7,py3.11}-arq-v0.25.0
164160
{py3.8,py3.12}-arq-v0.26.3
165161

166162
{py3.6,py3.7}-beam-v2.18.0
167163
{py3.6,py3.8}-beam-v2.32.0
168164
{py3.7,py3.10}-beam-v2.46.0
169165
{py3.9,py3.12}-beam-v2.61.0
170166

171-
{py3.6,py3.7}-celery-v4.3.1
172-
{py3.6,py3.8}-celery-v5.0.6
173-
{py3.7,py3.10}-celery-v5.2.7
167+
{py3.6,py3.8}-celery-v4.4.7
168+
{py3.6,py3.9}-celery-v5.1.2
169+
{py3.8,py3.12}-celery-v5.3.6
174170
{py3.8,py3.12}-celery-v5.4.0
175171

176172
{py3.6,py3.7}-dramatiq-v1.8.1
@@ -183,8 +179,9 @@ envlist =
183179
{py3.6,py3.11}-huey-v2.4.5
184180
{py3.6,py3.12}-huey-v2.5.2
185181

186-
{py3.6,py3.9}-ray-v1.13.0
187-
{py3.8,py3.11}-ray-v2.20.0
182+
{py3.7,py3.10}-ray-v2.7.2
183+
{py3.8,py3.11}-ray-v2.21.0
184+
{py3.8,py3.11}-ray-v2.33.0
188185
{py3.9,py3.12}-ray-v2.40.0
189186

190187
{py3.6,py3.8}-rq-v1.2.2
@@ -231,9 +228,9 @@ envlist =
231228
{py3.8,py3.13}-falcon-v4.0.2
232229

233230
{py3.8,py3.11}-litestar-v2.0.1
234-
{py3.8,py3.12}-litestar-v2.4.5
235-
{py3.8,py3.12}-litestar-v2.8.3
236-
{py3.8,py3.12}-litestar-v2.13.0
231+
{py3.8,py3.12}-litestar-v2.5.5
232+
{py3.8,py3.12}-litestar-v2.10.0
233+
{py3.8,py3.13}-litestar-v2.14.0
237234

238235
{py3.6,py3.9}-pyramid-v1.10.8
239236
{py3.6,py3.11}-pyramid-v2.0.2
@@ -315,9 +312,9 @@ deps =
315312

316313
# === Integrations ===
317314
# ~~~ AI ~~~
318-
anthropic-v0.2.9: anthropic==0.2.9
319-
anthropic-v0.14.1: anthropic==0.14.1
320-
anthropic-v0.28.1: anthropic==0.28.1
315+
anthropic-v0.16.0: anthropic==0.16.0
316+
anthropic-v0.25.9: anthropic==0.25.9
317+
anthropic-v0.34.2: anthropic==0.34.2
321318
anthropic-v0.42.0: anthropic==0.42.0
322319
anthropic: httpx
323320
anthropic: pytest-asyncio
@@ -364,10 +361,10 @@ deps =
364361
aws_lambda: boto3
365362

366363
# ~~~ Cloud ~~~
367-
boto3-v1.11.9: boto3==1.11.9
368-
boto3-v1.17.112: boto3==1.17.112
369-
boto3-v1.24.96: boto3==1.24.96
370-
boto3-v1.35.94: boto3==1.35.94
364+
boto3-v1.12.9: boto3==1.12.9
365+
boto3-v1.18.65: boto3==1.18.65
366+
boto3-v1.26.9: boto3==1.26.9
367+
boto3-v1.35.95: boto3==1.35.95
371368

372369
chalice-v1.13.1: chalice==1.13.1
373370
chalice-v1.19.0: chalice==1.19.0
@@ -376,9 +373,9 @@ deps =
376373
chalice: pytest-chalice==0.0.5
377374

378375
# ~~~ DBs ~~~
379-
asyncpg-v0.20.1: asyncpg==0.20.1
380376
asyncpg-v0.23.0: asyncpg==0.23.0
381-
asyncpg-v0.26.0: asyncpg==0.26.0
377+
asyncpg-v0.25.0: asyncpg==0.25.0
378+
asyncpg-v0.27.0: asyncpg==0.27.0
382379
asyncpg-v0.30.0: asyncpg==0.30.0
383380
asyncpg: pytest-asyncio
384381

@@ -423,31 +420,27 @@ deps =
423420
unleash-v6.0.1: UnleashClient==6.0.1
424421

425422
# ~~~ GraphQL ~~~
426-
ariadne-v0.10.0: ariadne==0.10.0
427-
ariadne-v0.15.1: ariadne==0.15.1
428423
ariadne-v0.20.1: ariadne==0.20.1
424+
ariadne-v0.21: ariadne==0.21
425+
ariadne-v0.22: ariadne==0.22
429426
ariadne-v0.24.0: ariadne==0.24.0
430427
ariadne: fastapi
431428
ariadne: flask
432429
ariadne: httpx
433430

434-
gql-v0.3.0: gql[all]==0.3.0
435-
gql-v2.0.0: gql[all]==2.0.0
436-
gql-v3.2.0: gql[all]==3.2.0
431+
gql-v3.4.1: gql[all]==3.4.1
437432
gql-v3.5.0: gql[all]==3.5.0
438433

439-
graphene-v2.1.9: graphene==2.1.9
440-
graphene-v3.1.1: graphene==3.1.1
441434
graphene-v3.3: graphene==3.3
442435
graphene-v3.4.3: graphene==3.4.3
443436
graphene: blinker
444437
graphene: fastapi
445438
graphene: flask
446439
graphene: httpx
447440

448-
strawberry-v0.20.3: strawberry-graphql[fastapi,flask]==0.20.3
449-
strawberry-v0.96.0: strawberry-graphql[fastapi,flask]==0.96.0
450-
strawberry-v0.175.1: strawberry-graphql[fastapi,flask]==0.175.1
441+
strawberry-v0.209.8: strawberry-graphql[fastapi,flask]==0.209.8
442+
strawberry-v0.225.1: strawberry-graphql[fastapi,flask]==0.225.1
443+
strawberry-v0.241.0: strawberry-graphql[fastapi,flask]==0.241.0
451444
strawberry-v0.256.1: strawberry-graphql[fastapi,flask]==0.256.1
452445
strawberry: fastapi
453446
strawberry: flask
@@ -475,9 +468,9 @@ deps =
475468
requests-v2.32.3: requests==2.32.3
476469

477470
# ~~~ Tasks ~~~
478-
arq-v0.15.1: arq==0.15.1
479-
arq-v0.21: arq==0.21
471+
arq-v0.23: arq==0.23
480472
arq-v0.24.0: arq==0.24.0
473+
arq-v0.25.0: arq==0.25.0
481474
arq-v0.26.3: arq==0.26.3
482475
arq: pydantic
483476
arq: fakeredis>=2.2.0,<2.8
@@ -489,9 +482,9 @@ deps =
489482
beam-v2.46.0: apache-beam==2.46.0
490483
beam-v2.61.0: apache-beam==2.61.0
491484

492-
celery-v4.3.1: celery==4.3.1
493-
celery-v5.0.6: celery==5.0.6
494-
celery-v5.2.7: celery==5.2.7
485+
celery-v4.4.7: celery==4.4.7
486+
celery-v5.1.2: celery==5.1.2
487+
celery-v5.3.6: celery==5.3.6
495488
celery-v5.4.0: celery==5.4.0
496489
celery: importlib-metadata
497490
celery: newrelic
@@ -507,8 +500,9 @@ deps =
507500
huey-v2.4.5: huey==2.4.5
508501
huey-v2.5.2: huey==2.5.2
509502

510-
ray-v1.13.0: ray==1.13.0
511-
ray-v2.20.0: ray==2.20.0
503+
ray-v2.7.2: ray==2.7.2
504+
ray-v2.21.0: ray==2.21.0
505+
ray-v2.33.0: ray==2.33.0
512506
ray-v2.40.0: ray==2.40.0
513507

514508
rq-v1.2.2: rq==1.2.2
@@ -580,9 +574,9 @@ deps =
580574
falcon-v4.0.2: falcon==4.0.2
581575

582576
litestar-v2.0.1: litestar==2.0.1
583-
litestar-v2.4.5: litestar==2.4.5
584-
litestar-v2.8.3: litestar==2.8.3
585-
litestar-v2.13.0: litestar==2.13.0
577+
litestar-v2.5.5: litestar==2.5.5
578+
litestar-v2.10.0: litestar==2.10.0
579+
litestar-v2.14.0: litestar==2.14.0
586580
litestar: pytest-asyncio
587581
litestar: python-multipart
588582
litestar: requests

0 commit comments

Comments
 (0)