• 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

86.36
/src/python/pants/core/goals/resolves.py
1
# Copyright 2024 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3
from __future__ import annotations
11✔
4

5
from enum import Enum
11✔
6
from typing import TypeVar
11✔
7

8
from pants.engine.unions import UnionMembership, union
11✔
9
from pants.util.strutil import softwrap
11✔
10

11
T = TypeVar("T", bound="ExportableTool")
11✔
12

13

14
class ExportMode(Enum):
11✔
15
    """How this tool should be exported.
16

17
    resolve: in a language-based resolve
18
    binary: as a single binary
19
    """
20

21
    resolve = "resolve"
11✔
22
    binary = "binary"
11✔
23

24

25
@union
11✔
26
class ExportableTool:
11✔
27
    """Mark a subsystem as exportable.
28

29
    Using this class has 2 parts:
30
    - The tool class should subclass this.
31
      This can be done at the language-backend level, for example, `PythonToolRequirementsBase`.
32
      The help message can be extended with instructions specific to that tool or language backend
33
    - Each exportable tool should have a `UnionRule` to `ExportableTool`.
34
      This `UnionRule` is what ties the class into the export machinery.
35
    """
36

37
    options_scope: str
11✔
38
    export_mode: ExportMode = ExportMode.resolve
11✔
39

40
    @classmethod
11✔
41
    def help_for_generate_lockfile_with_default_location(cls, resolve_name: str):
11✔
42
        """If this tool is configured to use the default lockfile, but a user requests to regenerate
43
        it, this help text will be shown to the user."""
44

45
        resolve = resolve_name
1✔
46
        return softwrap(
1✔
47
            f"""
48
            You requested to generate a lockfile for {resolve} because
49
            you included it in `--generate-lockfiles-resolve`, but
50
            {resolve} is a tool using its default lockfile.
51
        """
52
        )
53

54
    @staticmethod
11✔
55
    def filter_for_subclasses(
11✔
56
        union_membership: UnionMembership, parent_class: type[T]
57
    ) -> dict[str, type[T]]:
58
        """Find all ExportableTools that are members of `parent_class`.
59

60
        Language backends can use this to obtain all tools they can export.
61
        """
UNCOV
62
        exportable_tools = union_membership.get(ExportableTool)
×
UNCOV
63
        relevant_tools: dict[str, type[T]] = {
×
64
            e.options_scope: e  # type: ignore # mypy isn't narrowing with `issubclass`
65
            for e in exportable_tools
66
            if issubclass(e, parent_class)
67
        }
UNCOV
68
        return relevant_tools
×
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