Path separator inside `RECORD` files in wheels

What characters are allowed as path separators in the “path” fields of entries in *.dist-info/RECORD files inside wheels? Just /, or both / and \?

Both PEP 427 and the “Binary distribution format” spec on packaging.python.org refer to PEP 376 for the definition of RECORD, and that PEP states that paths are /-separated when they’re not absolute (which they wouldn’t be inside a wheel). The “Recording installed projects” spec derived from PEP 376, on the other hand, only states “On Windows, directories may be separated either by forward- or backslashes (/ or \)” regarding path separators.

I ask because some wheels built with maturin and a few other backends use backslashes as the path separator (presumably whenever the wheel is built on and/or for Windows), and wheel-inspect & wheelodex.org (which I both maintain) flag these wheels as invalid, and I need to know whether I should fix my code or file issues asking the backends to fix theirs.

Inspector links for random example wheels exhibiting the problem:

To get the discussion started I’d file the maturin issue now, and ask their opinion—do they feel it’s their issue or yours? Then take it from there.

PEP 376 is a historical document, while Recording installed projects - Python Packaging User Guide is the living spec, so we need a spec change first before we change this in maturin. If we changed this in all tools without changing the spec, we’d only invalidate the living spec, which I’d like to avoid.

1 Like

The change to allow backslashes was added in PEP 627, which is linked in the changelog of the living spec. So the living spec is correct here.

2 Likes

But, technically speaking, the part of the spec that allows backslashes is refering to RECORD files in installed packages, not in wheels. Even if we assume that it applies to wheels as well, exactly which wheels are allowed to use backslashes in their RECORDs? Those with a platform tag that starts with “win”? All wheels? Something else?

1 Like