fix resolving project-absolute paths - #44
Merged
Merged
Conversation
* `resolve_path`: strip the leading slash before joining, os.path.join() silently drops project_path otherwise * `resolve_path`: raise a helpful error when there is no project root * use a project-absolute `__merge__` in the example project, so the readme rendering tests cover it
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
resolve_path()was dropping the project root for any path starting with a/, so a config with e.g.__merge__: /src/api/file_dataset.yaml-- which is how Viash spells "relative to the_viash.yaml" -- failed to read:The cause is that
os.path.join()resets whenever a segment is absolute, soos.path.join("/repo", "/src/api/file_dataset.yaml")returns/src/api/file_dataset.yamland the project root is never applied. The R twin usespaste0()and has always been correct, so only the Python side was affected.Changes:
resolve_path: strip the leading slash before joining, and raise a helpful error when a project-absolute path is resolved without a project root (previously a bareTypeErrorout ofos.path.join())Spotted in openproblems-bio/task_batch_integration#99.