Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
sentrivana committed Feb 19, 2025
1 parent b9f2546 commit 98666c8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
24 changes: 23 additions & 1 deletion scripts/populate_tox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,16 @@ integration_name: {
rule1: [package1, package2, ...],
rule2: [package3, package4, ...],
},
"python": python_version_specifier,
"python": version_specifier,
"ignore": version_specifier,
}
```

When talking about version specifiers, we mean
[version specifiers as defined](https://packaging.python.org/en/latest/specifications/version-specifiers/#id5)
by the Python Packaging Authority. See also the actual implementation
in `[packaging.specifiers](https://packaging.pypa.io/en/stable/specifiers.html)`.

### `package`

The name of the third party package as it's listed on PyPI. The script will
Expand Down Expand Up @@ -118,6 +124,22 @@ metadata or the SDK is explicitly not supporting some packages on specific
Python versions (because of, for example, broken context vars), the `python`
key can be used.

### `ignore`

Sometimes there are versions of packages that we explicitly don't want to test.
One example is Starlite, which has two alpha prereleases of version 2.0.0, but
there will never will be a stable 2.0 release, since development on Starlite
has stopped and Starlite 2.0 eventually became Litestar.

The value of the `ignore` key expects a version specifier defining which
versions should not be considered for testing.

```python
"starlite": {
"ignore": ">=2.0",
...
}
```

## How-Tos

Expand Down
1 change: 1 addition & 0 deletions scripts/populate_tox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
],
},
"python": "<=3.11",
"ignore": "==2.0.0a1,==2.0.0a2", # the project ultimately renamed itself to litestar and these are not relevant as there will never be a stable 2.0 release
},
"statsig": {
"package": "statsig",
Expand Down
16 changes: 12 additions & 4 deletions scripts/populate_tox/populate_tox.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ def _prefilter_releases(
f" {integration} doesn't have a minimum version defined in sentry_sdk/integrations/__init__.py. Consider defining one"
)

ignored_versions = set()
if TEST_SUITE_CONFIG[integration].get("ignore") is not None:
ignored_versions = SpecifierSet(
TEST_SUITE_CONFIG[integration]["ignore"], prereleases=True
)

filtered_releases = []
last_prerelease = None

Expand All @@ -147,10 +153,11 @@ def _prefilter_releases(
if min_supported and version < min_supported:
continue

if version.is_postrelease:
if version.is_postrelease or version.is_devrelease:
continue

# If we made it here, we want to consider this release.
if version in ignored_versions:
continue

if version.is_prerelease:
if last_prerelease is None or version > last_prerelease:
Expand All @@ -173,8 +180,9 @@ def _prefilter_releases(

# Check if the latest prerelease is relevant (i.e., it's for a version higher
# than the last released version); if not, don't consider it
if last_prerelease is not None and last_prerelease > filtered_releases[-1]:
return filtered_releases, last_prerelease
if last_prerelease is not None:
if not filtered_releases or last_prerelease > filtered_releases[-1]:
return filtered_releases, last_prerelease

return filtered_releases, None

Expand Down
2 changes: 0 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ envlist =
{py3.8,py3.9}-spark-v3.2.4
{py3.8,py3.10,py3.11}-spark-v3.4.4
{py3.8,py3.10,py3.11}-spark-v3.5.4
{py3.9,py3.11,py3.12}-spark-v4.0.0.dev2


# ~~~ Web 1 ~~~
Expand Down Expand Up @@ -647,7 +646,6 @@ deps =
spark-v3.2.4: pyspark==3.2.4
spark-v3.4.4: pyspark==3.4.4
spark-v3.5.4: pyspark==3.5.4
spark-v4.0.0.dev2: pyspark==4.0.0.dev2


# ~~~ Web 1 ~~~
Expand Down

0 comments on commit 98666c8

Please sign in to comment.