• 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

76.92
/src/python/pants/bsp/spec/compile.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 typing import Any
2✔
7

UNCOV
8
from pants.bsp.spec.base import BuildTargetIdentifier
2✔
9

10
# -----------------------------------------------------------------------------------------------
11
# Compile Request
12
# See https://build-server-protocol.github.io/docs/specification.html#compile-request
13
# -----------------------------------------------------------------------------------------------
14

15

UNCOV
16
@dataclass(frozen=True)
2✔
UNCOV
17
class CompileParams:
2✔
18
    # A sequence of build targets to compile.
UNCOV
19
    targets: tuple[BuildTargetIdentifier, ...]
2✔
20

21
    # A unique identifier generated by the client to identify this request.
22
    # The server may include this id in triggered notifications or responses.
UNCOV
23
    origin_id: str | None = None
2✔
24

25
    # Optional arguments to the compilation process.
UNCOV
26
    arguments: tuple[str, ...] | None = ()
2✔
27

UNCOV
28
    @classmethod
2✔
UNCOV
29
    def from_json_dict(cls, d: dict[str, Any]) -> Any:
2✔
UNCOV
30
        return cls(
1✔
31
            targets=tuple(BuildTargetIdentifier.from_json_dict(x) for x in d["targets"]),
32
            origin_id=d.get("originId"),
33
            arguments=tuple(d["arguments"]) if "arguments" in d else None,
34
        )
35

UNCOV
36
    def to_json_dict(self) -> dict[str, Any]:
2✔
UNCOV
37
        result: dict[str, Any] = {"targets": [tgt.to_json_dict() for tgt in self.targets]}
1✔
UNCOV
38
        if self.origin_id is not None:
1✔
39
            result["originId"] = self.origin_id
×
UNCOV
40
        if self.arguments is not None:
1✔
UNCOV
41
            result["arguments"] = self.arguments
1✔
UNCOV
42
        return result
1✔
43

44

UNCOV
45
@dataclass(frozen=True)
2✔
UNCOV
46
class CompileResult:
2✔
47
    # An optional request id to know the origin of this report.
UNCOV
48
    origin_id: str | None
2✔
49

50
    # A status code for the execution.
UNCOV
51
    status_code: int
2✔
52

53
    # Kind of data to expect in the `data` field. If this field is not set, the kind of data is not specified.
UNCOV
54
    data_kind: str | None = None
2✔
55

56
    # A field containing language-specific information, like products
57
    # of compilation or compiler-specific metadata the client needs to know.
UNCOV
58
    data: Any | None = None
2✔
59

UNCOV
60
    @classmethod
2✔
UNCOV
61
    def from_json_dict(cls, d: dict[str, Any]) -> Any:
2✔
UNCOV
62
        return cls(
1✔
63
            origin_id=d.get("originId"),
64
            status_code=d["statusCode"],
65
            data_kind=d.get("dataKind"),
66
            data=d.get("data"),
67
        )
68

UNCOV
69
    def to_json_dict(self) -> dict[str, Any]:
2✔
UNCOV
70
        result: dict[str, Any] = {
1✔
71
            "statusCode": self.status_code,
72
        }
UNCOV
73
        if self.origin_id is not None:
1✔
74
            result["originId"] = self.origin_id
×
UNCOV
75
        if self.data_kind is not None:
1✔
76
            result["dataKind"] = self.data_kind
×
UNCOV
77
        if self.data is not None:
1✔
78
            result["data"] = self.data  # TODO: Enforce to_json_dict available
×
UNCOV
79
        return result
1✔
80

81

UNCOV
82
@dataclass(frozen=True)
2✔
UNCOV
83
class CompileTask:
2✔
UNCOV
84
    target: BuildTargetIdentifier
2✔
85

UNCOV
86
    @classmethod
2✔
UNCOV
87
    def from_json_dict(cls, d: dict[str, Any]) -> Any:
2✔
88
        return cls(target=BuildTargetIdentifier.from_json_dict(d["target"]))
×
89

UNCOV
90
    def to_json_dict(self) -> dict[str, Any]:
2✔
91
        return {"target": self.target.to_json_dict()}
×
92

93

UNCOV
94
@dataclass(frozen=True)
2✔
UNCOV
95
class CompileReport:
2✔
96
    # The build target that was compiled
UNCOV
97
    target: BuildTargetIdentifier
2✔
98

99
    # An optional request id to know the origin of this report.
UNCOV
100
    origin_id: str | None
2✔
101

102
    # The total number of reported errors compiling this target.
UNCOV
103
    errors: int
2✔
104

105
    # The total number of reported warnings compiling the target.
UNCOV
106
    warnings: int
2✔
107

108
    # The total number of milliseconds it took to compile the target.
UNCOV
109
    time: int | None = None
2✔
110

111
    # The compilation was a noOp compilation.
UNCOV
112
    no_op: bool | None = None
2✔
113

UNCOV
114
    @classmethod
2✔
UNCOV
115
    def from_json_dict(cls, d: dict[str, Any]) -> Any:
2✔
116
        return cls(
×
117
            target=BuildTargetIdentifier.from_json_dict(d["target"]),
118
            origin_id=d.get("originId"),
119
            errors=d["errors"],
120
            warnings=d["warnings"],
121
            time=d.get("time"),
122
            no_op=d.get("noOp"),
123
        )
124

UNCOV
125
    def to_json_dict(self) -> dict[str, Any]:
2✔
126
        result = {
×
127
            "target": self.target.to_json_dict(),
128
            "errors": self.errors,
129
            "warnings": self.warnings,
130
        }
131
        if self.origin_id is not None:
×
132
            result["originId"] = self.origin_id
×
133
        if self.time is not None:
×
134
            result["time"] = self.time
×
135
        if self.no_op is not None:
×
136
            result["noOp"] = self.no_op
×
137
        return result
×
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