python / python/importlib_metadata

`PackagePath` does not support Windows paths

Open Beginner friendly
#528 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
142
Forks
97
PR merge metrics
No merged PRs in 30d

Description

Currently, importlib.metadata.files assumes that path are Unix-style with forward slashes, while the spec allows Windows-style backwards slashes too. This causes e.g. the .name on items to be inconsistent between platforms (https://github.com/astral-sh/uv/issues/14446).

https://github.com/python/importlib_metadata/blob/95ecf2aa573a68d4624506f801ca70992a337f41/importlib_metadata/__init__.py#L371

From https://packaging.python.org/en/latest/specifications/recording-installed-packages/#the-record-file

The path may be either absolute, or relative to the directory containing the .dist-info directory (commonly, the site-packages directory). On Windows, directories may be separated either by forward- or backslashes (/ or ).

Ref https://github.com/python/importlib_metadata/issues/51

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in importlib_metadata/init.py around the referenced PackagePath implementation and compare its handling of forward- and backslash-separated paths with the RECORD specification. Add coverage for Windows-style paths and verify that the resulting .name is consistent across path separators.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.