-
Notifications
You must be signed in to change notification settings - Fork 61
fix: add watchfiles as dependency #116
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
✅ Deploy Preview for anywidget canceled.
|
Codecov Report
@@ Coverage Diff @@
## main #116 +/- ##
=======================================
Coverage 98.46% 98.46%
=======================================
Files 7 7
Lines 392 392
=======================================
Hits 386 386
Misses 6 6 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
Hey @manzt, when I try to run A quick workaround fix for now is Here are two ideas to approach this issue:
And another question in this regard: When I use the live-reload behavior with |
|
Thanks for opening this issue. I’d made the change since you (#94) and others had some friction with developing using anywidget initially. I wasn’t aware of the JupyterLite incompatibility. I wonder if rather than raising an error like before, we could just have a warning if watchfiles isn’t installed, notifying the developer they need to install it if they want the file to reload automatically.
no, watchfiles is only for reloading the file if the contents change. it triggers anywidget to call read_text() again internally. Reloading is a development-only feature. When someone pip-installs your widget, the file contents are loaded once. |
|
yeah, I noticed the recent requirement addition :) Even if it feels like a minor thing, I feel like if it can be optional, it should be optional. And since watchfiles is only necessary for development, I think you should remove it and just solve things like #94 using documentation, or an inline comment somewhere. |
Amazing!
That sounds great! |
yeah I like that too! |
|
I suppose it could also be shipped via |
|
@nvictus, that's what we did before 🫣 |
|
Ah, right. I noticed it but wasn't sure if |
|
Reverted in v0.3! Anywidget now warns developers that live-reloading is disabled if it cannot find |
|
Thanks for this super quick fix! |
|
awesome, great that you responded so quickly @manzt ! |
|
I am currently trying to test this with the |
|
https://pypi.org/project/watchfiles is currently at v1.1.1, but the version used in this project fails on Python 3.14. |
Right now, we raise an exception if one starts developing a widget locally but doesn't have
watchfilesinstalled.Requiring developers to remember to install optional dev dependencies (i.e.,
pip install "anywidget[dev]") is kind of annoying, and it's a pretty minimal dependency. This PR addswatchfilesas a direct dependency so developers can usepip install anywidgetand get started without any hiccups.As an alternative, we could add a warning rather rather than raising an exception, notifying the developer that "watchfiles" must be installed to enable anywidget's live development features, but still load the file the first time. I think adding the dependency is more simple solution, but am open to alternatives.