• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 21552830208

31 Jan 2026 11:40PM UTC coverage: 80.277% (-0.05%) from 80.324%
21552830208

Pull #23062

github

web-flow
Merge 808a9786c into 2c4dcf9cf
Pull Request #23062: Remove support for Get

18 of 25 new or added lines in 4 files covered. (72.0%)

17119 existing lines in 541 files now uncovered.

78278 of 97510 relevant lines covered (80.28%)

3.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.89
/src/python/pants/bsp/spec/targets.py
1
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
UNCOV
3
from __future__ import annotations
2✔
4

UNCOV
5
from dataclasses import dataclass
2✔
UNCOV
6
from enum import IntEnum
2✔
UNCOV
7
from typing import Any
2✔
8

UNCOV
9
from pants.bsp.spec.base import BSPData, BuildTarget, BuildTargetIdentifier, Uri
2✔
10

11
# -----------------------------------------------------------------------------------------------
12
# Workspace Build Targets Request
13
# See https://build-server-protocol.github.io/docs/specification.html#workspace-build-targets-request
14
# -----------------------------------------------------------------------------------------------
15

16

UNCOV
17
@dataclass(frozen=True)
2✔
UNCOV
18
class WorkspaceBuildTargetsParams:
2✔
UNCOV
19
    @classmethod
2✔
UNCOV
20
    def from_json_dict(cls, _d):
2✔
UNCOV
21
        return cls()
1✔
22

UNCOV
23
    def to_json_dict(self):
2✔
UNCOV
24
        return {}
1✔
25

26

UNCOV
27
@dataclass(frozen=True)
2✔
UNCOV
28
class WorkspaceBuildTargetsResult:
2✔
UNCOV
29
    targets: tuple[BuildTarget, ...]
2✔
30

UNCOV
31
    @classmethod
2✔
UNCOV
32
    def from_json_dict(cls, d):
2✔
UNCOV
33
        return cls(targets=tuple(BuildTarget.from_json_dict(tgt) for tgt in d["targets"]))
1✔
34

UNCOV
35
    def to_json_dict(self):
2✔
UNCOV
36
        return {"targets": [tgt.to_json_dict() for tgt in self.targets]}
1✔
37

38

39
# -----------------------------------------------------------------------------------------------
40
# Build Target Sources Request
41
# See https://build-server-protocol.github.io/docs/specification.html#build-target-sources-request
42
# -----------------------------------------------------------------------------------------------
43

44

UNCOV
45
@dataclass(frozen=True)
2✔
UNCOV
46
class SourcesParams:
2✔
UNCOV
47
    targets: tuple[BuildTargetIdentifier, ...]
2✔
48

UNCOV
49
    @classmethod
2✔
UNCOV
50
    def from_json_dict(cls, d):
2✔
UNCOV
51
        return cls(
1✔
52
            targets=tuple(BuildTargetIdentifier.from_json_dict(x) for x in d["targets"]),
53
        )
54

UNCOV
55
    def to_json_dict(self):
2✔
UNCOV
56
        return {
1✔
57
            "targets": [tgt.to_json_dict() for tgt in self.targets],
58
        }
59

60

UNCOV
61
class SourceItemKind(IntEnum):
2✔
UNCOV
62
    FILE = 1
2✔
UNCOV
63
    DIRECTORY = 2
2✔
64

65

UNCOV
66
@dataclass(frozen=True)
2✔
UNCOV
67
class SourceItem:
2✔
UNCOV
68
    uri: Uri
2✔
UNCOV
69
    kind: SourceItemKind
2✔
UNCOV
70
    generated: bool = False
2✔
71

UNCOV
72
    @classmethod
2✔
UNCOV
73
    def from_json_dict(cls, d: Any):
2✔
UNCOV
74
        return cls(
1✔
75
            uri=d["uri"],
76
            kind=SourceItemKind(d["kind"]),
77
            generated=d["generated"],
78
        )
79

UNCOV
80
    def to_json_dict(self):
2✔
UNCOV
81
        return {
1✔
82
            "uri": self.uri,
83
            "kind": self.kind.value,
84
            "generated": self.generated,
85
        }
86

87

UNCOV
88
@dataclass(frozen=True)
2✔
UNCOV
89
class SourcesItem:
2✔
UNCOV
90
    target: BuildTargetIdentifier
2✔
UNCOV
91
    sources: tuple[SourceItem, ...]
2✔
UNCOV
92
    roots: tuple[Uri, ...] | None
2✔
93

UNCOV
94
    @classmethod
2✔
UNCOV
95
    def from_json_dict(cls, d: Any):
2✔
UNCOV
96
        return cls(
1✔
97
            target=BuildTargetIdentifier.from_json_dict(d["target"]),
98
            sources=tuple(SourceItem.from_json_dict(i) for i in d["sources"]),
99
            roots=tuple(d.get("sources", ())),
100
        )
101

UNCOV
102
    def to_json_dict(self):
2✔
UNCOV
103
        result = {
1✔
104
            "target": self.target.to_json_dict(),
105
            "sources": [src.to_json_dict() for src in self.sources],
106
        }
UNCOV
107
        if self.roots is not None:
1✔
UNCOV
108
            result["roots"] = list(self.roots)
1✔
UNCOV
109
        return result
1✔
110

111

UNCOV
112
@dataclass(frozen=True)
2✔
UNCOV
113
class SourcesResult:
2✔
UNCOV
114
    items: tuple[SourcesItem, ...]
2✔
115

UNCOV
116
    @classmethod
2✔
UNCOV
117
    def from_json_dict(cls, d: Any):
2✔
UNCOV
118
        return cls(
1✔
119
            items=tuple(SourcesItem.from_json_dict(i) for i in d["items"]),
120
        )
121

UNCOV
122
    def to_json_dict(self):
2✔
UNCOV
123
        return {"items": [item.to_json_dict() for item in self.items]}
1✔
124

125

126
# -----------------------------------------------------------------------------------------------
127
# Dependency Sources Request
128
# See https://build-server-protocol.github.io/docs/specification.html#dependency-sources-request
129
# -----------------------------------------------------------------------------------------------
130

131

UNCOV
132
@dataclass(frozen=True)
2✔
UNCOV
133
class DependencySourcesParams:
2✔
UNCOV
134
    targets: tuple[BuildTargetIdentifier, ...]
2✔
135

UNCOV
136
    @classmethod
2✔
UNCOV
137
    def from_json_dict(cls, d):
2✔
UNCOV
138
        return cls(
1✔
139
            targets=tuple(BuildTargetIdentifier.from_json_dict(x) for x in d["targets"]),
140
        )
141

UNCOV
142
    def to_json_dict(self):
2✔
UNCOV
143
        return {
1✔
144
            "targets": [tgt.to_json_dict() for tgt in self.targets],
145
        }
146

147

UNCOV
148
@dataclass(frozen=True)
2✔
UNCOV
149
class DependencySourcesItem:
2✔
UNCOV
150
    target: BuildTargetIdentifier
2✔
151
    # List of resources containing source files of the
152
    # target's dependencies.
153
    # Can be source files, jar files, zip files, or directories.
UNCOV
154
    sources: tuple[Uri, ...]
2✔
155

UNCOV
156
    def to_json_dict(self) -> dict[str, Any]:
2✔
UNCOV
157
        return {
1✔
158
            "target": self.target.to_json_dict(),
159
            "sources": self.sources,
160
        }
161

162

UNCOV
163
@dataclass(frozen=True)
2✔
UNCOV
164
class DependencySourcesResult:
2✔
UNCOV
165
    items: tuple[DependencySourcesItem, ...]
2✔
166

UNCOV
167
    def to_json_dict(self):
2✔
UNCOV
168
        return {"items": [item.to_json_dict() for item in self.items]}
1✔
169

170

171
# -----------------------------------------------------------------------------------------------
172
# Dependency Modules Request
173
# See https://build-server-protocol.github.io/docs/specification.html#dependency-modules-request
174
# -----------------------------------------------------------------------------------------------
175

176

UNCOV
177
@dataclass(frozen=True)
2✔
UNCOV
178
class DependencyModulesParams:
2✔
UNCOV
179
    targets: tuple[BuildTargetIdentifier, ...]
2✔
180

UNCOV
181
    @classmethod
2✔
UNCOV
182
    def from_json_dict(cls, d):
2✔
183
        return cls(
×
184
            targets=tuple(BuildTargetIdentifier.from_json_dict(x) for x in d["targets"]),
185
        )
186

UNCOV
187
    def to_json_dict(self):
2✔
188
        return {
×
189
            "targets": [tgt.to_json_dict() for tgt in self.targets],
190
        }
191

192

UNCOV
193
@dataclass(frozen=True)
2✔
UNCOV
194
class DependencyModule:
2✔
195
    # Module name
UNCOV
196
    name: str
2✔
197

198
    # Module version
UNCOV
199
    version: str
2✔
200

201
    # Language-specific metadata about this module.
202
    # See MavenDependencyModule as an example.
UNCOV
203
    data: BSPData | None
2✔
204

UNCOV
205
    def to_json_dict(self) -> dict[str, Any]:
2✔
206
        result: dict[str, Any] = {
×
207
            "name": self.name,
208
            "version": self.version,
209
        }
210
        if self.data is not None:
×
211
            result["dataKind"] = self.data.DATA_KIND
×
212
            result["data"] = self.data.to_json_dict()
×
213
        return result
×
214

215

UNCOV
216
@dataclass(frozen=True)
2✔
UNCOV
217
class DependencyModulesItem:
2✔
UNCOV
218
    target: BuildTargetIdentifier
2✔
UNCOV
219
    modules: tuple[DependencyModule, ...]
2✔
220

UNCOV
221
    def to_json_dict(self) -> dict[str, Any]:
2✔
222
        return {
×
223
            "target": self.target.to_json_dict(),
224
            "modules": [m.to_json_dict() for m in self.modules],
225
        }
226

227

UNCOV
228
@dataclass(frozen=True)
2✔
UNCOV
229
class DependencyModulesResult:
2✔
UNCOV
230
    items: tuple[DependencyModulesItem, ...]
2✔
231

UNCOV
232
    def to_json_dict(self):
2✔
233
        return {"items": [item.to_json_dict() for item in self.items]}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc