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

pantsbuild / pants / 20390128985

20 Dec 2025 05:59AM UTC coverage: 80.275% (-0.02%) from 80.296%
20390128985

Pull #21991

github

web-flow
Merge 9294b7195 into 8e0c2b8b0
Pull Request #21991: [WIP] use `uv` for resolving Pants plugins

69 of 109 new or added lines in 4 files covered. (63.3%)

3 existing lines in 2 files now uncovered.

78553 of 97855 relevant lines covered (80.27%)

3.36 hits per line

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

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

4
from pants.core.util_rules import external_tool
12✔
5
from pants.core.util_rules.external_tool import (
12✔
6
    DownloadedExternalTool,
7
    TemplatedExternalTool,
8
    download_external_tool,
9
)
10
from pants.engine.platform import Platform
12✔
11
from pants.engine.rules import collect_rules, rule
12✔
12

13

14
class UvSubsystem(TemplatedExternalTool):
12✔
15
    options_scope = "uv"
12✔
16
    name = "uv"
12✔
17
    help = "UV, An extremely fast Python package and project manager, written in Rust  (https://docs.astral.sh/uv/)"
12✔
18

19
    default_version = "0.7.2"
12✔
20
    default_known_versions = [
12✔
21
        "0.7.2|linux_arm64|2872fdf4785666575d129ba90590c44e6508e22584735f3e7e8a30d773dfc3db|16239004",
22
        "0.7.2|linux_x86_64|cfaab1b5166a6439ff66f020333d3a12bbdf622deee3b510718283e8f06c9de7|17399523",
23
        "0.7.2|macos_arm64|8edc0bea8a9e35409f970b352036326393e79a6039577d8cc9ef63872c178a99|15536108",
24
        "0.7.2|macos_x86_64|7d30b59d54900c97c492f3c07ff21cc3387a9e5bd8ca6db2d502462eaaeefd68|16757236",
25
    ]
26
    default_url_template = (
12✔
27
        "https://github.com/astral-sh/uv/releases/download/{version}/uv-{platform}.tar.gz"
28
    )
29
    default_url_platform_mapping = {
12✔
30
        "linux_arm64": "aarch64-unknown-linux-gnu",
31
        "linux_x86_64": "x86_64-unknown-linux-gnu",
32
        "macos_arm64": "aarch64-apple-darwin",
33
        "macos_x86_64": "x86_64-apple-darwin",
34
    }
35

36
    def generate_exe(self, plat: Platform) -> str:
12✔
NEW
37
        platform = self.url_platform_mapping.get(plat.value, "")
×
NEW
38
        return f"./uv-{platform}/uv"
×
39

40

41
class UvTool(DownloadedExternalTool):
12✔
42
    """The UV tool, downloaded."""
43

44

45
@rule
12✔
46
async def download_uv_tool(uv_subsystem: UvSubsystem, platform: Platform) -> UvTool:
12✔
NEW
47
    pex_pex = await download_external_tool(uv_subsystem.get_request(platform))
×
NEW
48
    return UvTool(digest=pex_pex.digest, exe=pex_pex.exe)
×
49

50

51
def rules():
12✔
52
    return (
4✔
53
        *collect_rules(),
54
        *external_tool.rules(),
55
    )
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

© 2025 Coveralls, Inc