interoperability-peps icon indicating copy to clipboard operation
interoperability-peps copied to clipboard

Add environment marker to distinguish 32bit and 64bit windows

Open mtreinish opened this issue 3 years ago • 2 comments

Right now the environment markers defined in pep508 do not allow a way for specifying a requirement that is exclusively for 64 bit or 32 bit windows. The listed environment markers from: https://peps.python.org/pep-0508/#environment-markers all return identical data based on the OS install and not the current python environment. For example running on a 64bit and 32 bit build of python on the same 64bit windows system will yield:

Python API for marker 32bit Python output 64 bit Python output
os.name 'nt' 'nt'
sys.platform win32 win32
platform.machine() 'AMD64' 'AMD64'
platform.system() 'Windows' 'Windows'

It would be good if the platform markers offered a way to enable distinguishing between 32bit and 64bit python builds on a 64bit os (I'm assuming platform_machine works on a 32bit version of windows, but I don't have an install to test locally).

The first one that comes to mind would be platform_architecture to mirror platform.architecture() which returns (bits, linkage). Then for the marker we could match on string outputs like 64bit_WindowsPE for 64bit builds and 32bit_WindowsPE for 32 bit builds.

mtreinish avatar Jul 11 '22 19:07 mtreinish

What's the motivating use case? Wheels tags already let you select between 32bit and 64bit builds of a dependency...

njsmith avatar Jul 12 '22 02:07 njsmith

The use case is pretty straightforward if there is a compiled extension that has wheels only for 64 bit windows and an sdist published. Without having an environment marker the sdist will match and require 32 bit users to try and build it from source.

Personally I'm hitting this trying to add a requirement on symengine where there are no 32 bit wheels published and building from source is difficult and most users won't have the dependencies installed. On Linux it's trivial to use environment markers to restrict the requirement to x86_64 (or other supported architectures) and avoid it trying to build from source.

mtreinish avatar Jul 12 '22 02:07 mtreinish