This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
Correctly detect publicity of modules inside directories #494
Merged
Merged
Changes from 11 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
3b730ac
Fix Module.is_public() when the module is not a the root
tibdex be1aafe
Add PR reference
tibdex fcca361
Use pathlib
tibdex 716332e
Merge branch 'master' into fix-module_is_public
tibdex eb201f3
Use pathlib instead of os for test_module_publicity
gbroques 0bac2fc
Update release notes for #493
gbroques 60e8ba0
Resolve merge conflicts in release_notes.rst
gbroques 10e1e7a
Use forward slash '/' operator instead of .joinpath()
gbroques c911e9f
Fix pull-request number in release notes
gbroques 123025c
Fix publicity of module in private package
gbroques 8c07f7f
Update test_module_publicity docstring
gbroques 84fa77f
Add test for directory starting with double underscore
gbroques 44d661c
Make packages containing double-underscore public
gbroques a7f7b6c
Add test to assert __init__ module is public
gbroques ef7f5a1
Make modules in a __private_package private
gbroques 53a246e
Fix lint errors from lines being too long
gbroques 6d62651
Update publicity.rst with more information
gbroques cec5793
Parameterize module publicity tests and include .py file extension in…
gbroques 4b57b42
Make module publicity determination respect $PYTHONPATH
gbroques f807365
Fix line-length issue
gbroques 4bb734d
Resolve merge conflicts in release_notes.rst
gbroques cbf1c60
Reword comment
gbroques dde693f
Add tests with the same path over different sys.path cases
gbroques 2f6ab9e
Add note about checking sys.path for determining publicity
gbroques 0e5648c
Apply suggestions from code review
samj1912 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a fundamental issue here. The publicity of a module doesn't depend on its entire path, just the path leading to directory inside one of the paths in
PYTHONPATH
.So let's say I have a module in path
/_foo/bar/baz.py
. IfPYTHONPATH
is set to/
, thenbaz.py
is private. IfPYTHONPATH
is set to/_foo/
thenbaz.py
is public.Fortunately
sys.path
is a list of all the filepaths inPYTHONPATH
, so this can be relatively simply implemented. Something like:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Let me try and incorporate your suggestion, and ideally add a unit test to capture this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please let me know if 4b57b42 addresses your comment, and if there are any other changes desired.