Skip to content

ustas4/DataStack

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcom to DataStack

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.

Installation

pip install pydatastack

Build from Source

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 .

Quickstart

Create new file counter.py with following code:

from datastack import datastack
ds = datastack(main=True)

ds.subheader('DataStack click counter app')

count = 0

def inc_count():
    global count
    count += 1

ds.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

Alt text

DataStack Widgets

# write text
ds.write('some text')
#  dropdown selection
ds.subheader('Dropdown Selection')
selected_value = ds.select(['a','b','c'])
ds.write('selected value: ' + selected_value)
# list
ds.subheader('List')
selection_from_list = ds.list(['a','b','c'])
ds.write('Selected Option: ' + selection_from_list)
# Button
def inc_count(a):
    global count
    count +=1
ds.subheader('Button click')
count = 0
ds.button('Click', on_click=inc_count)
ds.write('Count value: '+ str(count))
# input
ds.subheader('Input value')
input_value = ds.input(input_value)
ds.write('Input: '+ input_value)
#  HTML
ds.subheader("HTML")
ds.html("<div style='color:green'>HTML Text</div>")
# Iframe
ds.subheader('Iframe')
def change_iframe(a):
    global url
    if a['payload'] == 'Wikipedia':
        url = 'https://www.wikipedia.org/'
    elif a['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 divider
ds.divider()
# dataframe
df = pd.DataFrame(
    [["a", "b"], ["c", "d"]],
    index=["row 1", "row 2"],
    columns=["col 1", "col 2"])
ds.write('dataframe')
ds.dataframe(df)
# table
ds.write('table')
ds.table(df)
# data input
date = ds.date_input()

About

The Fastest way to build apps in python

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 61.2%
  • Python 23.6%
  • TypeScript 8.9%
  • HTML 5.4%
  • Batchfile 0.4%
  • Makefile 0.3%
  • Other 0.2%