• 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

60.34
/src/python/pants/backend/tools/taplo/rules_integration_test.py
1
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3
from __future__ import annotations
2✔
4

5
from typing import Any
2✔
6

7
import pytest
2✔
8

9
from pants.backend.tools.taplo.rules import TaploFmtRequest
2✔
10
from pants.backend.tools.taplo.rules import rules as taplo_rules
2✔
11
from pants.core.goals.fmt import FmtResult, Partitions
2✔
12
from pants.core.util_rules import config_files, external_tool
2✔
13
from pants.engine.fs import PathGlobs
2✔
14
from pants.engine.internals.native_engine import Snapshot
2✔
15
from pants.testutil.rule_runner import QueryRule, RuleRunner
2✔
16

17

18
@pytest.fixture
2✔
19
def rule_runner() -> RuleRunner:
2✔
20
    return RuleRunner(
2✔
21
        rules=[
22
            *taplo_rules(),
23
            *config_files.rules(),
24
            *external_tool.rules(),
25
            QueryRule(Partitions, [TaploFmtRequest.PartitionRequest]),
26
            QueryRule(FmtResult, [TaploFmtRequest.Batch]),
27
        ],
28
    )
29

30

31
GOOD_FILE = """[GLOBAL]\nbackend_packages = ["pants.backend.tools.taplo"]\n"""
2✔
32
BAD_FILE = """[GLOBAL]\nbackend_packages = [\n  "pants.backend.tools.taplo",\n]\n"""
2✔
33
NEEDS_CONFIG_FILE = """[GLOBAL]\npants_version = "2.17.0"\n"""
2✔
34
FIXED_NEEDS_CONFIG_FILE = """[GLOBAL]\npants_version="2.17.0"\n"""
2✔
35

36

37
def run_taplo(
2✔
38
    rule_runner: RuleRunner,
39
    *,
40
    extra_args: list[str] | None = None,
41
) -> FmtResult:
42
    rule_runner.set_options(
2✔
43
        ["--backend-packages=pants.backend.tools.taplo", *(extra_args or ())],
44
    )
45
    snapshot = rule_runner.request(Snapshot, [PathGlobs(["**", "!BUILDROOT"])])
2✔
46
    partition = rule_runner.request(
2✔
47
        Partitions[Any], [TaploFmtRequest.PartitionRequest(snapshot.files)]
48
    )[0]
49
    fmt_result = rule_runner.request(
2✔
50
        FmtResult,
51
        [
52
            TaploFmtRequest.Batch(
53
                "", partition.elements, partition_metadata=partition.metadata, snapshot=snapshot
54
            ),
55
        ],
56
    )
57
    return fmt_result
2✔
58

59

60
def test_no_changes_needed(rule_runner: RuleRunner) -> None:
2✔
UNCOV
61
    rule_runner.write_files({"f.toml": GOOD_FILE, "sub/g.toml": GOOD_FILE})
×
UNCOV
62
    fmt_result = run_taplo(rule_runner)
×
UNCOV
63
    assert not fmt_result.stdout
×
UNCOV
64
    assert "found files total=2" in fmt_result.stderr
×
UNCOV
65
    assert fmt_result.output == rule_runner.make_snapshot(
×
66
        {"f.toml": GOOD_FILE, "sub/g.toml": GOOD_FILE}
67
    )
UNCOV
68
    assert fmt_result.did_change is False
×
69

70

71
@pytest.mark.platform_specific_behavior
2✔
72
def test_changes_needed(rule_runner: RuleRunner) -> None:
2✔
73
    rule_runner.write_files({"f.toml": BAD_FILE, "sub/g.toml": BAD_FILE})
2✔
74
    fmt_result = run_taplo(rule_runner)
2✔
75
    assert not fmt_result.stdout
2✔
76
    assert "found files total=2" in fmt_result.stderr
2✔
77
    assert fmt_result.output == rule_runner.make_snapshot(
2✔
78
        {"f.toml": GOOD_FILE, "sub/g.toml": GOOD_FILE}
79
    )
80
    assert fmt_result.did_change is True
2✔
81

82

83
def test_globs(rule_runner: RuleRunner) -> None:
2✔
UNCOV
84
    rule_runner.write_files({"f.toml": BAD_FILE, "g.toml": BAD_FILE})
×
UNCOV
85
    fmt_result = run_taplo(rule_runner, extra_args=["--taplo-glob-pattern=['f.toml', '!g.toml']"])
×
UNCOV
86
    assert not fmt_result.stdout
×
UNCOV
87
    assert "found files total=1" in fmt_result.stderr
×
UNCOV
88
    assert fmt_result.output == rule_runner.make_snapshot({"f.toml": GOOD_FILE})
×
89

90

91
def test_config_files(rule_runner: RuleRunner) -> None:
2✔
UNCOV
92
    rule_runner.write_files(
×
93
        {
94
            "a/f.toml": NEEDS_CONFIG_FILE,
95
            ".taplo.toml": "[formatting]\ncompact_entries = true\n",
96
            "b/f.toml": NEEDS_CONFIG_FILE,
97
        }
98
    )
UNCOV
99
    fmt_result = run_taplo(rule_runner)
×
UNCOV
100
    assert not fmt_result.stdout
×
UNCOV
101
    assert "found files total=2" in fmt_result.stderr
×
UNCOV
102
    assert fmt_result.output == rule_runner.make_snapshot(
×
103
        {
104
            "a/f.toml": FIXED_NEEDS_CONFIG_FILE,
105
            "b/f.toml": FIXED_NEEDS_CONFIG_FILE,
106
        }
107
    )
UNCOV
108
    assert fmt_result.did_change
×
109

110

111
def test_passthrough_args(rule_runner: RuleRunner) -> None:
2✔
UNCOV
112
    rule_runner.write_files({"f.toml": NEEDS_CONFIG_FILE})
×
UNCOV
113
    fmt_result = run_taplo(rule_runner, extra_args=["--taplo-args='--option=compact_entries=true'"])
×
UNCOV
114
    assert not fmt_result.stdout
×
UNCOV
115
    assert "found files total=1" in fmt_result.stderr
×
UNCOV
116
    assert fmt_result.output == rule_runner.make_snapshot({"f.toml": FIXED_NEEDS_CONFIG_FILE})
×
UNCOV
117
    assert fmt_result.did_change
×
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