Package: zero-true
Zero True: A New Kind of Code Notebook🌐 OverviewWelcome toZero True, your go-to platform for creating beautiful and professional data-driven notebooks and applications in pure Python. Designed to foster collaboration and improve data accessibility, Zero True offers a rich UI library along with an intelligent code parser. Your notebook will always stay in sync.📚 Table of ContentsFeaturesRequirementsQuick StartUsageCommunityFeatures📝 Python + SQL reactive computational notebook.🌌 No hidden state. Our reactive cell updates show you what your notebook looks like in real time.📊 Dynamic UI rendering with beautifulVuetifycomponents.🔄 Automatic dependency tracking between cells.🚀 Integrated app publishing with a simple command.⚙ RequirementsPython 3.9 (Anaconda or virtual environment recommended)🚀 Quick Startpipinstallzero-true
zero-truenotebookUsageOnce the application is running, navigate tohttp://localhost:1326and start creating and executing code cells. Click the "Run" button to execute code and visualize the output below the editor.Basic Exampleimportzero_trueasztslider=zt.Slider(id='slider_1')print('The squared value is '+str(slider.value**2))More Complicated Example using Python + SQLFor this example you will need scikitlearnpipinstallscikit-learnOnce it has installed, launch your notebook. We will be using the Iris dataset from scikit learn to create an app where people
can filter the data using the our UI components and SQL editor. We start with a Python cell:importzero_trueasztimportsklearnimportpandasaspdfromsklearnimportdatasetsiris=datasets.load_iris()# Creating a DataFrame with the feature datairis_df=pd.DataFrame(data=iris.data,columns=iris.feature_names)# Map the target indices to target namesiris_df['target']=iris.targetiris_df['target_name']=iris_df['target'].apply(lambdax:iris.target_names[x])# Rename columns to remove spaces and standardizeiris_df.columns=[col.replace(' ','_').replace('(cm)','cm')forcoliniris_df.columns]iris_df.columns=[col.replace(' ','_').replace('(cm)','cm')forcoliniris_df.columns]iris_df.drop('target',axis=1,inplace=True)#all the different sliderssepal_width_slider=zt.RangeSlider(id='sepal_width',min=iris_df.sepal_width_cm.min(),max=iris_df.sepal_width_cm.max(),step=0.1,label='Sepal Width')petal_width_slider=zt.RangeSlider(id='petal_width',min=iris_df.petal_width_cm.min(),max=iris_df.petal_width_cm.max(),step=0.1,label='Petal Width')sepal_length_slider=zt.RangeSlider(id='sepal_length',min=iris_df.sepal_length_cm.min(),max=iris_df.sepal_length_cm.max(),step=0.1,label='Sepal Length')petal_length_slider=zt.RangeSlider(id='petal_lenght',min=iris_df.petal_length_cm.min(),max=iris_df.petal_length_cm.max(),step=0.1,label='Petal Length')Then add a SQL cell below to query the dataframe. Notice how we can query a pandas dataframe directly and reference our
UI components in the query:SELECT*FROMiris_dfWHERE(sepal_length_cmBETWEEN{sepal_length_slider.value[0]}AND{sepal_length_slider.value[1]})AND(sepal_width_cmBETWEEN{sepal_width_slider.value[0]}AND{sepal_width_slider.value[1]})AND(petal_width_cmBETWEEN{petal_width_slider.value[0]}AND{petal_width_slider.value[1]})AND(petal_length_cmBETWEEN{petal_length_slider.value[0]}AND{petal_length_slider.value[1]})Notice how dragging the slider will update the dataframe. Set the parameters for your Iris bouquet and check out the data! You can
see a published app for thisexample.We support a large range of use cases and UI components. For more information please check out our docs:docs! You can also find some more narrative tutorials at our Medium publicationhere.PublishingPublishing your notebook is easy. Currently it's a one liner from the command line:zero-truepublish[api-key][user-name][project-name][project-source]Publishing is only open to a limited audience. If you are interested in publishing your notebook at a URL in our public cloud please fill out the email waiting list on ourwebsite.CommunityReach out on GitHub with any feature requests or bugs that you encounter and share your work with us onTwitter/X! We are also active onlinkedin. We would love to see what you're able to build using Zero-True.