https://pantsbuild.org/ logo
#general
Title
# general
a

abundant-autumn-67998

01/05/2023, 5:20 PM
I have a PEX question about using
--complete-platform=cp.json
with
--resolve-local-platforms
. Say I have
compatible_tags: ['a', 'b']
in my
cp.json
and I'm trying to build an sdist. Also assume my current platform can build
b
tagged wheels. I expect the build to work but it fails. Using the latest pex 2.1.119. However if I move
b
to the front of the list
compatible_tags: ['b', 'a']
, the same command works. This seems like a bug? Or am I missing something about how compatible tags are supposed to work?
e

enough-analyst-54434

01/05/2023, 5:31 PM
So, stepping way back. The creation of a complete platform JSON should be automated and produce correct tag orderings - they are significant and should never be messed with by hand.
👍 1
How are you generating complete platforms?
There are lots of ~unrelated things here, let me try to address them all: 1. complete platforms should be generated via
pex3 interpreter ...
and never need editing. The tags are ordered and the ordering comes from PyPA packaging - it should be authoritative and correct. 2. --resolve-local-platforms says, please completely ignore complete platforms if you can instead find a local interpreter that exactly matches. If so, then use that interpreter from there forward ignoring complete platform. 3. When building an sdist, the information in complete platforms is not used / relevant at all, at that point you've hit 2. If you're actually still using a complete platform and not a local interpreter, no sdists can be built at all, only pre-built wheels used.
So one question is why do you use
--resolve-local-platforms
? You have sdists you do not wish to pre-build wheels for for some platforms?
a

abundant-autumn-67998

01/05/2023, 6:54 PM
I generated the complete platforms json using the
pex3 interpreter ...
. Yes we have sdists we can't pre-build, since they are user specified dependencies. I know my build environment can build wheels that are compatible with the target environment because when I use
--platform=
it builds the wheels from the sdist and the generated pex works in target environment. However when I specify a
--complete-platform=complete-platform-generated-on-target.json
, pex refuses to build the wheel and fails. The behavior I'm looking for is: If the build environment cannot build a wheel compatible with the target -> then fail If the build environment can build a compatible wheel -> build sdist into wheel However I see it fail even in a build environment that can generate compatible wheels. I understand the order is most to least specific, but I do not expect the first tag to be special? Eg if I have
['a', 'b', 'c']
and the build env can build a
b
wheel, it should proceed with the build.
my confusion is just this: if
compatible_tags: ['b', 'c']
worked, I expect a broader
compatible_tags: ['a', 'b', 'c']
to also work, but it didn't.
ah found the relevant code, i see the first tag is considered special and determines the `complete_platform.platform`: https://github.com/pantsbuild/pex/blob/7a2db79f12e747b173fd34f12af03934fe513a14/pex/targets.py#L264 maybe this should consider each supported tag in
complete_platform
, not just `complete_platform.platform`: https://github.com/pantsbuild/pex/blob/7a2db79f12e747b173fd34f12af03934fe513a14/pex/resolve/target_configuration.py#L205-L207
this was getting a bit much for slack so I filed an issue: https://github.com/pantsbuild/pex/issues/2026. can follow up there.
e

enough-analyst-54434

01/06/2023, 1:53 AM
Ok, thanks. I'm still pretty fundamentally confused what you're trying to do here. The issue is always a better way to get to useful details.
4 Views