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

pantsbuild / pants / 21552830208

31 Jan 2026 11:40PM UTC coverage: 80.277% (-0.05%) from 80.324%
21552830208

Pull #23062

github

web-flow
Merge 808a9786c into 2c4dcf9cf
Pull Request #23062: Remove support for Get

18 of 25 new or added lines in 4 files covered. (72.0%)

17119 existing lines in 541 files now uncovered.

78278 of 97510 relevant lines covered (80.28%)

3.36 hits per line

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

85.71
/src/python/pants/backend/python/macros/common_fields.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
7✔
5

UNCOV
6
from collections.abc import Iterable
7✔
UNCOV
7
from typing import ClassVar
7✔
8

UNCOV
9
from pants.backend.python.target_types import (
7✔
10
    PythonRequirementModulesField,
11
    PythonRequirementTarget,
12
    PythonRequirementTypeStubModulesField,
13
    normalize_module_mapping,
14
)
UNCOV
15
from pants.engine.addresses import Address
7✔
UNCOV
16
from pants.engine.target import DictStringToStringSequenceField, OverridesField
7✔
UNCOV
17
from pants.util.frozendict import FrozenDict
7✔
UNCOV
18
from pants.util.strutil import help_text
7✔
19

20

UNCOV
21
class ModuleMappingField(DictStringToStringSequenceField):
7✔
UNCOV
22
    alias = "module_mapping"
7✔
UNCOV
23
    help = help_text(
7✔
24
        f"""
25
        A mapping of requirement names to a list of the modules they provide.
26

27
        For example, `{{"ansicolors": ["colors"]}}`.
28

29
        Any unspecified requirements will use a default. See the
30
        `{PythonRequirementModulesField.alias}` field from the `{PythonRequirementTarget.alias}`
31
        target for more information.
32
        """
33
    )
UNCOV
34
    value: FrozenDict[str, tuple[str, ...]]
7✔
UNCOV
35
    default: ClassVar[FrozenDict[str, tuple[str, ...]]] = FrozenDict()
7✔
36

UNCOV
37
    @classmethod
7✔
UNCOV
38
    def compute_value(  # type: ignore[override]
7✔
39
        cls, raw_value: dict[str, Iterable[str]], address: Address
40
    ) -> FrozenDict[str, tuple[str, ...]]:
41
        value_or_default = super().compute_value(raw_value, address)
×
42
        return normalize_module_mapping(value_or_default)
×
43

44

UNCOV
45
class TypeStubsModuleMappingField(DictStringToStringSequenceField):
7✔
UNCOV
46
    alias = "type_stubs_module_mapping"
7✔
UNCOV
47
    help = help_text(
7✔
48
        f"""
49
        A mapping of type-stub requirement names to a list of the modules they provide.
50

51
        For example, `{{"types-requests": ["requests"]}}`.
52

53
        If the requirement is not specified _and_ its name looks like a type stub, Pants will
54
        use a default. See the `{PythonRequirementTypeStubModulesField.alias}` field from the
55
        `{PythonRequirementTarget.alias}` target for more information.
56
        """
57
    )
UNCOV
58
    value: FrozenDict[str, tuple[str, ...]]
7✔
UNCOV
59
    default: ClassVar[FrozenDict[str, tuple[str, ...]]] = FrozenDict()
7✔
60

UNCOV
61
    @classmethod
7✔
UNCOV
62
    def compute_value(  # type: ignore[override]
7✔
63
        cls, raw_value: dict[str, Iterable[str]], address: Address
64
    ) -> FrozenDict[str, tuple[str, ...]]:
65
        value_or_default = super().compute_value(raw_value, address)
×
66
        return normalize_module_mapping(value_or_default)
×
67

68

UNCOV
69
class RequirementsOverrideField(OverridesField):
7✔
UNCOV
70
    help = help_text(
7✔
71
        """
72
        Override the field values for generated `python_requirement` targets.
73

74
        Expects a dictionary of requirements to a dictionary for the
75
        overrides. You may either use a string for a single requirement,
76
        or a string tuple for multiple requirements. Each override is a dictionary of
77
        field names to the overridden value.
78

79
        For example:
80

81
            overrides={
82
                "django": {"dependencies": ["#setuptools"]},
83
                "ansicolors": {"description": "pretty colors"]},
84
                ("ansicolors, "django"): {"tags": ["overridden"]},
85
            }
86

87
        Every overridden requirement is validated to be generated by this target.
88

89
        You can specify the same requirement in multiple keys, so long as you don't
90
        override the same field more than one time for the requirement.
91
        """
92
    )
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