shiny_validate
Overview
This is a python implementation of shinyvalidate, which provides input validation for Shiny for Python applications.
Installation
Install from Pypi with:
pip install shiny_validate
Or, you can install the latest development version from GitHub:
pip install git+https://github.com/posit-dev/py-shiny-validate.git
Basic usage
To add validation to your Shiny app, you need to:
-
Create an InputValidator object:
iv = InputValidator() -
Add one or more validation rules to the InputValidator:
iv.add_rule("title", check.required()) -
Turn the validator on:
iv.enable()
That's all you need to do to get validation messages to show up.
from shiny import App, ui, render, req
from shiny_validate import InputValidator, check
app_ui = ui.page_fluid(
ui.input_text("name", "Name"),
ui.input_text("email", "Email"),
ui.output_text("greeting"),
)
def server(input, output, session):
iv = InputValidator()
iv.add_rule("name", check.required())
iv.add_rule("email", check.required())
iv.add_rule("email", check.email())
iv.enable()
@render.text
def greeting():
req(iv.is_valid())
return f"Nice to meet you, {input.name()} <{input.email()}>!"
app = App(app_ui, server)
You can also use the .is_valid() method to ensure that the inputs are valid before rendering an output:
@render.plot
def plot():
req(iv.is_valid())
# Build and return a plot if the inputs are valid
Metadata
Release files for shiny-validate 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| shiny_validate-0.1.3.tar.gz | 34.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shiny_validate-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 75.0 kB
Release files / shiny_validate-0.1.3.tar.gz
| Download URL | shiny_validate-0.1.3.tar.gz |
|---|---|
| Size | 34.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db3f530e0af99c792fb8fe1b3feb760658ce88ea5a35fbb88b8a23c2403291e8
|
|
BLAKE2b-256 checksum How to use checksums |
3a5f499b52ae5f5ccde146a2718feea2fc11ef3411ecaed58f5cdec1c6cd49f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 17, 2025.
Transparency logRelease files / shiny_validate-0.1.3-py3-none-any.whl
| Download URL | shiny_validate-0.1.3-py3-none-any.whl |
|---|---|
| Size | 40.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c66842f9b5e9deab8ba87eb6437cb14bbe470c603550d7055acfd3ec1f5d0f70
|
|
BLAKE2b-256 checksum How to use checksums |
590de022d169e127413cbdb9cfe0b1a8e45a77ba78adc6ea5a3a4c820cdc0b64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 17, 2025.
Transparency log