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

pantsbuild / pants / 24638277381

19 Apr 2026 08:21PM UTC coverage: 52.377% (-40.5%) from 92.924%
24638277381

Pull #23274

github

web-flow
Merge 662e70df2 into 0283af69e
Pull Request #23274: rust: upgrade to v1.95.0

31658 of 60443 relevant lines covered (52.38%)

1.05 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
2✔
5

6
from dataclasses import dataclass
2✔
7

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

18

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

24
    default_version = "0.11.6"
2✔
25
    default_known_versions = [
2✔
26
        "0.11.6|macos_arm64 |4b69a4e366ec38cd5f305707de95e12951181c448679a00dce2a78868dfc9f5b|20807020",
27
        "0.11.6|linux_x86_64|aa342a53abe42364093506d7704214d2cdca30b916843e520bc67759a5d20132|24460747",
28
        "0.11.6|linux_arm64 |d14ebd6f200047264152daaf97b8bd36c7885a5033e9e8bba8366cb0049c0d00|22576913",
29
    ]
30
    version_constraints = ">=0.7.4,<1.0"
2✔
31

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

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

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

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

59

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

64
    digest: Digest
2✔
65
    exe: str
2✔
66
    args_for_uv_pip_install: tuple[str, ...]
2✔
67

68

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

78

79
def rules():
2✔
80
    return collect_rules()
2✔
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