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

pantsbuild / pants / 25259185675

02 May 2026 06:47PM UTC coverage: 92.141% (-0.8%) from 92.955%
25259185675

push

github

web-flow
Fix the dynamic UI. (#23306)

In #23114 we upgraded to indicatif 0.18.4,
which included a fix to respect TERM, and 
display nothing if it's unset.

Since we did not pass TERM through pantsd, the
dynamic ui is now not shown. 

This change fixes that, and also pass NO_COLOR
through, since indicatif inspects it too.

88773 of 96345 relevant lines covered (92.14%)

3.83 hits per line

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

52.5
/src/python/pants/backend/openapi/goals/tailor.py
1
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from __future__ import annotations
2✔
5

6
import itertools
2✔
7
from collections.abc import Iterable
2✔
8
from dataclasses import dataclass
2✔
9

10
from pants.backend.openapi.dependency_inference import ParseOpenApiSources, parse_openapi_sources
2✔
11
from pants.backend.openapi.subsystems.openapi import OpenApiSubsystem
2✔
12
from pants.backend.openapi.target_types import (
2✔
13
    OPENAPI_FILE_EXTENSIONS,
14
    OpenApiDocumentGeneratorTarget,
15
    OpenApiSourceGeneratorTarget,
16
)
17
from pants.core.goals.tailor import (
2✔
18
    AllOwnedSources,
19
    PutativeTarget,
20
    PutativeTargets,
21
    PutativeTargetsRequest,
22
)
23
from pants.engine.fs import PathGlobs
2✔
24
from pants.engine.intrinsics import path_globs_to_digest, path_globs_to_paths
2✔
25
from pants.engine.rules import Rule, collect_rules, rule
2✔
26
from pants.engine.unions import UnionRule
2✔
27
from pants.util.dirutil import group_by_dir
2✔
28
from pants.util.logging import LogLevel
2✔
29

30

31
@dataclass(frozen=True)
2✔
32
class PutativeOpenApiTargetsRequest(PutativeTargetsRequest):
2✔
33
    pass
2✔
34

35

36
@rule(level=LogLevel.DEBUG, desc="Determine candidate OpenAPI targets to create")
2✔
37
async def find_putative_targets(
2✔
38
    req: PutativeOpenApiTargetsRequest,
39
    all_owned_sources: AllOwnedSources,
40
    openapi_subsystem: OpenApiSubsystem,
41
) -> PutativeTargets:
42
    if not openapi_subsystem.tailor_targets:
×
43
        return PutativeTargets()
×
44

45
    all_openapi_files = await path_globs_to_paths(
×
46
        req.path_globs(*(f"**/openapi{ext}" for ext in OPENAPI_FILE_EXTENSIONS))
47
    )
48
    targets = {*all_openapi_files.files}
×
49
    paths = tuple(targets)
×
50

51
    while paths:
×
52
        digest = await path_globs_to_digest(PathGlobs(paths))
×
53
        result = await parse_openapi_sources(
×
54
            ParseOpenApiSources(
55
                sources_digest=digest,
56
                paths=tuple(paths),
57
            )
58
        )
59

60
        targets.update(result.dependencies.keys())
×
61
        paths = tuple(v for v in itertools.chain(*result.dependencies.values()) if v not in targets)
×
62

63
    unowned_openapi_documents = set(all_openapi_files.files) - set(all_owned_sources)
×
64
    unowned_openapi_sources = targets - set(all_owned_sources)
×
65
    classified_unowned_openapi_files = {
×
66
        OpenApiDocumentGeneratorTarget: unowned_openapi_documents,
67
        OpenApiSourceGeneratorTarget: unowned_openapi_sources,
68
    }
69

70
    putative_targets = []
×
71
    for tgt_type, filepaths in classified_unowned_openapi_files.items():
×
72
        for dirname, filenames in group_by_dir(filepaths).items():
×
73
            name = "openapi" if tgt_type == OpenApiDocumentGeneratorTarget else None
×
74
            putative_targets.append(
×
75
                PutativeTarget.for_target_type(
76
                    tgt_type, path=dirname, name=name, triggering_sources=sorted(filenames)
77
                )
78
            )
79

80
    return PutativeTargets(putative_targets)
×
81

82

83
def rules() -> Iterable[Rule | UnionRule]:
2✔
84
    return (
2✔
85
        *collect_rules(),
86
        UnionRule(PutativeTargetsRequest, PutativeOpenApiTargetsRequest),
87
    )
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