Replies: 6 comments 11 replies
-
I'm all for supporting new features that will allow ease of adding and incorporating common utilities! I'm a bit unsure of how an extension layout will be - can it be multiple files, have external dependencies or data sources? And consequently, will this data have to be in its own place, or how easily can it be integrated into the rest of the app/data. Take authentication for example - I can see how the initial db setup/login works, but how would it look in practice when parts of the main app would need to interact with extended functionality? For example, page guards, or a core persistence class - would it need to be moved to on_page_change instead? Or even multiple extensions interacting with each other - say an admin panel extension that needs to update roles in the user db, which is linked to an auth extension. How much of this can instead be achieved by having a component library instead - for example the cookie warning. Auth/admin however sounds more like it will need a lot more glue - just wondering if it would be better to just have an example app library for these more complex things. |
Beta Was this translation helpful? Give feedback.
-
I would like to see support for integrating Typescript libraries with the Python framework, allowing for extensions that are built around TS projects while remaining Python-only for end users. |
Beta Was this translation helpful? Give feedback.
-
I've implemented this. It's going through testing now 👌 |
Beta Was this translation helpful? Give feedback.
-
Hi. Another topic which could improve Rio is the addition of more sophisticated ways to create animations. I've read at https://rio.dev/docs/api/rectangle that Rectangles are used for that. However if Rio can include a new Component such as Animation where we could use things like treejs, animejs, snapjs, it would be really interesting. The Animation class could use SVG animations to change their scalar attributes, so we could pass Icons. |
Beta Was this translation helpful? Give feedback.
-
Another thing I'm really missing is the fixed attribute to position divs. I know I can use Stack, but it lacks the independence fixed value gives with html. |
Beta Was this translation helpful? Give feedback.
-
Let's keep this conversation focused on extensions please. If you're looking for additional features create a new discussion or issue! |
Beta Was this translation helpful? Give feedback.
-
We've long wanted to add an extension API to Rio. The plan is to allow everyone
to extend Rio while keeping the core small(ish). We have thought about this for
some time and have a first outline of what we think the API should look like.
Please take a look and let us know what you think.
The basic idea is to create a
rio.Extension
class that can be subclassed toexpand Rio's functionality. Then, when a
rio.App
is created, a list ofextensions can be passed in to add the functionality to the app. Something like
this:
Extension API
The API is simple: Create a Python class that inherits from
rio.Extension
.This class can then register handlers that are triggered whenever something
happens in an app:
on_app_start
is called when the app starts upon_app_close
is the counterpart toon_app_start
and is called when the appis shutting down
on_session_start
is called when a new user connects to the appon_session_close
is called when a user disconnects from the appon_as_fastapi
is not only in desperate need for a better name, but is alsocalled when
as_fastapi
is called on an app. This allows extensions to addcustom routes or middlewares to the FastAPI app that Rio uses internally
on_page_change
triggers when a user navigates to a new page in the appMore events can be added in the future of course, these are just what we've
thought up so far.
A simple extension would look something like this:
A real extension would of course also bring configuration options and make sure
not to warn the same user multiple times, but you get the idea.
Use Cases
Feedback
What do you think? Is this API flexible enough? Are there any events missing? Do
you have a better idea alltogether? Let us know!
Beta Was this translation helpful? Give feedback.
All reactions