Skip to content

Test Common w/ multiple OTel versions & add compat with old OTel #4312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0b59073
.
sentrivana Apr 16, 2025
11462f2
remove experimental extra
sentrivana Apr 17, 2025
46ef7c1
try integrating common in toxgen
sentrivana Apr 17, 2025
ee43828
.
sentrivana Apr 17, 2025
e11e2ef
formatting
sentrivana Apr 17, 2025
3de83dd
formatting
sentrivana Apr 17, 2025
ca2185c
Clear iso scope if propagate_scope is False
sentrivana Apr 17, 2025
d1a365f
.
sentrivana Apr 17, 2025
1282884
comments
sentrivana Apr 17, 2025
2085817
Merge branch 'ivana/potel/fix-propagate-scope-false' into ivana/potel…
sentrivana Apr 17, 2025
fa28dbf
.
sentrivana Apr 17, 2025
03b8148
Merge branch 'ivana/potel/fix-propagate-scope-false' into ivana/potel…
sentrivana Apr 17, 2025
08d2982
use otel-sdk instead
sentrivana Apr 17, 2025
c0fad24
.
sentrivana Apr 17, 2025
16649eb
.
sentrivana Apr 17, 2025
f74d3e1
compat
sentrivana Apr 17, 2025
e6d5808
.
sentrivana Apr 17, 2025
b4b202f
circ imps in sphinx.......
sentrivana Apr 17, 2025
19cb677
hate mypy
sentrivana Apr 17, 2025
28256e2
.
sentrivana Apr 17, 2025
f835a19
Merge branch 'potel-base' into ivana/potel/fix-propagate-scope-false
sentrivana Apr 17, 2025
ebc2331
compat
sentrivana Apr 17, 2025
f10d404
Merge branch 'ivana/potel/fix-propagate-scope-false' into ivana/potel…
sentrivana Apr 17, 2025
e968394
maybe fix
sentrivana Apr 17, 2025
819bd1f
fix
sentrivana Apr 23, 2025
27d525a
.
sentrivana Apr 23, 2025
4b5c915
.
sentrivana Apr 23, 2025
7bbc13e
remove forked
sentrivana Apr 23, 2025
bc03c6a
.
sentrivana Apr 23, 2025
2f079d2
.
sentrivana Apr 23, 2025
1c0dc4c
.
sentrivana Apr 23, 2025
7937b41
.
sentrivana Apr 23, 2025
4f8a369
fix logic
sentrivana Apr 23, 2025
752dad5
.
sentrivana Apr 23, 2025
4ce2167
Merge branch 'potel-base' into ivana/potel/determine-lowest-otel-version
sentrivana Apr 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions scripts/populate_tox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ integration_name: {
},
"python": python_version_specifier,
"include": package_version_specifier,
"prereleases": bool,
"test_on_all_python_versions": bool,
}
```

Expand Down Expand Up @@ -153,6 +155,34 @@ be expressed like so:
}
```

### `prereleases`

By default, we ignore all prereleases but the newest one. Some packages only have prereleases though. When `prereleases` is set to `True`, we will consider prereleases just like we do normal releases and they will not be filtered out.

```python
"common": {
# opentelemetry-distro is only available in beta
"package": "opentelemetry-distro",
"prereleases": True,
...
}
```


### `test_on_all_python_versions`

By default, the script will cherry-pick a few Python versions to test each integration on.
If you want a test suite to run on all supported Python versions instead, set
`test_on_all_python_versions=True`.

```python
"common": {
# The common test suite should run on all Python versions.
"test_on_all_python_versions": True,
...
}
```


## How-Tos

Expand Down
13 changes: 13 additions & 0 deletions scripts/populate_tox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@
"clickhouse_driver": {
"package": "clickhouse-driver",
},
"common": {
"package": "opentelemetry-distro",
"prereleases": True,
"test_on_all_python_versions": True,
"deps": {
"*": ["pytest", "pytest-asyncio"],
# See https://github.com/pytest-dev/pytest/issues/9621
# and https://github.com/pytest-dev/pytest-forked/issues/67
# for justification of the upper bound on pytest
"py3.7": ["pytest<7.0.0"],
"py3.8": ["hypothesis"],
},
},
"django": {
"package": "django",
"deps": {
Expand Down
42 changes: 23 additions & 19 deletions scripts/populate_tox/populate_tox.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"asgi",
"aws_lambda",
"cloud_resource_context",
"common",
"gevent",
"opentelemetry",
"potel",
Expand Down Expand Up @@ -151,6 +150,8 @@ def _prefilter_releases(
TEST_SUITE_CONFIG[integration]["include"], prereleases=True
)

accept_prereleases = TEST_SUITE_CONFIG[integration].get("prereleases") or False

filtered_releases = []
last_prerelease = None

Expand Down Expand Up @@ -182,7 +183,7 @@ def _prefilter_releases(
if include_versions is not None and version not in include_versions:
continue

if version.is_prerelease:
if not accept_prereleases and version.is_prerelease:
if last_prerelease is None or version > last_prerelease:
last_prerelease = version
continue
Expand Down Expand Up @@ -235,13 +236,6 @@ def get_supported_releases(
integration, pypi_data["releases"], older_than
)

# Determine Python support
expected_python_versions = TEST_SUITE_CONFIG[integration].get("python")
if expected_python_versions:
expected_python_versions = SpecifierSet(expected_python_versions)
else:
expected_python_versions = SpecifierSet(f">={MIN_PYTHON_VERSION}")

def _supports_lowest(release: Version) -> bool:
time.sleep(PYPI_COOLDOWN) # don't DoS PYPI

Expand Down Expand Up @@ -356,22 +350,28 @@ def supported_python_versions(
return supported


def pick_python_versions_to_test(python_versions: list[Version]) -> list[Version]:
def pick_python_versions_to_test(
python_versions: list[Version], test_all: bool = False
) -> list[Version]:
"""
Given a list of Python versions, pick those that make sense to test on.

Currently, this is the oldest, the newest, and the second newest Python
version.
"""
filtered_python_versions = {
python_versions[0],
}
if test_all:
filtered_python_versions = python_versions

filtered_python_versions.add(python_versions[-1])
try:
filtered_python_versions.add(python_versions[-2])
except IndexError:
pass
else:
filtered_python_versions = {
python_versions[0],
}

filtered_python_versions.add(python_versions[-1])
try:
filtered_python_versions.add(python_versions[-2])
except IndexError:
pass

return sorted(filtered_python_versions)

Expand Down Expand Up @@ -525,6 +525,9 @@ def _add_python_versions_to_release(

time.sleep(PYPI_COOLDOWN) # give PYPI some breathing room

test_on_all_python_versions = (
TEST_SUITE_CONFIG[integration].get("test_on_all_python_versions") or False
)
target_python_versions = TEST_SUITE_CONFIG[integration].get("python")
if target_python_versions:
target_python_versions = SpecifierSet(target_python_versions)
Expand All @@ -533,7 +536,8 @@ def _add_python_versions_to_release(
supported_python_versions(
determine_python_versions(release_pypi_data),
target_python_versions,
)
),
test_all=test_on_all_python_versions,
)

release.rendered_python_versions = _render_python_versions(release.python_versions)
Expand Down
12 changes: 0 additions & 12 deletions scripts/populate_tox/tox.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ requires =
# This version introduced using pip 24.1 which does not work with older Celery and HTTPX versions.
virtualenv<20.26.3
envlist =
# === Common ===
{py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-common

# === Gevent ===
{py3.8,py3.10,py3.11,py3.12}-gevent

Expand Down Expand Up @@ -161,15 +158,6 @@ deps =
linters: -r requirements-linting.txt
linters: werkzeug<2.3.0

# === Common ===
py3.8-common: hypothesis
common: pytest-asyncio
# See https://github.com/pytest-dev/pytest/issues/9621
# and https://github.com/pytest-dev/pytest-forked/issues/67
# for justification of the upper bound on pytest
py3.7-common: pytest<7.0.0
{py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-common: pytest

# === Gevent ===
{py3.7,py3.8,py3.9,py3.10,py3.11}-gevent: gevent>=22.10.0, <22.11.0
{py3.12}-gevent: gevent
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def get_file_text(file_name):
"openai": ["openai>=1.0.0", "tiktoken>=0.3.0"],
"openfeature": ["openfeature-sdk>=0.7.1"],
"opentelemetry": ["opentelemetry-distro>=0.35b0"],
"opentelemetry-experimental": ["opentelemetry-distro"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unused now

"pure-eval": ["pure_eval", "executing", "asttokens"],
"pymongo": ["pymongo>=3.1"],
"pyspark": ["pyspark>=2.4.4"],
Expand Down
50 changes: 29 additions & 21 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@
# The file (and all resulting CI YAMLs) then need to be regenerated via
# "scripts/generate-test-files.sh".
#
# Last generated: 2025-04-15T14:53:25.426657+00:00
# Last generated: 2025-04-17T09:53:39.706505+00:00

[tox]
requires =
# This version introduced using pip 24.1 which does not work with older Celery and HTTPX versions.
virtualenv<20.26.3
envlist =
# === Common ===
{py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-common

# === Gevent ===
{py3.8,py3.10,py3.11,py3.12}-gevent

Expand Down Expand Up @@ -140,6 +137,13 @@ envlist =
# These come from the populate_tox.py script. Eventually we should move all
# integration tests there.

# ~~~ Common ~~~
{py3.7,py3.8}-common-v0.17b0
{py3.7,py3.8}-common-v0.28b1
{py3.7,py3.8}-common-v0.42b0
{py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-common-v0.53b1


# ~~~ AI ~~~
{py3.8,py3.10,py3.11}-huggingface_hub-v0.22.2
{py3.8,py3.10,py3.11}-huggingface_hub-v0.25.2
Expand Down Expand Up @@ -168,6 +172,7 @@ envlist =
{py3.8,py3.12,py3.13}-launchdarkly-v9.8.1
{py3.8,py3.12,py3.13}-launchdarkly-v9.9.0
{py3.8,py3.12,py3.13}-launchdarkly-v9.10.0
{py3.8,py3.12,py3.13}-launchdarkly-v9.11.0

{py3.8,py3.12,py3.13}-openfeature-v0.7.5
{py3.9,py3.12,py3.13}-openfeature-v0.8.1
Expand Down Expand Up @@ -195,9 +200,9 @@ envlist =
{py3.8,py3.12,py3.13}-graphene-v3.4.3

{py3.8,py3.10,py3.11}-strawberry-v0.209.8
{py3.8,py3.11,py3.12}-strawberry-v0.227.7
{py3.8,py3.11,py3.12}-strawberry-v0.245.0
{py3.9,py3.12,py3.13}-strawberry-v0.264.0
{py3.8,py3.11,py3.12}-strawberry-v0.228.0
{py3.8,py3.12,py3.13}-strawberry-v0.247.2
{py3.9,py3.12,py3.13}-strawberry-v0.265.1


# ~~~ Network ~~~
Expand Down Expand Up @@ -303,15 +308,6 @@ deps =
linters: -r requirements-linting.txt
linters: werkzeug<2.3.0

# === Common ===
py3.8-common: hypothesis
common: pytest-asyncio
# See https://github.com/pytest-dev/pytest/issues/9621
# and https://github.com/pytest-dev/pytest-forked/issues/67
# for justification of the upper bound on pytest
py3.7-common: pytest<7.0.0
{py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-common: pytest

# === Gevent ===
{py3.7,py3.8,py3.9,py3.10,py3.11}-gevent: gevent>=22.10.0, <22.11.0
{py3.12}-gevent: gevent
Expand Down Expand Up @@ -496,6 +492,17 @@ deps =
# These come from the populate_tox.py script. Eventually we should move all
# integration tests there.

# ~~~ Common ~~~
common-v0.17b0: opentelemetry-distro==0.17b0
common-v0.28b1: opentelemetry-distro==0.28b1
common-v0.42b0: opentelemetry-distro==0.42b0
common-v0.53b1: opentelemetry-distro==0.53b1
common: pytest
common: pytest-asyncio
py3.7-common: pytest<7.0.0
py3.8-common: hypothesis


# ~~~ AI ~~~
huggingface_hub-v0.22.2: huggingface_hub==0.22.2
huggingface_hub-v0.25.2: huggingface_hub==0.25.2
Expand Down Expand Up @@ -525,6 +532,7 @@ deps =
launchdarkly-v9.8.1: launchdarkly-server-sdk==9.8.1
launchdarkly-v9.9.0: launchdarkly-server-sdk==9.9.0
launchdarkly-v9.10.0: launchdarkly-server-sdk==9.10.0
launchdarkly-v9.11.0: launchdarkly-server-sdk==9.11.0

openfeature-v0.7.5: openfeature-sdk==0.7.5
openfeature-v0.8.1: openfeature-sdk==0.8.1
Expand Down Expand Up @@ -561,13 +569,13 @@ deps =
py3.6-graphene: aiocontextvars

strawberry-v0.209.8: strawberry-graphql[fastapi,flask]==0.209.8
strawberry-v0.227.7: strawberry-graphql[fastapi,flask]==0.227.7
strawberry-v0.245.0: strawberry-graphql[fastapi,flask]==0.245.0
strawberry-v0.264.0: strawberry-graphql[fastapi,flask]==0.264.0
strawberry-v0.228.0: strawberry-graphql[fastapi,flask]==0.228.0
strawberry-v0.247.2: strawberry-graphql[fastapi,flask]==0.247.2
strawberry-v0.265.1: strawberry-graphql[fastapi,flask]==0.265.1
strawberry: httpx
strawberry-v0.209.8: pydantic<2.11
strawberry-v0.227.7: pydantic<2.11
strawberry-v0.245.0: pydantic<2.11
strawberry-v0.228.0: pydantic<2.11
strawberry-v0.247.2: pydantic<2.11


# ~~~ Network ~~~
Expand Down
Loading