• 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

73.91
/src/python/pants/pantsd/lock.py
1
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
import errno
11✔
5
import logging
11✔
6
import os
11✔
7
import sys
11✔
8

9
import psutil
11✔
10
from fasteners import InterProcessLock
11✔
11

12
from pants.util.dirutil import safe_delete
11✔
13

14
logger = logging.getLogger(__name__)
11✔
15

16

17
def print_to_stderr(message):
11✔
UNCOV
18
    print(message, file=sys.stderr)
×
19

20

21
class OwnerPrintingInterProcessFileLock(InterProcessLock):
11✔
22
    @property
11✔
23
    def message_path(self):
11✔
24
        return f"{self.path_str}.lock_message"
6✔
25

26
    @property
11✔
27
    def path_str(self):
11✔
28
        return self.path.decode()
6✔
29

30
    @property
11✔
31
    def missing_message_output(self):
11✔
UNCOV
32
        return f"Pid {os.getpid()} waiting for a file lock ({self.path_str}), but there was no message at {self.message_path} indicating who is holding it."
×
33

34
    def acquire(self, message_fn=print_to_stderr, **kwargs):
11✔
35
        logger.debug(f"acquiring lock: {self!r}")
6✔
36
        super().acquire(blocking=False)
6✔
37
        if not self.acquired:
6✔
UNCOV
38
            try:
×
UNCOV
39
                with open(self.message_path, "rb") as f:
×
UNCOV
40
                    message = f.read().decode("utf-8", "replace")
×
UNCOV
41
                    output = f"PID {os.getpid()} waiting for a file lock ({self.path_str}) held by: {message}"
×
UNCOV
42
            except OSError as e:
×
UNCOV
43
                if e.errno == errno.ENOENT:
×
UNCOV
44
                    output = self.missing_message_output
×
45
                else:
46
                    raise
×
UNCOV
47
            message_fn(output)
×
UNCOV
48
            super().acquire(**kwargs)
×
49

50
        if self.acquired:
6✔
51
            current_process = psutil.Process()
6✔
52
            cmd_line = " ".join(current_process.cmdline())
6✔
53
            message = f"{current_process.pid} ({cmd_line})"
6✔
54
            with open(self.message_path, "wb") as f:
6✔
55
                f.write(message.encode())
6✔
56

57
        return self.acquired
6✔
58

59
    def release(self):
11✔
60
        logger.debug(f"releasing lock: {self!r}")
6✔
61
        if self.acquired:
6✔
62
            safe_delete(self.message_path)
6✔
63
        return super().release()
6✔
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