Streamlit cli option to generate, build, run new custom component?

I think it would encourage more custom component creation if there was an easier way to get all the boilerplate in place. I felt this could be a nice addition while I was working with ng-cli.
Something along these lines would be awesome, What are your thoughts?

streamlit component generate --type=reactless --name=my_awesome_component 
streamlit component build
streamlit component run # maybe ?

I’m interested to see if others would like this :slight_smile:

As a workaround, we talked about providing cookiecutters for the generate part, then I guess have a Makefile/Invoke in the template run the commands build and run pointing to the package.json location. Not branded streamlit but would work decently enough.

1 Like

Yes I think cookiecutter should do it. Atleast for the generate part. I like the idea of makefile as well. Will try to whip up something on the same lines.

Thanks Fanilo !p

2 Likes

I’d love to see such commands directly embedded in streamlit as well!

Makefiles are great, I overly use them (already have one to build yarn + bdist_wheel, and launch twine). However, although you can use them almost out of the box on Linux, on Windows you’d need an additional installation step.

2 Likes

Frankly I’ve never been able to run Makefiles correctly on Windows :cry: (sad because Streamlit dev setup is mostly Makefile too…), which is why I’m more used to Invoke :slight_smile:

I’m open to all solutions on this!

+1 for the point about Makefiles on windows.
I was just wondering if we had this CLI functionality will it encourage more custom development in this sense,
Like suppose I start a streamlit project and needed to simply use geolocation api of html5, if I had this option maybe I could setup my project like this,

myproject->
    |- components
    |     |- geolocation_component
    |- main.py  <- import geolocation component and use it here

I know its pretty vague, but if I could do something like this it would drastically change the extent of usage of streamlit for me.
Maybe this approach would make my project more of a react project than a python project but the flexibility to do this quick-plugin-in based development would be pretty handy for some usecases.