• 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/google_cloud_function/python/rules.py
1
# Copyright 2019 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
import logging
×
UNCOV
7
from dataclasses import dataclass
×
8

UNCOV
9
from pants.backend.google_cloud_function.python.target_types import (
×
10
    PythonGoogleCloudFunction,
11
    PythonGoogleCloudFunctionHandlerField,
12
    PythonGoogleCloudFunctionRuntime,
13
    PythonGoogleCloudFunctionType,
14
)
UNCOV
15
from pants.backend.python.util_rules.faas import (
×
16
    BuildPythonFaaSRequest,
17
    FaaSArchitecture,
18
    PythonFaaSCompletePlatforms,
19
    PythonFaaSLayoutField,
20
    PythonFaaSPex3VenvCreateExtraArgsField,
21
    PythonFaaSPexBuildExtraArgs,
22
    build_python_faas,
23
)
UNCOV
24
from pants.backend.python.util_rules.faas import rules as faas_rules
×
UNCOV
25
from pants.core.environments.target_types import EnvironmentField
×
UNCOV
26
from pants.core.goals.package import BuiltPackage, OutputPathField, PackageFieldSet
×
UNCOV
27
from pants.engine.rules import collect_rules, rule
×
UNCOV
28
from pants.engine.unions import UnionRule
×
UNCOV
29
from pants.util.logging import LogLevel
×
30

UNCOV
31
logger = logging.getLogger(__name__)
×
32

33

UNCOV
34
@dataclass(frozen=True)
×
UNCOV
35
class PythonGoogleCloudFunctionFieldSet(PackageFieldSet):
×
UNCOV
36
    required_fields = (PythonGoogleCloudFunctionHandlerField,)
×
37

UNCOV
38
    handler: PythonGoogleCloudFunctionHandlerField
×
UNCOV
39
    runtime: PythonGoogleCloudFunctionRuntime
×
UNCOV
40
    complete_platforms: PythonFaaSCompletePlatforms
×
UNCOV
41
    pex3_venv_create_extra_args: PythonFaaSPex3VenvCreateExtraArgsField
×
UNCOV
42
    pex_build_extra_args: PythonFaaSPexBuildExtraArgs
×
UNCOV
43
    layout: PythonFaaSLayoutField
×
UNCOV
44
    type: PythonGoogleCloudFunctionType
×
UNCOV
45
    output_path: OutputPathField
×
UNCOV
46
    environment: EnvironmentField
×
47

48

UNCOV
49
@rule(desc="Create Python Google Cloud Function", level=LogLevel.DEBUG)
×
UNCOV
50
async def package_python_google_cloud_function(
×
51
    field_set: PythonGoogleCloudFunctionFieldSet,
52
) -> BuiltPackage:
UNCOV
53
    return await build_python_faas(
×
54
        BuildPythonFaaSRequest(
55
            address=field_set.address,
56
            target_name=PythonGoogleCloudFunction.alias,
57
            complete_platforms=field_set.complete_platforms,
58
            runtime=field_set.runtime,
59
            # GCF only supports x86_64 architecture for now.
60
            architecture=FaaSArchitecture.X86_64,
61
            handler=field_set.handler,
62
            pex3_venv_create_extra_args=field_set.pex3_venv_create_extra_args,
63
            pex_build_extra_args=field_set.pex_build_extra_args,
64
            layout=field_set.layout,
65
            output_path=field_set.output_path,
66
            include_requirements=True,
67
            include_sources=True,
68
            reexported_handler_module=PythonGoogleCloudFunctionHandlerField.reexported_handler_module,
69
            log_only_reexported_handler_func=True,
70
        )
71
    )
72

73

UNCOV
74
def rules():
×
UNCOV
75
    return [
×
76
        *collect_rules(),
77
        UnionRule(PackageFieldSet, PythonGoogleCloudFunctionFieldSet),
78
        *faas_rules(),
79
    ]
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