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

pantsbuild / pants / 20332790708

18 Dec 2025 09:48AM UTC coverage: 64.992% (-15.3%) from 80.295%
20332790708

Pull #22949

github

web-flow
Merge f730a56cd into 407284c67
Pull Request #22949: Add experimental uv resolver for Python lockfiles

54 of 97 new or added lines in 5 files covered. (55.67%)

8270 existing lines in 295 files now uncovered.

48990 of 75379 relevant lines covered (64.99%)

1.81 hits per line

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

0.0
/src/python/pants/backend/cc/goals/tailor.py
1
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

UNCOV
4
from __future__ import annotations
×
5

UNCOV
6
from collections.abc import Iterable
×
UNCOV
7
from dataclasses import dataclass
×
8

UNCOV
9
from pants.backend.cc.target_types import CC_FILE_EXTENSIONS, CCSourcesGeneratorTarget
×
UNCOV
10
from pants.core.goals.tailor import (
×
11
    AllOwnedSources,
12
    PutativeTarget,
13
    PutativeTargets,
14
    PutativeTargetsRequest,
15
)
UNCOV
16
from pants.engine.intrinsics import path_globs_to_paths
×
UNCOV
17
from pants.engine.rules import collect_rules, rule
×
UNCOV
18
from pants.engine.target import Target
×
UNCOV
19
from pants.engine.unions import UnionRule
×
UNCOV
20
from pants.util.dirutil import group_by_dir
×
UNCOV
21
from pants.util.logging import LogLevel
×
22

23

UNCOV
24
@dataclass(frozen=True)
×
UNCOV
25
class PutativeCCTargetsRequest(PutativeTargetsRequest):
×
UNCOV
26
    pass
×
27

28

UNCOV
29
def classify_source_files(paths: Iterable[str]) -> dict[type[Target], set[str]]:
×
30
    """Returns a dict of target type -> files that belong to targets of that type."""
31
    sources_files = set(paths)
×
32
    return {CCSourcesGeneratorTarget: sources_files}
×
33

34

UNCOV
35
@rule(level=LogLevel.DEBUG, desc="Determine candidate CC targets to create")
×
UNCOV
36
async def find_putative_targets(
×
37
    req: PutativeCCTargetsRequest,
38
    all_owned_sources: AllOwnedSources,
39
) -> PutativeTargets:
40
    all_cc_files = await path_globs_to_paths(
×
41
        req.path_globs(*(f"*{ext}" for ext in CC_FILE_EXTENSIONS))
42
    )
43
    unowned_cc_files = set(all_cc_files.files) - set(all_owned_sources)
×
44
    classified_unowned_kotlin_files = classify_source_files(unowned_cc_files)
×
45

46
    putative_targets: list[PutativeTarget] = []
×
47
    for tgt_type, paths in classified_unowned_kotlin_files.items():
×
48
        for dirname, filenames in group_by_dir(paths).items():
×
49
            putative_targets.append(
×
50
                PutativeTarget.for_target_type(
51
                    tgt_type, path=dirname, name=None, triggering_sources=sorted(filenames)
52
                )
53
            )
54

55
    return PutativeTargets(putative_targets)
×
56

57

UNCOV
58
def rules():
×
UNCOV
59
    return [
×
60
        *collect_rules(),
61
        UnionRule(PutativeTargetsRequest, PutativeCCTargetsRequest),
62
    ]
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