{"id":16200856,"url":"https://github.com/observedobserver/pygwalker-shiny","last_synced_at":"2025-07-02T03:06:45.425Z","repository":{"id":232369069,"uuid":"708559497","full_name":"ObservedObserver/pygwalker-shiny","owner":"ObservedObserver","description":"run pygwalker with shiny","archived":false,"fork":false,"pushed_at":"2023-10-22T22:42:11.000Z","size":5,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-07T18:16:04.656Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/ObservedObserver.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-10-22T22:42:10.000Z","updated_at":"2025-01-23T17:21:36.000Z","dependencies_parsed_at":"2024-04-09T13:49:13.221Z","dependency_job_id":"ddf43769-0934-43b1-99f7-844fe3974d55","html_url":"https://github.com/ObservedObserver/pygwalker-shiny","commit_stats":null,"previous_names":["observedobserver/pygwalker-shiny"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ObservedObserver/pygwalker-shiny","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ObservedObserver%2Fpygwalker-shiny","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ObservedObserver%2Fpygwalker-shiny/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ObservedObserver%2Fpygwalker-shiny/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ObservedObserver%2Fpygwalker-shiny/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ObservedObserver","download_url":"https://codeload.github.com/ObservedObserver/pygwalker-shiny/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ObservedObserver%2Fpygwalker-shiny/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263066558,"owners_count":23408387,"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-10-10T09:34:32.794Z","updated_at":"2025-07-02T03:06:45.399Z","avatar_url":"https://github.com/ObservedObserver.png","language":"Python","readme":"## How to Integrate PyGWalker with Shiny-Python\n\n`Shiny-Python` is a great framework to build interactive web applications using Python, and combining it with `pygwalker` opens up new avenues for creating data-driven interactive web applications. In this tutorial, we'll walk you through the process of integrating `pygwalker` with `Shiny-Python`.\n\n![](https://imagedelivery.net/tSvh1MGEu9IgUanmf58srQ/ddb0698d-19cd-40d7-dbda-d5987d67b100/public)\n\n### Prerequisites:\n\n1. Ensure you have both `shiny` and `pygwalker` libraries installed. You can do this using pip:\n```bash\npip install shiny pygwalker\n```\n\n### Step-by-Step Guide:\n\n#### 1. Import Necessary Libraries\n\nStart by importing the required modules:\n\n```py\nfrom shiny import App, ui\nimport pygwalker as pyg\nfrom datasets import load_dataset\n```\n\n#### 2. Load the Dataset\n\nFor this tutorial, we're leveraging the NYC-Airbnb dataset, but you can replace it with any dataset you prefer:\n\n```py\ndataset = load_dataset(\"gradio/NYC-Airbnb-Open-Data\", split=\"train\")\ndf = dataset.to_pandas()\n```\n\n#### 3. Design the Shiny User Interface\n\nDefine the user interface (UI) of the Shiny application using `ui` components:\n\n```py\napp_ui = ui.page_fluid(\n    ui.h1(\"Using pygwalker with Shiny\"),\n    ui.markdown(\"This is a demo of using [pygwalker](https://github.com/Kanaries/pygwalker) with Shiny.\"),\n    ui.HTML(pyg.walk(df, spec=\"./viz-config.json\", return_html=True, debug=False)),\n)\n```\n\nHere's a quick breakdown of the UI components:\n\n- `ui.h1()`: Adds a header to the Shiny app.\n- `ui.markdown()`: Allows you to include markdown-formatted text for descriptions or additional information.\n- `ui.HTML()`: This is where `pygwalker` comes into play. The `pyg.walk()` function transforms the dataset into an interactive visualization, which is then rendered in the Shiny app through this HTML component.\n\n#### 4. Define the Server Function\n\nThough in this example, the server function is empty, it's where any reactive behavior would be defined. As the app grows more complex, you might find yourself populating this section with more interactive logic.\n\n```py\ndef server(input, output, session):\n    ...\n```\n\n#### 5. Instantiate and Run the App\n\nFinally, create the Shiny app instance and then run it:\n\n```py\napp = App(app_ui, server)\n```\n\nIf you want to immediately launch the app, you can add the line:\n\n```py\napp.run()\n```\n\nor \n```bash\nshiny run --reload\n```\n\n![](https://imagedelivery.net/tSvh1MGEu9IgUanmf58srQ/ddb0698d-19cd-40d7-dbda-d5987d67b100/public)\n\n### Conclusion\n\nBy integrating `pygwalker` with `Shiny-Python`, you can harness the power of both tools to build impressive and interactive data visualization web apps. This not only provides a rich user experience but also allows a broader audience to engage with your data insights. Get started and unleash the potential of your datasets!","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobservedobserver%2Fpygwalker-shiny","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobservedobserver%2Fpygwalker-shiny","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobservedobserver%2Fpygwalker-shiny/lists"}