Skip to content

Fix page module names and paths when pages_folder uses "/" on Windows - #4218

Open
goranai wants to merge 1 commit into
plotly:devfrom
goranai:fix/pages-folder-forward-slash-windows
Open

goranai wants to merge 1 commit into
plotly:devfrom
goranai:fix/pages-folder-forward-slash-windows

Conversation

@goranai

@goranai goranai commented Nov 28, 2026

Copy link
Copy Markdown

On Windows, a pages_folder written with / (for example pages_folder="src/pages") gave page modules named src/pages.home and paths like /src/pages/home instead of /home. _path_to_module_name only split on os.sep, but os.path.join(root, "src/pages") mixes both separators. It now also treats os.altsep as a separator. Nothing changes where os.altsep is None.

Fixes #4217

Contributor Checklist

  • This PR targets dev (fix or chore)
  • I have run the tests locally and they passed: tests/unit/pages on Windows went from 6 failed, 39 passed, 1 skipped on dev to 1 failed, 47 passed, 1 skipped with this change (the 4 test_path_to_module_name cases and test_import_layouts_from_pages now pass). The one left, test_pages_folder_config[sub_dir/custom_pages], builds its expected string with os.sep while pages_folder_config returns a mixed path, and is not touched here.
  • I have added tests: test_path_to_module_name_windows_mixed_separators patches os.sep and os.altsep, so it also fails on the old code on Linux CI (2 of 3 cases fail on old code, all 3 pass with the fix).

optionals

  • I have added entry in the CHANGELOG.md

Validated with Claude Opus 5.5.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] pages_folder written with "/" on Windows gives wrong page module names and paths

1 participant