-
-
Notifications
You must be signed in to change notification settings - Fork 768
Feat: Override dependencies at lib/ #4718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I quickly reviewed this pull request, which could be useful in certain situations. But I'm undecided about the details yet.
Me too. I think setting via environment variable is a bit jank and unreliable, especially since it doesn't work if you: from dotenv import load_dotenv
load_dotenv() Or import os
os.environ['NICEGUI_LIB_OVERRIDE_DIRECTORY'] = 'blahblahblah' You seem to MUST set it via command line before even launching the Python script for it to work. However, overriding lib is still desirable. While we're at it, maybe even allow overriding the Tailwind to V4. Those beta testers (i.e. me and a few brave people) can speed things up when we roll around to implementing Tailwind V4 in NiceGUI for real. |
I'm not sure an env variable is very handy. One would need to have all the NiceGUI JS code in that dir. Why not simply copy the lib you want to test/update in the pip installed location. With venv, Docker etc this stays well encapsulated. |
Fair point. I think for alpha-level testing, overriding the JS files directly at Besides a slightly better way to keep track of the old copy, and being able to do this in non-venv situations, this PR doesn't seem to add much to the table. Alpha-testers should be able to back their files up and handle a venv anyways. So, I'm more inclined to closing this PR in favor of a documentation update somewhere in However, for beta-level testing, perhaps a more streamlined experience is still desirable, which this PR does not provide so far. Wishful programming: from nicegui.beta import dependency_override
# put in nicegui.beta, and we declare we may have breaking changes in minor versions, so that we move quickly
# could be an optional package, or external package
dependency_override('aggrid': '33.3.0')
dependency_override('leaflet': 'latest')
dependency_override('plotly': '/path/to/plotly/js') It is best, if the function can be called after ui.input('Enter AG Grid version or path to test', lambda e: dependency_override('aggrid', e.args['value']) To avoid shifting the topic of the conversation here, whoever thinks this is useful, if there isn't a thread already, please open a thread in https://github.com/zauberzeug/nicegui/discussions/categories/ideas-feature-requests and comment the link to the new thread below to restart the conversation. |
Apparently swapping dependencies is as easy as #4739 (reply in thread) So there's no need for this override lib functionality for elements. Only though remaining is if we can let user swap out Vue, Quasar and Tailwind (<- This one most tricky since v4 has breaking changes) |
This PR allows the user to set
NICEGUI_LIB_OVERRIDE_DIRECTORY
in env to a directory, for which it contains what would have been in NiceGUI'slib/
folder.This way, the user can override NiceGUI's dependencies with newer ones, skipping forward in the release cycle.
Combined with a beta feedback system, we can collect information on whether a new version of JS dependency will work with NiceGUI or not, potentially easin upcoming releases, and empowering us to move faster 🚀
Demo code:
Ensure in same folder as your test script,
lib_override/lib/aggrid/ag-grid-community.min.js
is accessible.Without override:
With override:
Notice the new styling.
Remaining tasks:
reload=False
?