Skip to content
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

Make adding new components to core easier #3361

Closed
Tracked by #3268
pngwn opened this issue Mar 2, 2023 · 1 comment
Closed
Tracked by #3268

Make adding new components to core easier #3361

pngwn opened this issue Mar 2, 2023 · 1 comment
Assignees
Labels
refactor Involves refactoring existing code svelte Frontend-related issue (JS)

Comments

@pngwn
Copy link
Member

pngwn commented Mar 2, 2023

Currently we register each component like this:

const component_directory = {
  'pycompname': () => import('....'),
  ...
}

This is kindof annoying with all of the other stuff you have to do. Need to change it. We need some magic 🪄

There are a couple of ways we can do this.

I'm thinking that components in packages can have a special field added to them if they are a gradio component and we can autogenerate everything. Then the process of adding a new component to core will just be a case of adding a new package with this fields, respecting the documented structure and nothing else.

The alternative is adding a method (which we'll need for custom components anyway), something like register` would be magical but requires more work for devs and could introduce more tooling issues (typescript in particular).

This will need some TS declaration files either way I think.

@pngwn pngwn changed the title Remove the component directory hardcoding. There are a couple of ways we can do this. I'm thinking that components in packages can have a special field added to them and we can autogenerate everything. Then the process of adding a new component to core will just be a case of adding a new package and nothing else. Alternative is adding a method (which we'll need for custom components anyway), something like register` would be magical but requires more work for devs and could introduce more tooling issues (typescript in particular). Make adding new components to core easier Mar 2, 2023
@pngwn pngwn added refactor Involves refactoring existing code svelte Frontend-related issue (JS) labels Mar 2, 2023
@pngwn pngwn self-assigned this Mar 2, 2023
@abidlabs
Copy link
Member

Was done as part of 4.0! Thanks @pngwn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Involves refactoring existing code svelte Frontend-related issue (JS)
Projects
None yet
Development

No branches or pull requests

2 participants