The Fastest way to build apps in python
Datastack is an open-source framework that enables you to easily build real-time web apps, internal tools, dashboards, weekend projects, data entry forms, or prototypes using just Python—no frontend experience required.
pip install pydatastack
pip install git+https://github.com/data-stack-hub/DataStack.git#subdirectory=lib
or
git clone https://github.com/data-stack-hub/DataStack.git
cd DataStack\lib
pip install .Create new file counter.py with following code:
fromdatastackimportdatastackds=datastack(main=True)
ds.subheader('DataStack click counter app')
count=0definc_count():
globalcountcount+=1ds.button('Click', on_click=inc_count)
ds.write('counts: '+str(count))Now run it to open the app!
$ datastack run counter.py
Open app in browser localhost:5000
Visit the DataStack documentation site for more examples.
The documentation has been built using DataStack itself. If you have any questions or need assistance, feel free to raise an issue.
# write textds.write('some text')# dropdown selectionds.subheader('Dropdown Selection')
selected_value=ds.select(['a','b','c'])
ds.write('selected value: '+selected_value)# listds.subheader('List')
selection_from_list=ds.list(['a','b','c'])
ds.write('Selected Option: '+selection_from_list)# Buttondefinc_count(a):
globalcountcount+=1ds.subheader('Button click')
count=0ds.button('Click', on_click=inc_count)
ds.write('Count value: '+str(count))# inputds.subheader('Input value')
input_value=ds.input(input_value)
ds.write('Input: '+input_value)# HTMLds.subheader("HTML")
ds.html("<div style='color:green'>HTML Text</div>")# Iframeds.subheader('Iframe')
defchange_iframe(a):
globalurlifa['payload'] =='Wikipedia':
url='https://www.wikipedia.org/'elifa['payload'] =='ML':
url='https://en.wikipedia.org/wiki/ML'else:
url='https://www.wikipedia.org/'ds.list(['Wikipedia','ML'], on_click=change_iframe)
url='https://www.wikipedia.org/'ds.iframe(url)# page dividerds.divider()# dataframedf=pd.DataFrame(
[["a", "b"], ["c", "d"]],
index=["row 1", "row 2"],
columns=["col 1", "col 2"])
ds.write('dataframe')
ds.dataframe(df)# tableds.write('table')
ds.table(df)# data inputdate=ds.date_input()
