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

pantsbuild / pants / 24145062409

08 Apr 2026 03:56PM UTC coverage: 52.369% (-40.5%) from 92.91%
24145062409

Pull #23233

github

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

7 of 10 new or added lines in 3 files covered. (70.0%)

23048 existing lines in 605 files now uncovered.

31656 of 60448 relevant lines covered (52.37%)

0.52 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
1✔
5

6
from dataclasses import dataclass
1✔
7

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

18

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

24
    default_version = "0.6.14"
1✔
25
    default_known_versions = [
1✔
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"
1✔
32

33
    default_url_template = (
1✔
34
        "https://github.com/astral-sh/uv/releases/download/{version}/uv-{platform}.tar.gz"
35
    )
36
    default_url_platform_mapping = {
1✔
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:
1✔
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(
1✔
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)
1✔
63
class DownloadedUv:
1✔
64
    """The downloaded uv binary with user-configured args."""
65

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

70

71
@rule
1✔
72
async def download_uv_binary(uv: Uv, platform: Platform) -> DownloadedUv:
1✔
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():
1✔
82
    return collect_rules()
1✔
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