fix(app-template): write extension example paths with TOML-safe forward slashes - #6775
Open
ndonkoHenri wants to merge 3 commits into
Open
fix(app-template): write extension example paths with TOML-safe forward slashes#6775ndonkoHenri wants to merge 3 commits into
ndonkoHenri wants to merge 3 commits into
Conversation
…5507) The `[tool.flet.dev_packages]` and `[tool.uv.sources]` entries of the generated extension example interpolated `{{cookiecutter.sep}}` (`os.sep`) inside TOML basic strings. On Windows that rendered `"..\.."` — an invalid escape sequence — and `"..\..\"`, whose trailing `\"` escapes the closing quote and leaves the string unterminated, which is the "unbalanced quotes" error reported in #5507. Every Windows user had to hand-edit the file before the example could be built or run. Forward slashes need no escaping in TOML and are accepted by `pathlib` and `uv` on Windows, so they render identically on every platform.
Deploying flet-website-v2 with
|
| Latest commit: |
7e6bb63
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f5cd261c.flet-website-v2.pages.dev |
| Branch Preview URL: | https://fix-extension-template-windo.flet-website-v2.pages.dev |
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.
flet create --template extensiongenerates an example app whosepyproject.tomlcannot be parsed on Windows, so the very first thing the user-extensions guide tells you to do — build or run the generated example — fails before it starts.The two entries that point the example back at the extension package interpolated the host's
os.sepinto TOML basic strings:create.pypasses"sep": os.sep, so on Windows the first renders"..\.."—\.is not a valid TOML escape — and the second renders"..\..\", where the trailing\"escapes the closing quote and leaves the string unterminated. That second one is the "unbalanced quotes" error reporters hit;tomllibreports it asUnescaped '\' in a string. POSIX was unaffected, sincesepis/there.Both paths are now written with plain forward slashes, which need no escaping in TOML and which
pathlib(how[tool.flet.dev_packages]is resolved) anduvaccept on Windows exactly as elsewhere.{{cookiecutter.sep}}no longer appears anywhere undersdk/python/templates/app/; the build template's use of it for Kotlin source directories is untouched, as that one really is a filesystem path.This was fixed once, in August 2025, but only on the archived
flet-app-templates0.28.3 branch — it was never forward-ported when the templates moved into the monorepo.Refs #5507. That issue reports two separate problems; this fixes the template half only. The packaging hang tracked there is unrelated to this change and stays open.
Test code
Result on this branch, under both
sep="\\"andsep="/":Summary by Sourcery
Ensure generated extension examples remain valid and buildable across platforms.
Bug Fixes:
Enhancements: