Skip to content
/ dolo Public

Create web apps by writing a simple python script

Notifications You must be signed in to change notification settings

mukund109/dolo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is dolo?

Dolo is something I put together over a weekend or two. Its a way to create web-based dashboards by writing a simple python script. The programming model is declarative and very similar to that of React. The API is pretty much a copy of streamlit's, but feature set is smaller and implementation is simpler.

I was blown away by streamlit's design and simplicity (and valuation) when I first used it, so decided to hack together a smaller working copy. Compared to streamlit, dolo only has a handful of components, and is more of a toy rather than a polished, production-ready thing.

How to use

  • Call dolo.write to render markup
  • dolo.button(...) creates a button and returns the state of the button (True or False) button demo
  • dolo.dropdown(...) creates a dropdown and returns the selected option as a string dropdown demo
  • dolo.filter(...) creates a filter and returns the active filter as a string
  • dolo.plot(...) plots a matplotlib figure filter demo
  • You can cache the outputs of expensive functions using the dolo.cache decorator
  • Put the code in lit.py and use flask run to run the app

How it works

  • The output of the script is used to generate the markup
  • For every incoming request dolo re-runs the script with the updated component state and re-renders the webpage based on the script's output.
  • The state is stored in a python dictionary.
  • All rendering is done server-side, which means even a button press refreshes the entire page. This is different from streamlit which is more of an SPA and changes are streamed over a websocket.

Bugs / Possible Bugs

  • state dictionary isn't thread-safe
  • UI breaks if a state update happens while the page is refreshing
  • using matplotlib.plt isn't recommended in a multi-threaded environment

About

Create web apps by writing a simple python script

Resources

Stars

Watchers

Forks