Replies: 3 comments 14 replies
-
Completely agreed. The web developer experience isn't great right now - the turnaround from "oh, make a 1 character change to toga-web" and seeing that update take effect is much longer than is desirable.
Agreed that this is a possible approach - albeit one that is mildly complicated to implement.
I'm not wild about the idea of complicating the user interface to simplify one specific aspect of web development.
The primary reason a full rebuild is required at present is that wheels are used for delivering all the content of the web app. Building the wheel effectively requires a rebuild, as the PEP 517 wheel-building interface doesn't have an "incremental build" option. In a normal desktop environment, there's 2 ways to install a package from a local source directory:
Briefcase's web backend doesn't currently have an equivalent of an "editable" install, or an ability to deliver content the web backend in a format other than a wheel. Pyscript, on the other hand, can reference individual files. That capability might form the basis of injecting python content into the web page.
I'll stand corrected if you find an example, but I doubt it. In order to test a change in a web app, or in toga-core or toga-web, you need to re-load the page. That re-initializes the entire application state. The only place this might be a problem is if the browser caches a file - but that should be something that the web server and browser are negotiating.
+1 to all this. There's obviously details to sort out, but AFAICT they're largely constrained by what options exist for defining content in PyScript, and/or what options for optimising which packages need to be rebuild. One open question is exactly how this would be "spelled". Can this be put into an option on Or does the dev command need to start honoring platform choices (i.e., Or do we need to move "developer mode" into an option on the run command? (i.e.,
Definitely a nice to have feature; but also something we can defer discussion until we have the previous two features working.
One detail worth pointing out here - if we have a dev mode that has a fast turnaround cycle for app code and for any local dependency specified as a file path (i.e., the "developing Toga" use case), the importance of a fast rebuild cycle for wheels is a lot less significant. There's definitely an inefficiency in the |
Beta Was this translation helpful? Give feedback.
-
So I believe at this stage it's worth putting out a revised proposal based on the changes and conclusions drawn so far Proposal: Platform-Aware briefcase dev & Editable Installs for WebTo improve the local development experience when working on web projects, we propose extending Briefcase's With this, we aim to make the
We'll need to set up a dedicated dev venv that contains only the pure Python modules we need to serve, like Toga modules, which we'll install as editable installs.
3rd party libraries like 'numpy' and 'pandas' aren't pure Python. In the browser, Pyodide can't run these directly, so it requires .whl files. Pyodide micropip can dynamically fetch these WASM-compatible wheels at run time.
Editable installs create .pth files in the venv that act as a reference to the actual source folder on the machine. In dev mode, we'll configure the dev server to read these .pth files and dynamically serve the latest versions of the Python modules they reference. This means any changes to Toga's source code are available in the browser without needing a rebuild or copying of files, just a refresh
To make Toga's Python modules available to PyScript in the browser, we'll serve them as standard .py files from our static assets directory. These files are loaded directly into the in-browser virtual filesystem described in PyScript Filesystem Guide, allowing PyScript to import and execute them as regular Python modules during runtime. This avoids the need for additional packaging steps OutcomeWith this approach, we hope that it will result in:
Breakdown of tasksThe work can be mainly broken down into 3 parts
These can all be further broken down into smaller subtasks, but this covers the general scope of work being done. @JMah007 let me know if there's anything you want me to add or if I missed anything |
Beta Was this translation helpful? Give feedback.
-
I think at this stage we can look at converting this into a proper ticket. Below is a draft including a roadmap that breaks down the tasks Platform-Aware
|
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.
-
Hi team,
After working on some of the web widgets for Toga, I’ve come to find that we could improve the local development experience to reduce wait times when testing changes to the web platform
Currently, when we want to test out some code changes we need to run:
briefcase run web -r -u
This is leading to a full wheel rebuild every time, even if only a single file has been changed.
This slows down local development, making it cumbersome for contributors working on the web backend.
Proposed Exploration Areas
We’re hoping to prototype several ideas to improve development speed and ergonomics when working on Briefcase web apps:
1. Selective Rebuilds
Goal: Detect what files have actually changed and only rebuild the necessary wheels.
Approaches:
--skip-rebuild-x
--rebuild-x
Questions for Discussion:
2. Implementation of
--dev
Mode for WebContext:
Briefcase already supports a
--dev
mode flag for desktop platforms. Bringing this to the web backend would be a meaningful step forward.Idea:
src/
,toga/web/
, etc.).3. Live Updating / Auto Reloading
"Nice to have" feature built on top of selective rebuilds and dev mode.
Potential Approaches:
--live
--reload
Goals
At a minimum, we hope to improve development speed by reducing unnecessary rebuilds.
And hopefully extend the existing --dev mode to fully support web projects.
We understand that these changes will require proper architectural considerations and are hoping to be able to work on prototyping some ideas over the coming weeks.
Feedback
Are there any parts of this proposal that weren’t clear or need further explanation?
Do you have any questions, concerns or advice about any of the ideas we’ve outlined?
Are there alternative approaches we might have missed that could help improve the web development workflow?
Open to suggestions and want to make sure we’re aligned with both Briefcase’s design goals and the needs of the broader community. Please feel free to share any thoughts, even small comments or side ideas could help shape what we prototype next.
Myself and @JMah007 will be looking into this as part of our University work this year and our hoping to conclude our research and some initial prototyping by the end of the semester in June and then finalizing this in the following semester.
Beta Was this translation helpful? Give feedback.
All reactions