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

pantsbuild / pants / 19015773527

02 Nov 2025 05:33PM UTC coverage: 17.872% (-62.4%) from 80.3%
19015773527

Pull #22816

github

web-flow
Merge a12d75757 into 6c024e162
Pull Request #22816: Update Pants internal Python to 3.14

4 of 5 new or added lines in 3 files covered. (80.0%)

28452 existing lines in 683 files now uncovered.

9831 of 55007 relevant lines covered (17.87%)

0.18 hits per line

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

0.0
/src/python/pants/backend/helm/dependency_inference/subsystem.py
1
# Copyright 2024 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
UNCOV
3
from __future__ import annotations
×
4

UNCOV
5
from enum import Enum
×
UNCOV
6
from functools import cached_property
×
7

UNCOV
8
from pants.option.option_types import BoolOption, EnumOption, StrListOption
×
UNCOV
9
from pants.option.subsystem import Subsystem
×
UNCOV
10
from pants.util.strutil import softwrap
×
11

12

UNCOV
13
class UnownedHelmDependencyUsage(Enum):
×
14
    """What action to take when an inferred dependency is unowned."""
15

UNCOV
16
    RaiseError = "error"
×
UNCOV
17
    LogWarning = "warning"
×
UNCOV
18
    DoNothing = "ignore"
×
19

20

UNCOV
21
class UnownedDependencyError(Exception):
×
22
    """The inferred dependency does not have any owner."""
23

24

UNCOV
25
class HelmInferSubsystem(Subsystem):
×
26
    """Settings controlling the dependency inference behaviour of the Helm backend.
27

28
    Adding "*" to `external_docker_images` is different from setting `unowned_dependency_behavior`
29
    to something other than "error". The key is that `external_docker_images` with "*" will only
30
    allow anything that could be a docker image, but will still raise errors for other inference
31
    problems.
32
    """
33

UNCOV
34
    options_scope = "helm-infer"
×
UNCOV
35
    help = "Options controlling which dependencies will be inferred for Helm targets."
×
36

UNCOV
37
    unowned_dependency_behavior = EnumOption(
×
38
        default=UnownedHelmDependencyUsage.RaiseError,
39
        help=softwrap(
40
            """
41
            How to handle inferred dependencies that don't have an inferable owner.
42

43
            Usually when an import cannot be inferred, it represents an issue like Pants not being
44
            properly configured, e.g. targets not set up. Often, missing dependencies will result
45
            in confusing runtime errors where Docker images haven't been published,
46
            so this option can be helpful to error more eagerly.
47
            """
48
        ),
49
    )
50

UNCOV
51
    external_docker_images = StrListOption(
×
52
        default=[],
53
        help=softwrap(
54
            """
55
            Docker image names that are not provided by targets in this repository
56
            and should be ignored for calculating dependencies.
57

58
            For example, adding `python` to this setting
59
            will cause Pants to not try to find the target `python:3.10`
60
            in the following `helm_deployment`:
61

62
            ```
63
            helm_deployment(
64
                name="my-deployment",
65
                chart=":mychart",
66
                values={"container.image_ref": "python:3.10"},
67
            )
68
            ```
69

70
            Use Python fnmatch glob syntax (ex: 'docker.io/*') to disable this
71
            check for certain images or patterns.  This will limit Pants's
72
            ability to warn on unknown docker images.
73
            """
74
        ),
75
    )
76

UNCOV
77
    deployment_dependencies = BoolOption(
×
78
        default=True,
79
        help="If true, parse k8s manifests generated by helm to find dependencies on other targets like docker images.",
80
        advanced=True,
81
    )
82

UNCOV
83
    @cached_property
×
UNCOV
84
    def external_base_images(self) -> set[str]:
×
85
        return set(self.external_docker_images)
×
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