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

pantsbuild / pants / 24145945949

08 Apr 2026 04:14PM UTC coverage: 82.077% (-10.8%) from 92.91%
24145945949

Pull #23233

github

web-flow
Merge 089d98e3c into 9036734c9
Pull Request #23233: Introduce a LockfileFormat enum.

8 of 11 new or added lines in 4 files covered. (72.73%)

7635 existing lines in 306 files now uncovered.

63732 of 77649 relevant lines covered (82.08%)

2.96 hits per line

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

87.5
/src/python/pants/backend/python/subsystems/uv.py
1
# Copyright 2026 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from __future__ import annotations
7✔
5

6
from dataclasses import dataclass
7✔
7

8
from pants.core.util_rules.external_tool import (
7✔
9
    TemplatedExternalTool,
10
    download_external_tool,
11
)
12
from pants.engine.fs import Digest
7✔
13
from pants.engine.platform import Platform
7✔
14
from pants.engine.rules import collect_rules, rule
7✔
15
from pants.option.option_types import ArgsListOption
7✔
16
from pants.util.strutil import softwrap
7✔
17

18

19
class Uv(TemplatedExternalTool):
7✔
20
    options_scope = "uv"
7✔
21
    name = "uv"
7✔
22
    help = "The uv Python package manager (https://github.com/astral-sh/uv)."
7✔
23

24
    default_version = "0.6.14"
7✔
25
    default_known_versions = [
7✔
26
        "0.6.14|macos_x86_64|1d8ecb2eb3b68fb50e4249dc96ac9d2458dc24068848f04f4c5b42af2fd26552|16276555",
27
        "0.6.14|macos_arm64|4ea4731010fbd1bc8e790e07f199f55a5c7c2c732e9b77f85e302b0bee61b756|15138933",
28
        "0.6.14|linux_x86_64|0cac4df0cb3457b154f2039ae471e89cd4e15f3bd790bbb3cb0b8b40d940b93e|17032361",
29
        "0.6.14|linux_arm64|94e22c4be44d205def456427639ca5ca1c1a9e29acc31808a7b28fdd5dcf7f17|15577079",
30
    ]
31
    version_constraints = ">=0.6.0,<1.0"
7✔
32

33
    default_url_template = (
7✔
34
        "https://github.com/astral-sh/uv/releases/download/{version}/uv-{platform}.tar.gz"
35
    )
36
    default_url_platform_mapping = {
7✔
37
        "linux_arm64": "aarch64-unknown-linux-musl",
38
        "linux_x86_64": "x86_64-unknown-linux-musl",
39
        "macos_arm64": "aarch64-apple-darwin",
40
        "macos_x86_64": "x86_64-apple-darwin",
41
    }
42

43
    def generate_exe(self, plat: Platform) -> str:
7✔
UNCOV
44
        platform = self.default_url_platform_mapping[plat.value]
×
UNCOV
45
        return f"./uv-{platform}/uv"
×
46

47
    args_for_uv_pip_install = ArgsListOption(
7✔
48
        tool_name="uv",
49
        example="--index-strategy unsafe-first-match",
50
        extra_help=softwrap(
51
            """
52
            Additional arguments to pass to `uv pip install` invocations.
53

54
            Used when `[python].pex_builder = "uv"` to pass extra flags to the
55
            `uv pip install` step (e.g. `--index-url`, `--extra-index-url`).
56
            These are NOT passed to the `uv venv` step.
57
            """
58
        ),
59
    )
60

61

62
@dataclass(frozen=True)
7✔
63
class DownloadedUv:
7✔
64
    """The downloaded uv binary with user-configured args."""
65

66
    digest: Digest
7✔
67
    exe: str
7✔
68
    args_for_uv_pip_install: tuple[str, ...]
7✔
69

70

71
@rule
7✔
72
async def download_uv_binary(uv: Uv, platform: Platform) -> DownloadedUv:
7✔
UNCOV
73
    downloaded = await download_external_tool(uv.get_request(platform))
×
UNCOV
74
    return DownloadedUv(
×
75
        digest=downloaded.digest,
76
        exe=downloaded.exe,
77
        args_for_uv_pip_install=tuple(uv.args_for_uv_pip_install),
78
    )
79

80

81
def rules():
7✔
82
    return collect_rules()
7✔
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