• 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/go/util_rules/import_config.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
import logging
×
UNCOV
7
from dataclasses import dataclass
×
UNCOV
8
from operator import itemgetter
×
UNCOV
9
from typing import ClassVar
×
10

UNCOV
11
from pants.backend.go.util_rules.build_opts import GoBuildOptions
×
UNCOV
12
from pants.engine.fs import CreateDigest, FileContent
×
UNCOV
13
from pants.engine.internals.native_engine import Digest
×
UNCOV
14
from pants.engine.intrinsics import create_digest
×
UNCOV
15
from pants.engine.rules import collect_rules, rule
×
UNCOV
16
from pants.util.frozendict import FrozenDict
×
17

UNCOV
18
logger = logging.getLogger(__name__)
×
19

20

UNCOV
21
@dataclass(frozen=True)
×
UNCOV
22
class ImportConfig:
×
23
    """An `importcfg` file associating import paths to their `__pkg__.a` files."""
24

UNCOV
25
    digest: Digest
×
26

UNCOV
27
    CONFIG_PATH: ClassVar[str] = "./importcfg"
×
28

29

UNCOV
30
@dataclass(frozen=True)
×
UNCOV
31
class ImportConfigRequest:
×
32
    """Create an `importcfg` file associating import paths to their `__pkg__.a` files."""
33

UNCOV
34
    import_paths_to_pkg_a_files: FrozenDict[str, str]
×
UNCOV
35
    build_opts: GoBuildOptions
×
UNCOV
36
    import_map: FrozenDict[str, str] | None = None
×
37

38

UNCOV
39
@rule
×
UNCOV
40
async def generate_import_config(request: ImportConfigRequest) -> ImportConfig:
×
41
    key_fn = itemgetter(0)
×
42
    packages = sorted(request.import_paths_to_pkg_a_files.items(), key=key_fn)
×
43
    import_map = sorted((request.import_map or {}).items(), key=key_fn)
×
44
    lines = [
×
45
        "# import config",
46
        *(f"packagefile {import_path}={pkg_a_path}" for import_path, pkg_a_path in packages),
47
        *(f"importmap {old}={new}" for old, new in import_map),
48
    ]
49
    content = "\n".join(lines).encode("utf-8")
×
50
    result = await create_digest(CreateDigest([FileContent(ImportConfig.CONFIG_PATH, content)]))
×
51
    return ImportConfig(result)
×
52

53

UNCOV
54
def rules():
×
UNCOV
55
    return collect_rules()
×
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