Skip to content

Conversation

Caceresenzo
Copy link
Contributor

@Caceresenzo Caceresenzo commented Oct 9, 2025

Add support for comments and non absolute files while reading a .pth file.


Closes #127

@Caceresenzo
Copy link
Contributor Author

Need a bit more time, didn't expected the dist.locate_file(name) to not return a path type.

@flying-sheep
Copy link
Member

flying-sheep commented Oct 9, 2025

OK, so the way session_info2._dists.packages_distributions() works, is that it

  1. calls importlib.metadata.packages_distributions():
    pds = dict(pkgs_dists())
  2. calls _top_level_editable() to add entries.

So the purpose of the code you’re editing is to find top level packages only in editable distributions (because that’s the part importlib.metadata doesn’t handle).

I assume that .pth file isn’t for an editable distribution, so we should probably just do:

if not path.is_absolute()
    continue

@Caceresenzo
Copy link
Contributor Author

Thanks for taking a look, lets go with that.

@flying-sheep flying-sheep merged commit 0be1295 into scverse:main Oct 9, 2025
6 checks passed
@flying-sheep
Copy link
Member

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bad pth handling

2 participants