• 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/codegen/python_format_string/target_types.py
1
# Copyright 2025 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
UNCOV
3
import logging
×
4

UNCOV
5
from pants.core.goals.package import OutputPathField
×
UNCOV
6
from pants.engine.target import (
×
7
    COMMON_TARGET_FIELDS,
8
    DictStringToStringField,
9
    MultipleSourcesField,
10
    SingleSourceField,
11
    Target,
12
    TargetFilesGenerator,
13
)
14

UNCOV
15
logger = logging.getLogger(__name__)
×
16

17

UNCOV
18
class PythonFormatStringSourceField(SingleSourceField):
×
UNCOV
19
    pass
×
20

21

UNCOV
22
class PythonFormatStringValuesField(DictStringToStringField):
×
UNCOV
23
    alias = "values"
×
UNCOV
24
    required = True
×
UNCOV
25
    help = "Dictionary of key/value pairs to substitute."
×
26

27

UNCOV
28
class PythonFormatStringOutputPathField(OutputPathField):
×
UNCOV
29
    def value_or_default(self, *, file_ending: str | None) -> str:
×
30
        if self.address.is_generated_target:
×
31
            if self.address.is_parametrized:
×
32
                return f"{self.address.filename}.{file_ending}{self.address.parameters_repr}"
×
33
            return f"{self.address.filename}.{file_ending}"
×
34
        return super().value_or_default(file_ending=file_ending)
×
35

36

UNCOV
37
class PythonFormatStringTarget(Target):
×
UNCOV
38
    alias = "python_format_string"
×
UNCOV
39
    help = "Substitutes values into a file. See k8s backend documentation for details."
×
UNCOV
40
    core_fields = (
×
41
        *COMMON_TARGET_FIELDS,
42
        PythonFormatStringSourceField,
43
        PythonFormatStringValuesField,
44
        PythonFormatStringOutputPathField,
45
    )
46

47

UNCOV
48
class PythonFormatStringsSourcesField(MultipleSourcesField):
×
UNCOV
49
    help = "See k8s backend documentatiom."
×
50

51

UNCOV
52
class PythonFormatStringTargetGenerator(TargetFilesGenerator):
×
UNCOV
53
    alias = "python_format_strings"
×
UNCOV
54
    generated_target_cls = PythonFormatStringTarget
×
UNCOV
55
    help = "Substitutes values into files. See k8s backend documentation for details."
×
UNCOV
56
    core_fields = (
×
57
        *COMMON_TARGET_FIELDS,
58
        PythonFormatStringsSourcesField,
59
    )
UNCOV
60
    copied_fields = COMMON_TARGET_FIELDS
×
UNCOV
61
    moved_fields = (PythonFormatStringValuesField,)
×
62

63

UNCOV
64
def target_types():
×
65
    return (
×
66
        PythonFormatStringTarget,
67
        PythonFormatStringTargetGenerator,
68
    )
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