Replies: 3 comments 8 replies
-
This is a good summary of a collection of WIP tickets that have been idle for a while. Turning the bones of those existing PRs into finalized PRs would definitely be a worthwhile improvement. For the purposes of your contribution, I don't think we need to consider the testing angle. Including testing and playwright into the existing PRs is the main reason those PRs didn't get finalized in their existing state; "how to test web" is definitely orthogonal to decoupling style framework choice from Briefcase. Two open questions that I can see: Firstly: How far can we decouple PyScript as a dependency of Briefcase? At present, Briefcase injects content into a Briefcase also currently defines the So - how far can we go down this path? Can we remove all references to PyScript from Briefcase? Or do we need to set Pyscript as a "baseline" requirement? And if so - is it a GUI framework's responsibility to inject all the HTML HEAD content to load pyscript, or should a GUI framework be specifying a PyScript version that it wants, and leaving it to the Briefcase template To be clear - having Briefcase say "you have to use PyScript" and embedding certain Pyscript pieces into the Briefcase side of things isn't a deal-breaker. I just want to make sure we're clear about exactly what the roles are responsibilities are. Secondly: What happens when there are 2 projects that want to provide inserts? In normal usage, you'd only expect Toga-web to be providing content to insert - but what happens if I have a second "web GUI toolkit" in my dependency list? Is there any conflict in having 2+ packages providing inserts? If PyScript is completely decoupled - what happens if toolkit 1 says "Pyscript vX" and toolkit 2 says "Pyscript vY"? What (if any) error handling is possible or desirable here? |
Beta Was this translation helpful? Give feedback.
-
Hi @freakboy3742, apologies for the delay. Here is our draft issue post: Delegate ownership of PyScript, Shoelace and Bootstrap to Toga / GUI ToolkitWhat is the problem or limitation you are having?Briefcase currently owns the configuration of frontend web dependencies PyScript, Shoelace, and Bootstrap, via hardcoded values in the Briefcase Web Template. This tightly couples Toga (and other Web GUI Toolkits) to Briefcase and the Web Template, creating several limitations:
Describe the solution you’d like@kavi2du and I propose that we introduce a clear separation of responsibilities between Toga (GUI Toolkit) and Briefcase (Packager) by delegating ownership of runtime dependency configuration and insertion content to Toga/GUI-Toolkit. Toga and 3rd Party GUI Toolkits would contain a
During the build process, Briefcase would gather and integrate these resources with Expected Outcomes
Further details for our solution can be found in the comments below. Describe alternatives you’ve considered
Additional context
Comments sectionOverview of changesResponsibilitiesTogaOwns and supplies:
Briefcase
Briefcase Web Template
Merge Rule
HTML and CSS InsertsHTML: <!--@@ header:start @@-->
<!--@@ header:end @@--> CSS: /***@@ CSS:start @@***/
/***@@ CSS:end @@***/ Briefcase loads insert content from Changes in TogaNew directory structure
Example
|
Beta Was this translation helpful? Give feedback.
-
@kavi2du @caydnn Very thorough - nice work. Time to post it formally! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
TL;DR
Migrating the ownership of PyScript, Bootstrap and Shoelace, from Briefcase to Toga itself. The main goal of this major change is to successfully break the framework dependencies such as PyScript and Shoelace that are presently coupled with Briefcase, allowing Toga to independently declare and handle its own runtime dependencies. In addition, this specific alteration will leverage the new insert system that has been developed, which enables the dynamic injection of critical components like HTML, CSS, and JavaScript at build time.
Background
Currently, Briefcase's web template has made use of hardcoded frontend tools that are important for functionality such as,
This tightly couples Briefcase to specific versions of frontend tools. But:
This becomes especially problematic when frameworks evolve faster than Briefcase releases, or when template-level changes break downstream apps.
Existing PRs Connected to This Issue
Briefcase#1285
content into the index.html file. In addition, it facilitates adding
CSS styles directly into the application's stylesheet.
What can we take from this:
Briefcase-web-static-template#9
Includes insert markers.
<!--@@ header:start @@-->
and<!--@@ header:end @@-->
in HTML/***@@ CSS:start @@***/
and/***@@ CSS:end @@***/
in CSSRemoves embedded Shoelace/Bootstrap links.
Adds support for a splash screen and other injected assets.
What can we take from this:
Toga#1945
What can we take from this:
Proposed Fix
@kavi2du and I propose to attempt to fix this as a part of the deliverables the Curtin team (@mEp3ii2, @vt37, @Stringer90, @kavi2du, @JMah007, @caydnn) are aiming to achieve by the end of Semester 2 (~End of October, 2025). Our current, basic idea at the moment is to:
The main goal here is for Toga to define dependencies for pyscript, shoelace and bootstrap and have these ‘injected’ into the html when Briefcase is building the web application.
We are also looking to hear feedback or suggestions from the wider Beeware community. If there’s anything anyone would like to mention or comment on, please let us know.
References
briefcase-web-static-template#9: beeware/briefcase-web-static-template#9
toga#1945: beeware/toga#1945
briefcase#1285: #1285
Beta Was this translation helpful? Give feedback.
All reactions