{"id":15348633,"url":"https://github.com/domoritz/streamlit-vega-lite","last_synced_at":"2025-08-12T02:04:50.238Z","repository":{"id":50276985,"uuid":"292341637","full_name":"domoritz/streamlit-vega-lite","owner":"domoritz","description":"A Streamlit component to render interactive Vega, Vega-Lite, and Altair visualizations and access the selected data from Python","archived":false,"fork":false,"pushed_at":"2021-04-29T23:14:38.000Z","size":5108,"stargazers_count":93,"open_issues_count":8,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-07-20T21:47:23.944Z","etag":null,"topics":["altair","arrow","python","vega","vega-lite"],"latest_commit_sha":null,"homepage":"","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/domoritz.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}},"created_at":"2020-09-02T16:53:49.000Z","updated_at":"2025-04-09T08:01:14.000Z","dependencies_parsed_at":"2022-08-25T14:12:01.118Z","dependency_job_id":null,"html_url":"https://github.com/domoritz/streamlit-vega-lite","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/domoritz/streamlit-vega-lite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domoritz%2Fstreamlit-vega-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domoritz%2Fstreamlit-vega-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domoritz%2Fstreamlit-vega-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domoritz%2Fstreamlit-vega-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/domoritz","download_url":"https://codeload.github.com/domoritz/streamlit-vega-lite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domoritz%2Fstreamlit-vega-lite/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269987123,"owners_count":24508176,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["altair","arrow","python","vega","vega-lite"],"created_at":"2024-10-01T11:50:13.854Z","updated_at":"2025-08-12T02:04:50.213Z","avatar_url":"https://github.com/domoritz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Streamlit Vega-Lite\n\n[![code style black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![PyPI - Downloads](https://img.shields.io/pypi/v/streamlit-vega-lite)](https://pypi.org/project/streamlit-vega-lite)\n\n**🐉 Here be dragons. This is a proof of concept.**\n\nMaking Vega-Lite selection created by user interactions available in Python. Works with [Altair](https://altair-viz.github.io/).\n\nFor examples, see https://github.com/domoritz/streamlit-vega-lite/blob/master/streamlit_vega_lite/__init__.py. You can also try the demo at https://github.com/domoritz/streamlit-vega-lite-demo. \n\n\u003cimg src=\"./demo.gif\" alt=\"Demo screencast\" width=400\u003e\u003c/img\u003e\n\n## Documentation\n\n### Installation\n\n`pip install streamlit-vega-lite`\n\n### Usage\n\nThere are two functions available. `vega_lite_component` expects a Vega-Lite specification as a dictionary and any named datasets as keyword arguments. The datasets will be transferred as efficient Arrow tables. `altair_component` supports Altair charts and automatically extracts all datasets and transfers them as Arrow dataframes.\n\n#### Example\n\n```python\nimport altair as alt\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nfrom streamlit_vega_lite import vega_lite_component, altair_component\n\nhist_data = pd.DataFrame(np.random.normal(42, 10, (200, 1)), columns=[\"x\"])\n\n@st.cache\ndef altair_histogram():\n    brushed = alt.selection_interval(encodings=[\"x\"], name=\"brushed\")\n\n    return (\n        alt.Chart(hist_data)\n        .mark_bar()\n        .encode(alt.X(\"x:Q\", bin=True), y=\"count()\")\n        .add_selection(brushed)\n    )\n\nevent_dict = altair_component(altair_chart=altair_histogram())\n\nr = event_dict.get(\"x\")\nif r:\n    filtered = hist_data[(hist_data.x \u003e= r[0]) \u0026 (hist_data.x \u003c r[1])]\n    st.write(filtered)\n```\n\n## Dev Setup\n\nOpen two terminals in the dev container using VSCode's [Remote Containers Extension](https://code.visualstudio.com/docs/remote/containers).\n\nIn the first terminal, run:\n\n```bash\n# Install python module in editable mode\npip install -e .\n\n# Launch streamlit app\nstreamlit run streamlit_vega_lite/__init__.py\n```\n\nIn the second terminal:\n\n```bash\n# Switch to location of frontend code\ncd streamlit_vega_lite/frontend\n# Install dependencies\nyarn\n# Launch frontend assets\nyarn start\n```\n\nThen open http://localhost:8501/.\n\n## Style\n\nRun Black for Python formatting.\n\n```\nblack . -l 120\n```\n\nRun Prettier for other formatting in the frontend directory.\n\n```\nyarn format\n```\n\n## Publish\n\nSee https://docs.streamlit.io/en/stable/publish_streamlit_components.html.\n\nMake sure that `_RELEASE` is set to `True`.\n\n```sh\npushd streamlit_vega_lite/frontend\nyarn build\npopd\npython setup.py sdist bdist_wheel\npython3 -m twine upload --repository pypi dist/*\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomoritz%2Fstreamlit-vega-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdomoritz%2Fstreamlit-vega-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomoritz%2Fstreamlit-vega-lite/lists"}