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

pantsbuild / pants / 20147226056

11 Dec 2025 08:58PM UTC coverage: 78.827% (-1.5%) from 80.293%
20147226056

push

github

web-flow
Forwarded the `style` and `complete-platform` args from pants.toml to PEX (#22910)

## Context

After Apple switched to the `arm64` architecture, some package
publishers stopped releasing `x86_64` variants of their packages for
`darwin`. As a result, generating a universal lockfile now fails because
no single package version is compatible with both `x86_64` and `arm64`
on `darwin`.

The solution is to use the `--style` and `--complete-platform` flags
with PEX. For example:
```
pex3 lock create \
    --style strict \
    --complete-platform 3rdparty/platforms/manylinux_2_28_aarch64.json \
    --complete-platform 3rdparty/platforms/macosx_26_0_arm64.json \
    -r 3rdparty/python/requirements_pyarrow.txt \
    -o python-pyarrow.lock
```

See the Slack discussion here:
https://pantsbuild.slack.com/archives/C046T6T9U/p1760098582461759

## Reproduction

* `BUILD`
```
python_requirement(
    name="awswrangler",
    requirements=["awswrangler==3.12.1"],
    resolve="awswrangler",
)
```
* Run `pants generate-lockfiles --resolve=awswrangler` on macOS with an
`arm64` CPU
```
pip: ERROR: Cannot install awswrangler==3.12.1 because these package versions have conflicting dependencies.
pip: ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
pip:  
pip:  The conflict is caused by:
pip:      awswrangler 3.12.1 depends on pyarrow<18.0.0 and >=8.0.0; sys_platform == "darwin" and platform_machine == "x86_64"
pip:      awswrangler 3.12.1 depends on pyarrow<21.0.0 and >=18.0.0; sys_platform != "darwin" or platform_machine != "x86_64"
pip:  
pip:  Additionally, some packages in these conflicts have no matching distributions available for your environment:
pip:      pyarrow
pip:  
pip:  To fix this you could try to:
pip:  1. loosen the range of package versions you've specified
pip:  2. remove package versions to allow pip to attempt to solve the dependency conflict
```

## Implementation
... (continued)

77 of 100 new or added lines in 6 files covered. (77.0%)

868 existing lines in 42 files now uncovered.

74471 of 94474 relevant lines covered (78.83%)

3.18 hits per line

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

0.0
/src/python/pants/backend/javascript/goals/tailor.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
×
5

UNCOV
6
import dataclasses
×
UNCOV
7
import os
×
UNCOV
8
from collections.abc import Iterable
×
UNCOV
9
from dataclasses import dataclass
×
10

UNCOV
11
from pants.backend.javascript.package_json import PackageJsonTarget
×
UNCOV
12
from pants.backend.javascript.target_types import (
×
13
    JS_FILE_EXTENSIONS,
14
    JSSourcesGeneratorTarget,
15
    JSTestsGeneratorSourcesField,
16
    JSTestsGeneratorTarget,
17
)
UNCOV
18
from pants.core.goals.tailor import (
×
19
    AllOwnedSources,
20
    PutativeTarget,
21
    PutativeTargets,
22
    PutativeTargetsRequest,
23
)
UNCOV
24
from pants.core.util_rules.ownership import get_unowned_files_for_globs
×
UNCOV
25
from pants.core.util_rules.source_files import classify_files_for_sources_and_tests
×
UNCOV
26
from pants.engine.rules import Rule, collect_rules, rule
×
UNCOV
27
from pants.engine.unions import UnionRule
×
UNCOV
28
from pants.util.dirutil import group_by_dir
×
UNCOV
29
from pants.util.logging import LogLevel
×
30

31

UNCOV
32
@dataclass(frozen=True)
×
UNCOV
33
class PutativeJSTargetsRequest(PutativeTargetsRequest):
×
UNCOV
34
    pass
×
35

36

UNCOV
37
@dataclass(frozen=True)
×
UNCOV
38
class PutativePackageJsonTargetsRequest(PutativeTargetsRequest):
×
UNCOV
39
    pass
×
40

41

UNCOV
42
_LOG_DESCRIPTION_TEMPLATE = "Determine candidate {} to create"
×
43

44

UNCOV
45
@rule(level=LogLevel.DEBUG, desc=_LOG_DESCRIPTION_TEMPLATE.format("JS targets"))
×
UNCOV
46
async def find_putative_js_targets(
×
47
    req: PutativeJSTargetsRequest, all_owned_sources: AllOwnedSources
48
) -> PutativeTargets:
49
    unowned_js_files = await get_unowned_files_for_globs(
×
50
        req, all_owned_sources, (f"*{ext}" for ext in JS_FILE_EXTENSIONS)
51
    )
52
    classified_unowned_js_files = classify_files_for_sources_and_tests(
×
53
        paths=unowned_js_files,
54
        test_file_glob=JSTestsGeneratorSourcesField.default,
55
        sources_generator=JSSourcesGeneratorTarget,
56
        tests_generator=JSTestsGeneratorTarget,
57
    )
58

59
    return PutativeTargets(
×
60
        PutativeTarget.for_target_type(
61
            tgt_type, path=dirname, name=name, triggering_sources=sorted(filenames)
62
        )
63
        for tgt_type, paths, name in (dataclasses.astuple(f) for f in classified_unowned_js_files)
64
        for dirname, filenames in group_by_dir(paths).items()
65
    )
66

67

UNCOV
68
@rule(level=LogLevel.DEBUG, desc=_LOG_DESCRIPTION_TEMPLATE.format("package.json targets"))
×
UNCOV
69
async def find_putative_package_json_targets(
×
70
    req: PutativePackageJsonTargetsRequest, all_owned_sources: AllOwnedSources
71
) -> PutativeTargets:
72
    unowned_package_json_files = await get_unowned_files_for_globs(
×
73
        req, all_owned_sources, (f"**{os.path.sep}package.json",)
74
    )
75

76
    putative_targets = [
×
77
        PutativeTarget.for_target_type(
78
            PackageJsonTarget, path=dirname, name=None, triggering_sources=[filename]
79
        )
80
        for dirname, filename in (os.path.split(file) for file in unowned_package_json_files)
81
    ]
82

83
    return PutativeTargets(putative_targets)
×
84

85

UNCOV
86
def rules() -> Iterable[Rule | UnionRule]:
×
UNCOV
87
    return (
×
88
        *collect_rules(),
89
        UnionRule(PutativeTargetsRequest, PutativeJSTargetsRequest),
90
        UnionRule(PutativeTargetsRequest, PutativePackageJsonTargetsRequest),
91
    )
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