Skip to main content

A python library simplifying development of ipyvuetify voila apps

Project description

vvapp

A python library simplifying ipyvuetify voila application building.

Documentation

https://radinplaid.github.io/vvapp/

Install

pip install vvapp

Inputs

vvapp is meant to be used in Jupyter, so launching jupyter first ($jupyter notebook).

There are a few key things to keep in mind when getting up and running with vvapp:

  • v_model
    • The value of vvapp inputs is set and accessed via the v_model attribute, following the ipyvuetify convention
  • class_
    • This is where you put vuetify.js class properties, like ma-4 to add margins around the input
  • style_
    • This is where you can add CSS to your elements
  • hint
    • The hint can be a string or a callable to provide input validation
    • If hint is a callable, it must return a string or None; if it returns a string, the input is marked as invalid and the string is displayed
from vvapp.inputs import __all__ as available_input_widgets
available_input_widgets
['password', 'time', 'date', 'number', 'slider', 'radio_buttons']

slider

from vvapp.inputs import slider
slider(label='Slider Example',
       min=0,
       max=10,
       step=1,
       color='red',
       track_color='red',
       v_model=5)
Slider Input

radio_buttons

from vvapp.inputs import radio_buttons
radio_buttons(choices={
                    'Apple': 'apple',
                    'Blueberry': 'blueberry',
                    'Pumpkin': 'pumpkin'
                },
              label='What is your favourite pie flavour?',
              v_model='blueberry')
Radio Button Input

date

from vvapp.inputs import date
date(label='Please enter a date (format: YYYY-mm-dd)',
     v_model='2020-04-15',
     style_='max-width:320px')
Date Input

time

from vvapp.inputs import time
time(label='Please enter a time (format: HH:MM)',
     v_model='13:34',
     style_='max-width:320px')
Time Input

number

from vvapp.inputs import number
number(placeholder='Enter a number',
     style_='max-width:320px')
Number Input

number inputs have a default validation function that changes the error state of the input to True and prints a sensible hint if the value is less than min_value or greater than max_value

from vvapp.inputs import number
number(label='Number Input',
       v_model=123,
       min_value=0,
       max_value=100,
     style_='max-width:320px')
Number Input With Validation

password

from vvapp.inputs import password
pw = password(label='Please enter a password',v_model='correcthorsebatterystapler')
pw
Password Input

The value of of a vvapp widget is set/accessed by the v_model attribute, just like in ipyvuetify

pw.v_model
'correcthorsebatterystapler'

Here we demonstrate the use of a function to validate the value of the input.

In this example the password must be at least 12 characters, less than 64 characters and include at least one number:

import re
def validate_pw(widget_value):
    if widget_value is None:
        return 'Input must not be None'

    else:
        if len(widget_value) < 12:
            return 'Too Short!'

        if len(widget_value) > 64:
            return 'Too Long!'

        if not re.search('[0-9]+',widget_value):
            return 'Must contain at least one number!'

    return None

pw = password(label='Please enter a password',v_model='correcthorsebatterystapler', hint=validate_pw)
pw
Password Input with Validation

Outputs

PandasTable

import pandas as pd
from vvapp.outputs import PandasTable
df = pd.DataFrame({'a':[1,2,3],'b':[2,3,4]})
PandasTable(data=df,title='My DataFrame')
Pandas Dataframe Output

The pandas DataFrame output has a nice warning/error display if the search returns zero results or if are no rows in the PandasDataframe:

import pandas as pd
from vvapp.outputs import PandasTable
df = pd.DataFrame({'a':[1,2,3],'b':[2,3,4]})
PandasTable(data=df,title='My DataFrame')
Pandas Dataframe Output No Search Results
import pandas as pd
from vvapp.outputs import PandasTable
PandasTable(data=pd.DataFrame(),title='My DataFrame')
Pandas Dataframe Output No Data

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vvapp-0.0.7.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vvapp-0.0.7-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file vvapp-0.0.7.tar.gz.

File metadata

  • Download URL: vvapp-0.0.7.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.8.0 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for vvapp-0.0.7.tar.gz
Algorithm Hash digest
SHA256 e723d315b7e4e2bcbaffc043130715400fc4e6661eb0220ba3308556d46c3068
MD5 2ad309c1d7a6e97d82e240b77d16d834
BLAKE2b-256 2fafbb6cb65287eb812b6f14aa3daafb03f2c5b4a292871240241489c10d3701

See more details on using hashes here.

File details

Details for the file vvapp-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: vvapp-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.8.0 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for vvapp-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e9f0b6faa1ec96218829e68743b0221036159f3f61a203f78269b0ad86484605
MD5 5d3c5f8ee96e239fa535a7925ab6c329
BLAKE2b-256 3fafe2aee76fd96ed7c448cb5c1c13ef5835ddab99b3eccd761c9f9c4aad4d67

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page