-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix converting of editable package #288
Merged
Merged
Changes from 2 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
2fecf7a
fix converting of editable package
Czaki e3aecf5
remove debug
Czaki 39e5267
fix handling None files for dist
Czaki 60511dc
add test
Czaki be80756
style: [pre-commit.ci] auto fixes [...]
pre-commit-ci[bot] cdc7220
rename test function
Czaki 4d613c1
fix test
Czaki 746f7ae
remove wrong tests
Czaki 575eea0
remove wrong tests2
Czaki bb7fadc
add test for editable
Czaki 5f453c6
style: [pre-commit.ci] auto fixes [...]
pre-commit-ci[bot] 6482bc7
ommit coverage of __main__.py
Czaki 77d0955
Merge branch 'fix_editable' of github.com:Czaki/npe2 into fix_editable
Czaki 7004de3
Merge branch 'main' into fix_editable
tlambert03 2637b27
Merge branch 'main' into fix_editable
nclack 5315777
Merge branch 'main' into fix_editable
nclack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from npe2.cli import main | ||
|
||
if __name__ == "__main__": | ||
main() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -517,7 +517,13 @@ def get_top_module_path(package_name, top_module: Optional[str] = None) -> Path: | |
top_module = top_mods[0] | ||
|
||
path = Path(dist.locate_file(top_module)) | ||
assert path.is_dir() | ||
if not path.is_dir(): | ||
for f_path in dist.files: | ||
if "__editable__" in f_path.name: | ||
path = Path(f_path.read_text().strip()) / top_module | ||
break | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Czaki I have zero context here so take my review with a grain of salt, but if there are no tests here, could you at least add comments about why these lines are needed? eg "if the given npe1 plugin is installed in editable mode, then X doesn't work so we must do Y" |
||
|
||
assert path.is_dir(), f"Could not find top level module {top_module} using {path}" | ||
return path | ||
|
||
|
||
|
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 have added this file to simplify debugging my allow run by
python -m npe2