Enable relative imports in Express apps #1464
Merged
+92
−6
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.
This PR makes it possible to do relative imports in a Shiny Express app, such as:
This is useful in the case of running Shiny Express apps in Shinylive on a web page where there are multiple Shiny apps running concurrently. This is important for the case where a page has multiple versions of an app, and each imports from a file with the same name, like utils.py -- without relative imports, only one copy of utils.py will be imported, and it will be shared across all of the concurrent apps.
In this sheet, this change has the effect of making all of the Error cells in the bottom row (in red) into OK cells (which would be green). https://docs.google.com/spreadsheets/d/1jIVoEDr234uo_ALOPiilSIoU-bj18L-R6YP_39ORXwM/edit#gid=0
I'm not sure yet, but it might be possible to make relative imports also work for Shiny Core apps.