Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: ignore comments in .pth files #85

Merged
merged 5 commits into from
Jun 14, 2022

Conversation

GabDug
Copy link
Contributor

@GabDug GabDug commented Jun 9, 2022

Fixes #84

Had the same issue with pdbpp on OS X, this made the trick.

This is a very naive implementation for single-line comments, feedback welcome.

Fixes mkdocstrings#84

Very naive implementation for single-line comments
@pawamoy
Copy link
Member

pawamoy commented Jun 10, 2022

Thanks for the PR!

So indeed the initial implementation was very naive. I've looked it up and found these docs:

A path configuration file is a file whose name has the form name.pth and exists in one of the four directories mentioned above; its contents are additional items (one per line) to be added to sys.path. Non-existing items are never added to sys.path, and no check is made that the item refers to a directory rather than a file. No item is added to sys.path more than once. Blank lines and lines beginning with # are skipped. Lines starting with import (followed by space or tab) are executed.

I'll suggest some code modifications a bit later, unless you want to tackle it and follow the spec (not hard anyway).

src/griffe/finder.py Outdated Show resolved Hide resolved
@pawamoy pawamoy merged commit f212dd3 into mkdocstrings:master Jun 14, 2022
@pawamoy
Copy link
Member

pawamoy commented Jun 14, 2022

Merged! Thanks again! Will release a new version.

@GabDug GabDug deleted the fix/pth-comments branch July 12, 2022 09:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pth file formatting breaks griffe
2 participants