• 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

91.3
/src/python/pants/backend/python/util_rules/pex_venv.py
1
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3
from __future__ import annotations
5✔
4

5
from dataclasses import dataclass
5✔
6
from enum import Enum
5✔
7
from pathlib import Path
5✔
8

9
from pants.backend.python.util_rules import pex_cli
5✔
10
from pants.backend.python.util_rules.pex import CompletePlatforms, Pex, PexPlatforms
5✔
11
from pants.backend.python.util_rules.pex_cli import PexCliProcess
5✔
12
from pants.engine.fs import Digest
5✔
13
from pants.engine.internals.native_engine import MergeDigests
5✔
14
from pants.engine.intrinsics import merge_digests
5✔
15
from pants.engine.process import fallible_to_exec_result_or_raise
5✔
16
from pants.engine.rules import collect_rules, implicitly, rule
5✔
17

18

19
class PexVenvLayout(Enum):
5✔
20
    VENV = "venv"
5✔
21
    FLAT = "flat"
5✔
22
    FLAT_ZIPPED = "flat-zipped"
5✔
23

24

25
@dataclass(frozen=True)
5✔
26
class PexVenvRequest:
5✔
27
    pex: Pex
5✔
28
    layout: PexVenvLayout
5✔
29
    output_path: Path
5✔
30
    description: str
5✔
31

32
    platforms: PexPlatforms = PexPlatforms()
5✔
33
    complete_platforms: CompletePlatforms = CompletePlatforms()
5✔
34
    prefix: None | str = None
5✔
35
    extra_args: tuple[str, ...] = ()
5✔
36

37

38
@dataclass(frozen=True)
5✔
39
class PexVenv:
5✔
40
    digest: Digest
5✔
41
    path: Path
5✔
42

43

44
@rule
5✔
45
async def pex_venv(request: PexVenvRequest) -> PexVenv:
5✔
46
    # TODO: create the output with a fixed name and then rename
47
    # (https://github.com/pantsbuild/pants/issues/15102)
48
    if request.layout is PexVenvLayout.FLAT_ZIPPED:
2✔
49
        # --layout=flat-zipped takes --dest-dir=foo and zips it up to `foo.zip`, so we cannot
50
        # directly control the full path until we do a rename
51
        if request.output_path.suffix != ".zip":
2✔
52
            raise ValueError(
×
53
                f"layout=FLAT_ZIPPED requires output_path to end in '.zip', but found output_path='{request.output_path}' ending in {request.output_path.suffix!r}"
54
            )
55
        dest_dir = request.output_path.with_suffix("")
2✔
56
        output_files = [str(request.output_path)]
2✔
57
        output_directories = []
2✔
58
    else:
59
        dest_dir = request.output_path
×
60
        output_files = []
×
61
        output_directories = [str(request.output_path)]
×
62

63
    input_digest = await merge_digests(
2✔
64
        MergeDigests([request.pex.digest, request.complete_platforms.digest])
65
    )
66
    result = await fallible_to_exec_result_or_raise(
2✔
67
        **implicitly(
68
            PexCliProcess(
69
                subcommand=("venv", "create"),
70
                extra_args=(
71
                    f"--dest-dir={dest_dir}",
72
                    f"--pex-repository={request.pex.name}",
73
                    f"--layout={request.layout.value}",
74
                    *((f"--prefix={request.prefix}",) if request.prefix is not None else ()),
75
                    # NB. Specifying more than one of these args doesn't make sense for `venv
76
                    # create`. Incorrect usage will be surfaced as a subprocess failure.
77
                    *request.platforms.generate_pex_arg_list(),
78
                    *request.complete_platforms.generate_pex_arg_list(),
79
                    *request.extra_args,
80
                ),
81
                additional_input_digest=input_digest,
82
                output_files=output_files,
83
                output_directories=output_directories,
84
                description=request.description,
85
            )
86
        )
87
    )
88
    return PexVenv(digest=result.output_digest, path=request.output_path)
2✔
89

90

91
def rules():
5✔
92
    return [*collect_rules(), *pex_cli.rules()]
3✔
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