wigging / chemics

A Python package for chemical engineering
https://chemics.readthedocs.io
MIT License
171 stars 15 forks source link

Chemics UI #30

Open lucafaggianelli opened 10 months ago

lucafaggianelli commented 10 months ago

Hi I stumbled upon your project and even though I'm not into chemistry it looks interesting :)

I've used a Python tool/framework called Plotly Dash for creating data-driven dashboards for several projects, so I thought your library would be a nice fit for a Dash app, here's what I've done with a couple of lines of code:

chemics-ui

let me know if you like the idea, always happy to contribute to open-source

wigging commented 10 months ago

I like the idea. Are you suggesting adding this to the chemics package or making a separate repository for the dashboard?

Related to this, I used Streamlit to make an interface to the biomass composition function that's in chemics. You can view the app at https://biocomptool.streamlit.app. I chose Streamlit because it was easy to deploy the web app.

lucafaggianelli commented 10 months ago

Don't know honestly, it could be in the same package to give the users a sort of playground, but probably it would be cleaner to do it in another package so the user is not forced to install tons of library just for the UI. Though it could be physically stored in the same repo. So to recap the options:

Where ✅ Pro ❌ Cons
same git repo and same chemics package you have the ui out-of-the-box when installing chemics and you can ship a CLI chemics ui to run it by default you have to install the UI packages even if you don't want it
separate git repo less code in the main repo, can easily fork/edit the ui code, install the ui if needed need to keep the ui aligned with chemics versions
same git repo, different package the code is all together, easier to align chemics versions with its UI, install the UI deps only when needed ui code in the main repo

Probably I would go with the last option and in general if you keep the UI in a separate package i.e. chemics_ui you're quite flexible and you can decide to move the UI code to a separate repo or merge the UI code from another repo to the main one without any impact.

Ah ok, yes indeed streamlit is very similar to dash, and I didn't know they had an hosting service, good to know! BTW the app is not working for me.

JeanBilheux commented 10 months ago

Another option that won't require a server would be to provide a notebook with embedded widgets to give a demo of how to use it and at the same time provide a nice interface.

wigging commented 10 months ago

@lucafaggianelli If everything is in the same repo, the UI dependencies could be made optional with pip install chemics[ui] otherwise you can do pip install chemics which doesn't install any of the UI stuff. But for now, I would prefer to have the UI in a separate repo as you suggest in the second item in the table. I can put a link to the UI repo in the chemics documentation and README. Maybe in the future we can combine everything into one repository but at the moment I would prefer to keep things separate. Also, where would you deploy the Dash app or do you expect people to run it locally on their own computer?

Regarding the Streamlit app, the link https://biocomptool.streamlit.app should work fine. Sometimes it can be slow to load but it should be working. I'm on a Mac and use Safari and Firefox so I can't verify if it works on Windows and Linux. But it's just a web app so I don't see why it wouldn't work on other platforms.

@JeanBilheux Using notebooks is another option but I think the original person is suggesting a UI (web app) so people can use the features of chemics without having to know Python or install Jupyter notebooks. And if you use Streamlit you don't have to deal with a server. The web app is deployed from the GitHub repo. I don't know what options are available for Dash but Streamlit makes it easy to deploy without having to maintain a server or deal with an app hosting service.

lucafaggianelli commented 10 months ago

Yes in the end another repo would be better at this stage. And on how to run the UI, I would keep both options 1. host it online so anyone can use it and 2. run it locally so one can customise it and deploy its own version

OK the problem with https://biocomptool.streamlit.app/ is that my company laptop was blocking some URLs, but on my personal laptop indeed the website works!