Skip to content

Commit 2e64ffd

Browse files
authored
add support for Pants v2.29 (#116)
Add support for Pants v2.29 (which just had its `a0` version released). The main change is that `environment_vars_subset` moved modules so we need to import from the new location.
1 parent 466f856 commit 2e64ffd

File tree

7 files changed

+1653
-4
lines changed

7 files changed

+1653
-4
lines changed

3rdparty/python/BUILD

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
python_requirements(
2+
name="pants-2.29",
3+
source="pants-2.29.txt",
4+
resolve="pants-2.29",
5+
module_mapping={
6+
"opentelemetry-proto": ["opentelemetry.proto"],
7+
"pantsbuild.pants": ["pants"],
8+
"pantsbuild.pants.testutil": ["pants.testutil"],
9+
},
10+
type_stubs_module_mapping={
11+
"types-grpcio": ["grpc"],
12+
},
13+
)
14+
115
python_requirements(
216
name="pants-2.28",
317
source="pants-2.28.txt",

3rdparty/python/pants-2.29.lock

Lines changed: 1593 additions & 0 deletions
Large diffs are not rendered by default.

3rdparty/python/pants-2.29.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Pants dependencies
2+
pantsbuild.pants==2.29.0a0
3+
pantsbuild.pants.testutil==2.29.0a0
4+
5+
# OpenTelemetry dependencies
6+
opentelemetry-api==1.34.1
7+
opentelemetry-sdk==1.34.1
8+
opentelemetry-exporter-otlp==1.34.1
9+
10+
# Test dependencies
11+
pytest
12+
toml==0.10.2
13+
httpx==0.28.1
14+
opentelemetry-proto==1.34.1
15+
grpcio==1.73.1
16+
types-grpcio==1.0.0.20250703
17+
packaging # match version in Pants repository

pants.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[GLOBAL]
2-
pants_version = "2.28.0"
2+
pants_version = "2.29.0a0"
33
backend_packages.add = [
44
"pants.backend.build_files.fmt.black",
55
"pants.backend.plugin_development",
@@ -18,6 +18,7 @@ pip_version = "25.0"
1818
default_resolve = "pants-2.28"
1919

2020
[python.resolves]
21+
"pants-2.29" = "3rdparty/python/pants-2.29.lock"
2122
"pants-2.28" = "3rdparty/python/pants-2.28.lock"
2223
"pants-2.27" = "3rdparty/python/pants-2.27.lock"
2324
"pants-2.26" = "3rdparty/python/pants-2.26.lock"

src/python/shoalsoft/pants_opentelemetry_plugin/BUILD

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@
1414

1515
PLUGIN_VERSION = "0.4.1"
1616

17-
PANTS_MAJOR_MINOR_VERSIONS = ["2.28", "2.27", "2.26", "2.25"]
17+
PANTS_MAJOR_MINOR_VERSIONS = ["2.29", "2.28", "2.27", "2.26", "2.25"]
1818

1919
python_sources(
2020
sources=["*.py", "!*_test.py", "!*_integration_test.py"],
21+
**parametrize(
22+
"pants-2.29",
23+
resolve="pants-2.29",
24+
),
2125
**parametrize(
2226
"pants-2.28",
2327
resolve="pants-2.28",
@@ -39,6 +43,10 @@ python_sources(
3943
python_tests(
4044
name="tests",
4145
sources=["*_test.py", "!*_integration_test.py"],
46+
**parametrize(
47+
"pants-2.29",
48+
resolve="pants-2.29",
49+
),
4250
**parametrize(
4351
"pants-2.28",
4452
resolve="pants-2.28",
@@ -76,6 +84,12 @@ pex_binary(
7684
entry_point="pants",
7785
execution_mode="venv",
7886
layout="zipapp",
87+
**parametrize(
88+
"pants-2.29",
89+
resolve="pants-2.29",
90+
dependencies=["3rdparty/python:pants-2.29#pantsbuild.pants"],
91+
output_path="pants-2.29.pex",
92+
),
7993
**parametrize(
8094
"pants-2.28",
8195
resolve="pants-2.28",

src/python/shoalsoft/pants_opentelemetry_plugin/opentelemetry_integration_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def do_test_of_json_file_exporter(
254254
)
255255

256256

257-
@pytest.mark.parametrize("pants_version_str", ["2.28.0", "2.27.0", "2.26.2", "2.25.3"])
257+
@pytest.mark.parametrize("pants_version_str", ["2.29.0a0", "2.28.0", "2.27.0", "2.26.2", "2.25.3"])
258258
def test_opentelemetry_integration(subtests, pants_version_str: str) -> None:
259259
pants_version = Version(pants_version_str)
260260
pants_major_minor = f"{pants_version.major}.{pants_version.minor}"

src/python/shoalsoft/pants_opentelemetry_plugin/register.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
from pants.base.build_root import BuildRoot
2323
from pants.engine.env_vars import EnvironmentVarsRequest
24-
from pants.engine.internals.platform_rules import environment_vars_subset
2524
from pants.engine.rules import collect_rules, implicitly, rule
2625
from pants.engine.streaming_workunit_handler import (
2726
WorkunitsCallback,
@@ -41,6 +40,17 @@
4140

4241
logger = logging.getLogger(__name__)
4342

43+
44+
try:
45+
from pants.core.util_rules.env_vars import ( # type: ignore[import-not-found,unused-ignore]
46+
environment_vars_subset,
47+
)
48+
except ImportError:
49+
from pants.engine.internals.platform_rules import ( # type: ignore[attr-defined,unused-ignore]
50+
environment_vars_subset,
51+
)
52+
53+
4454
if PANTS_SEMVER >= Version("2.27.0"):
4555

4656
async def get_env_vars(var_names: list[str]):

0 commit comments

Comments
 (0)