-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
Reconsider how we use/advertise idom.run() #657
Comments
My personal opinion is that Instead, we should focus on simplifying how users integrate IDOM into existing applications. It's an over-reach of scope for us to handle anything related to launching a WSGI/ASGI webserver. |
We could add a big fat warning about this instead? Technically doing |
Meh, nevermind. We should completely shift how this works:
Doing this with appropriate deprecation warnings will be a bit tricky, but I think that sends a more accurate message about how you should expect to use IDOM. |
The only question then is how you many the "hello world" still look simple... |
Maybe do: from idom import component, html, server
@component
def App():
return html.h1("Hello, World!")
server.default.run(App) Except or maybe |
There's also a question of the install target: #600 I think we should we remove any sense of a "default" install target too since you'd always need to explicitly call out which server implementation you're using. There's no way to give a deprecation warning for this removal though as far as I can tell unless |
IDOM is still
Maybe we consider a pattern like this (with the run callable name being TBD) from idom import component, html, devtools
from fastapi import FastAPI
fastapi_app = FastAPI()
@component
def Hello():
return html.h1("Hello, World!")
# This should print a warning that it is not production usable
devtools.run(fastapi_app, component=Hello) |
I'm worried about the hello-world implying a preference for a given server implementation. |
That's pretty much an impossible problem to solve without multiple examples for each framework. We support multiple web frameworks, but we need to choose at least one to first demo with. Could just be a comment saying "Utilize whatever Python web framework you like here!" |
That's a good first step. This actually brings up another thing I've forgotten to mention. I really dislike the name |
I also agree with this. It's best for us to not dictate what gets used. In that case, we really don't need a parameter at all. We can just say it's up to them to separately install a web framework, similar to how whitenoise has no Flask/FastAPI/Django/etc pip parameters, |
True |
I've gotten an inverse comment at some point. With that said, I had a hard time coming up with a name that accurately described what they did so I'd be open to suggestions. |
I feel some obligation to make things easier on early adopters where possible. |
Based on your your thoughts above, I think I've come up with the best solution for everyone. Implement the following
Optional
|
Just removing On the topic of
|
On a side note, I've decided to commit to creating IDOM video tutorials. We're going to need something for our visual learners to increase adoption. I'll try and make that happen sometime this year. |
Let me know if you agree on #657 (comment) |
I think this issue may be related: #653 |
Ah, whoops, didn't read through your comment. Yes, I think I agree. |
Probably with the addition that |
How do you feel about removing SharedView? #657 (comment) |
I agree |
Current Situation
idom.run()
probably shouldn't be the primary advertised way of using IDOM. Especially in it's current state.Using a development webserver for production use is a big no-no, and by prominently displaying
idom.run()
as the first steps to using IDOM shows we are encouraging people to do just that. I believe the primary way of utilizing IDOM should be embedding within existing applications.Proposed Actions
idom.run()
as is, but add logging to indicateidom.run()
is not suited for production use.idom.run() is only intended for testing purposes. For production use, consider embedding IDOM within an existing project. Check out the docs for more info.
PerClientState
toIdomView
Optional
idom.testing.webserver()
idom.shortcuts.run()
idom.devtools.run_webserver()
idom.run()
should raise a simple to understand exception if the user has forgotten to install a web frameworkLooks like you don't have a web framework installed. You'll need to pip install one of the following: fastapi, flask, sanic
The text was updated successfully, but these errors were encountered: