• 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/lint/prettier/rules.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 logging
×
UNCOV
7
import os
×
UNCOV
8
from collections.abc import Iterable
×
UNCOV
9
from dataclasses import dataclass
×
10

UNCOV
11
from pants.backend.javascript.lint.prettier.subsystem import Prettier
×
UNCOV
12
from pants.backend.javascript.subsystems import nodejs_tool
×
UNCOV
13
from pants.backend.javascript.subsystems.nodejs_tool import NodeJSToolRequest
×
UNCOV
14
from pants.backend.javascript.target_types import JSRuntimeSourceField
×
UNCOV
15
from pants.core.goals.fmt import FmtResult, FmtTargetsRequest
×
UNCOV
16
from pants.core.util_rules.config_files import find_config_file
×
UNCOV
17
from pants.core.util_rules.partitions import PartitionerType
×
UNCOV
18
from pants.engine.fs import MergeDigests
×
UNCOV
19
from pants.engine.intrinsics import merge_digests
×
UNCOV
20
from pants.engine.process import execute_process_or_raise
×
UNCOV
21
from pants.engine.rules import Rule, collect_rules, implicitly, rule
×
UNCOV
22
from pants.engine.target import FieldSet
×
UNCOV
23
from pants.engine.unions import UnionRule
×
UNCOV
24
from pants.util.logging import LogLevel
×
UNCOV
25
from pants.util.strutil import pluralize
×
26

UNCOV
27
logger = logging.getLogger(__name__)
×
28

29

UNCOV
30
@dataclass(frozen=True)
×
UNCOV
31
class PrettierFmtFieldSet(FieldSet):
×
UNCOV
32
    required_fields = (JSRuntimeSourceField,)
×
33

UNCOV
34
    sources: JSRuntimeSourceField
×
35

36

UNCOV
37
class PrettierFmtRequest(FmtTargetsRequest):
×
UNCOV
38
    field_set_type = PrettierFmtFieldSet
×
UNCOV
39
    tool_subsystem = Prettier  # type: ignore[assignment]
×
UNCOV
40
    partitioner_type = PartitionerType.DEFAULT_SINGLE_PARTITION
×
41

42

UNCOV
43
@rule(level=LogLevel.DEBUG)
×
UNCOV
44
async def prettier_fmt(request: PrettierFmtRequest.Batch, prettier: Prettier) -> FmtResult:
×
45
    # Look for any/all of the Prettier configuration files
46
    config_files = await find_config_file(prettier.config_request(request.snapshot.dirs))
×
47

48
    # Merge source files, config files, and prettier_tool process
49
    input_digest = await merge_digests(
×
50
        MergeDigests(
51
            (
52
                request.snapshot.digest,
53
                config_files.snapshot.digest,
54
            )
55
        )
56
    )
57

58
    result = await execute_process_or_raise(
×
59
        **implicitly(
60
            {
61
                prettier.request(
62
                    args=("--write", *(os.path.join("{chroot}", file) for file in request.files)),
63
                    input_digest=input_digest,
64
                    output_files=request.files,
65
                    description=f"Run Prettier on {pluralize(len(request.files), 'file')}.",
66
                    level=LogLevel.DEBUG,
67
                ): NodeJSToolRequest
68
            }
69
        )
70
    )
71
    return await FmtResult.create(request, result)
×
72

73

UNCOV
74
def rules() -> Iterable[Rule | UnionRule]:
×
UNCOV
75
    return (
×
76
        *collect_rules(),
77
        *nodejs_tool.rules(),
78
        *PrettierFmtRequest.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