Skip to main content

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:

  1. Create an InputValidator object: iv = InputValidator()

  2. Add one or more validation rules to the InputValidator: iv.add_rule("title", check.required())

  3. 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)

Source distribution for shiny-validate 0.1.3
File Size Uploaded
shiny_validate-0.1.3.tar.gz 34.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for shiny-validate 0.1.3
File Interpreter ABI Platform
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 log

Release 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

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page