• 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/python/framework/stevedore/rules.py
1
# Copyright 2023 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
×
7

UNCOV
8
from pants.backend.python.framework.stevedore.python_target_dependencies import (
×
9
    find_python_distributions_with_entry_points_in_stevedore_namespaces,
10
)
UNCOV
11
from pants.backend.python.framework.stevedore.target_types import (
×
12
    StevedoreNamespacesField,
13
    StevedoreNamespacesProviderTargetsRequest,
14
)
UNCOV
15
from pants.backend.python.goals.pytest_runner import PytestPluginSetup, PytestPluginSetupRequest
×
UNCOV
16
from pants.backend.python.target_types import PythonDistribution
×
UNCOV
17
from pants.backend.python.util_rules.entry_points import (
×
18
    GenerateEntryPointsTxtRequest,
19
    generate_entry_points_txt,
20
)
UNCOV
21
from pants.engine.fs import EMPTY_DIGEST
×
UNCOV
22
from pants.engine.rules import Rule, collect_rules, implicitly, rule
×
UNCOV
23
from pants.engine.target import Target
×
UNCOV
24
from pants.engine.unions import UnionRule
×
UNCOV
25
from pants.util.logging import LogLevel
×
26

27

UNCOV
28
class GenerateEntryPointsTxtFromStevedoreExtensionRequest(PytestPluginSetupRequest):
×
UNCOV
29
    @classmethod
×
UNCOV
30
    def is_applicable(cls, target: Target) -> bool:
×
31
        # select python_tests targets with stevedore_namespaces field
32
        return (
×
33
            target.has_field(StevedoreNamespacesField)
34
            and target.get(StevedoreNamespacesField).value is not None
35
        )
36

37

UNCOV
38
@rule(
×
39
    desc=f"Generate entry_points.txt to imitate `{PythonDistribution.alias}` installation.",
40
    level=LogLevel.DEBUG,
41
)
UNCOV
42
async def generate_entry_points_txt_from_stevedore_extension(
×
43
    request: GenerateEntryPointsTxtFromStevedoreExtensionRequest,
44
) -> PytestPluginSetup:
45
    requested_namespaces = request.target[StevedoreNamespacesField]
×
46
    if not requested_namespaces.value:
×
47
        return PytestPluginSetup(EMPTY_DIGEST)
×
48

49
    stevedore_targets = await find_python_distributions_with_entry_points_in_stevedore_namespaces(
×
50
        StevedoreNamespacesProviderTargetsRequest(requested_namespaces), **implicitly()
51
    )
52

53
    requested_namespaces_value = requested_namespaces.value
×
54
    entry_points_txt = await generate_entry_points_txt(
×
55
        GenerateEntryPointsTxtRequest(
56
            stevedore_targets,
57
            lambda tgt, ns: ns in requested_namespaces_value,
58
            lambda tgt, ns, ep_name: True,
59
        )
60
    )
61
    return PytestPluginSetup(entry_points_txt.digest)
×
62

63

UNCOV
64
def rules() -> Iterable[Rule | UnionRule]:
×
UNCOV
65
    return (
×
66
        *collect_rules(),
67
        UnionRule(
68
            PytestPluginSetupRequest,
69
            GenerateEntryPointsTxtFromStevedoreExtensionRequest,
70
        ),
71
    )
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