Skip to content

Feat: Support Vuetify V4 - #45

Merged
jourdain merged 31 commits into
Kitware:masterfrom
snacksbro:master
Sep 29, 2026
Merged

jourdain merged 31 commits into
Kitware:masterfrom
snacksbro:master

Conversation

@snacksbro

@snacksbro snacksbro commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR adds Vuetify v4 support to Trame Vuetify.

Version Bump + Backwards Compatibility

This should all be backwards compatible, as I generated the latest wheel containing these changes and used it in a large codebase without making any modifications and v3 seems to function just the same as it did before.

Due to this, I'm unsure if I was correct in updating the version of trame-vuetify itself to v4.x.x, or if this should simply be a minor version bump.

Build Script

While building/testing this back and forth I ended up combining the commands mentioned in the js-libs's READMEs into a single script, and writing another README on how to build the components using it (and the npm build step). I added it to the MR in case you would consider it useful as well, if not I can have it removed.

Examples?

I was unsure if the examples belong here or should be somewhere else, or even if the items produced fit with a more traditional example. As a result they live in the following repo: https://github.com/snacksbro/trame-vuetify4-demo

This contains 3 main files:

  • Features - Showcases the 4 new lab components that are exclusive to v4. Nothing too ground-breaking but figured it'd be good to show what's new and a quick ai-assisted demo of them in action.
  • Config - I was looking over Vuetify's Migration Guide and was able to port some of their work-arounds to undo some of the more radical style changes and provided a quick demo on how to use this. Most notably this includes a guide to re-implement the CSS reset Vuetify 3 used to do.
  • Vuetify 3 Example - This one is nothing special, its just a quick Trame demo using Vuetify 3 still I used to test against my changes in this PR to ensure it didn't break backwards compatibility.

V4 Exclusive Components

At the time of this writing, the 4 new lab components are these:

Proper Migration

I also spent some time porting over an existing Trame project to properly migrate to Vuetify V4 and can say its not too much trouble. Most of it was find/replace references to removed utility classes. I didn't notice any bugs in any of their components. Had I used their CSS reset stylesheet this likely would have been trivial, although I'm sure they'll eventually deprecate the work-around in future updates to V4.

Minor Questions

  • I notice that trame_vuetify/module/ contains files like vue3.py and vue3_lab.py, I assume to provide backwards compatibility with projects an older import method. I didn't make a similar stub for V4 since nobody's using it yet.

May be left-over from the dir change in July, need to confirm
Had to ignore the large-files commit hook
I believe at this point I'll need to alter the top-level trame packages
Since these typos are from Vuetify themselves, we can't do much here
I'm fine if this is removed before merging to master, just found it
helpful for development
I notice this seemed to all work without it when I build the wheel via:
`python -m build .`, added in case something relies on this file
Comment thread js-libs/v3/generate_python.py
Comment thread js-libs/v4-lab/package.json
Comment thread js-libs/build-bundles.sh
Comment thread trame_vuetify/module/v4_lab.py Outdated
Comment thread trame_vuetify/ui/vuetify4.py
Comment thread pyproject.toml Outdated
@jourdain

Copy link
Copy Markdown
Collaborator

Just a feat without a breaking change make sense as nothing from the previous code should be touched.

Comment thread js-libs/v3/.header.py
@snacksbro

snacksbro commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Just a feat without a breaking change make sense as nothing from the previous code should be touched.

Oh whoop, looking at the blame now it seems only semantic release should be touching the version in pyproject and the __init__.py file. I'll revert the pyproject to what it was and leave __version__ untouched

Comment thread js-libs/v4-lab/package.json Outdated
Comment thread MANIFEST.in Outdated
@jourdain

Copy link
Copy Markdown
Collaborator

I've looked through the code and things are reasonable. The missing part is really testing it, but I'm trusting you are trying that part on your end.

Also you should put your example(s) inside the ./examples/vuetify4/** for reference.

This contained a few important changes. First, Vite now calls the created
CSS bundle the same name as the fileName specified in the config, not
style.css like in v4. Secondly, Vite no longer globally injects
environment variables (like process.env.NODE_ENV), so they must be
explicitly defined in the Vite config so Vite can swap them out in the
bundle during build

This commit also bumps the transient dependencies via `npm upgrade`, as
`npm audit` was flagging a few of them as containing vulnerabilities
This seems unused, confirmed the wheel still builds without it
@snacksbro

snacksbro commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Also you should put your example(s) inside the ./examples/vuetify4/** for reference.

I split up my examples from my external repo into more individual ones here in the path specified. As per the discussion about getting rid of some of the layouts for v4, I've re-implemented a drawer layout to serve as the basic.py example for v4. So if someone wants it they have some starter code to work with. The other examples are fairly cut-and-dry just showing off how to use the new lab component, although for VProgress I got a bit creative and made it an example on how to use Trame asynchronous to make a loading bar since that's likely the use-case for something like this.

I did name the folder vuetify4, should I update the other folders from say vue3 -> vuetify3?

Other than that the only remaining things for this PR is actually removing the drawer layout from v4, potentially bumping vitepress (if desired, I admit its not critical), and potentially renaming the existing example dir names (vue->vuetify). Everything seems fine in terms of testing on my end, I gave a wheel to some coworkers who are working on Trame apps running vuetify v3 and so far have heard no reports of any issues from it. Likewise I've ran it through on a project I'm currently porting to vuetify v4 and it all seems to work fine, new lab components included

@jourdain

Copy link
Copy Markdown
Collaborator

Sure you can reorganize the example directory.

Comment thread examples/vuetify4/v_date_range_picker.py Outdated
@jourdain

Copy link
Copy Markdown
Collaborator

For all the new examples, try to use the TrameApp base class.

@snacksbro

Copy link
Copy Markdown
Contributor Author

Realized I built the examples around SinglePageLayout, since only VAppLayout exists now they've been updated to use that instead and I've removed DrawerLayout and SinglePageLayout from Vuetify4's exported layouts

Comment thread examples/vuetify4-labs/v_heatmap.py Outdated
Comment thread examples/vuetify4-labs/v_date_range_picker.py Outdated
Comment thread examples/vuetify4-labs/v_highlights.py Outdated
Comment thread examples/vuetify4-labs/v_month_picker.py Outdated
Comment thread examples/vuetify4-labs/v_progress.py Outdated
Comment thread trame_vuetify/ui/vuetify4.py Outdated
@jourdain

Copy link
Copy Markdown
Collaborator

From my point of view, that PR is ready. Let me know if you feel we should merge it or old off a little bit more.

@snacksbro

Copy link
Copy Markdown
Contributor Author

From my point of view, that PR is ready. Let me know if you feel we should merge it or old off a little bit more.

I'll make the wheel one more time to be sure and do a final run-through over v3 and v4. Nothing since my previous run through yesterday happened that should have broken anything, but will make sure. I'll post a comment when I'm certain

@snacksbro

snacksbro commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Alright, ran through a vuetify 3 Trame project with the wheel and it lined up exactly with trame-vuetify as currently on pypi. Then I ran though my Trame project migrated to use the vuetify 4 features and everything worked fine there as well. I feel confident this is good to merge. Thank you for all your help during the review! I wouldn't have caught those

@snacksbro
snacksbro marked this pull request as ready for review September 29, 2026 16:17
@jourdain

Copy link
Copy Markdown
Collaborator

Just run one vuetify2 example using your wheel. (make sure you clear cache or use a different port)

@jourdain

Copy link
Copy Markdown
Collaborator

Once I have your green light on running a vue2/vuetify2 example, I'll merge it.

@snacksbro

snacksbro commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Ran it on examples.vuetify2.basic after doing the npm i and npm build step within js-libs/vuetify2, example loaded and things seem normal

Edit: To be certain I copy pasted basic.py from this repo into another repo with the wheel installed and it also ran fine there after refreshing my cache

@jourdain
jourdain merged commit 0df180e into Kitware:master Sep 29, 2026
6 checks passed
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.

2 participants