Repository navigation
fix: pass the absolute assets folder to the show_dash app - #371
Open
raashish1601 wants to merge 1 commit into
Open
raashish1601 wants to merge 1 commit into
raashish1601 wants to merge 1 commit into
Conversation
…lab#362) show_dash passed the assets folder relative to the cwd. On Windows, os.path.relpath raises a ValueError when the cwd is on another drive than plotly-resampler. Dash joins assets_folder with the app root, so an absolute path works everywhere. Fixes predict-idlab#362
This branch has not been deployed
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.
Fixes #362
show_dash()setassets_foldertoos.path.relpath(ASSETS_FOLDER, os.getcwd())when the overview is enabled. On Windows,relpathraisesValueError: path is on mount 'C:', start on mount 'E:'when the working directory is on a different drive than plotly-resampler, soshow_dash()fails.Dash builds the final path with
os.path.join(get_root_path("local_app"), assets_folder), and an absolute path passes through that join unchanged. So this passesASSETS_FOLDERas is, which is already absolute. Theosimport is no longer used and is removed.Test:
test_show_dash_assets_folder_outside_cwdchanges to a temp directory, runsshow_dashwith the overview, and checks that the app'sassets_folderisASSETS_FOLDERand that/assets/coarse_fine.jsis served. On main, the configured folder is a long..\..\path relative to the temp dir. I only have one drive here, so I checked the cross-drive error itself withntpath.relpathdirectly.The
show_dashtests and the rest oftests/test_figure_resampler.pypass locally (non-selenium), apart fromtest_multiple_timezones_in_single_x_index__datetimes_and_timestampsand the twotest_fr_update_layout_axes_range*tests, which fail the same way on main in my environment.ruff checkandblack --checkare clean. I added a changelog line under "Latest".