{"id":18352046,"url":"https://github.com/posit-dev/py-shiny-validate","last_synced_at":"2025-04-13T15:11:34.157Z","repository":{"id":211986261,"uuid":"730433420","full_name":"posit-dev/py-shiny-validate","owner":"posit-dev","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-17T14:24:16.000Z","size":91,"stargazers_count":5,"open_issues_count":4,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-27T06:05:20.053Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/posit-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-11T23:11:17.000Z","updated_at":"2025-03-17T14:24:19.000Z","dependencies_parsed_at":"2023-12-19T18:51:15.695Z","dependency_job_id":"7e994d12-3f61-4963-9d8f-e54afaf9c830","html_url":"https://github.com/posit-dev/py-shiny-validate","commit_stats":null,"previous_names":["gshotwell/py-shiny-validate"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fpy-shiny-validate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fpy-shiny-validate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fpy-shiny-validate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fpy-shiny-validate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posit-dev","download_url":"https://codeload.github.com/posit-dev/py-shiny-validate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248732484,"owners_count":21152852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T21:34:32.382Z","updated_at":"2025-04-13T15:11:34.141Z","avatar_url":"https://github.com/posit-dev.png","language":"JavaScript","readme":"# shiny_validate\n\n## Overview\n\nThis is a python implementation of [shinyvalidate](https://rstudio.github.io/shinyvalidate/), which provides input validation for [Shiny for Python](https://shiny.posit.co/py/) applications.\n\n## Installation\n\nInstall from Pypi with:\n\n```\npip install shiny_validate\n```\n\nOr, you can install the latest development version from GitHub:\n\n```\npip install git+https://github.com/posit-dev/py-shiny-validate.git\n```\n\n## Basic usage\n\nTo add validation to your Shiny app, you need to:\n\n1.  Create an InputValidator object: `iv = InputValidator()`\n\n2.  Add one or more validation rules to the InputValidator: `iv.add_rule(\"title\", check.required())`\n\n3.  Turn the validator on: `iv.enable()`\n\nThat's all you need to do to get validation messages to show up.\n\n```python\nfrom shiny import App, ui, render, req\nfrom shiny_validate import InputValidator, check\n\napp_ui = ui.page_fluid(\n    ui.input_text(\"name\", \"Name\"),\n    ui.input_text(\"email\", \"Email\"),\n    ui.output_text(\"greeting\"),\n)\n\n\ndef server(input, output, session):\n    iv = InputValidator()\n\n    iv.add_rule(\"name\", check.required())\n    iv.add_rule(\"email\", check.required())\n    iv.add_rule(\"email\", check.email())\n    iv.enable()\n\n    @render.text\n    def greeting():\n        req(iv.is_valid())\n        return f\"Nice to meet you, {input.name()} \u003c{input.email()}\u003e!\"\n\n\napp = App(app_ui, server)\n```\n\nYou can also use the `.is_valid()` method to ensure that the inputs are valid before rendering an output:\n\n```python\n@render.plot\ndef plot():\n    req(iv.is_valid())\n    # Build and return a plot if the inputs are valid\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposit-dev%2Fpy-shiny-validate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposit-dev%2Fpy-shiny-validate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposit-dev%2Fpy-shiny-validate/lists"}