{"id":15288055,"url":"https://github.com/singingwithcode/yaml2st","last_synced_at":"2026-02-08T16:30:51.189Z","repository":{"id":37842071,"uuid":"504292077","full_name":"singingwithcode/YAML2ST","owner":"singingwithcode","description":"YAML2ST automates streamlit input widgets from a YAML.","archived":false,"fork":false,"pushed_at":"2024-03-20T01:04:12.000Z","size":46,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-20T13:05:33.839Z","etag":null,"topics":["streamlit","streamlit-components","streamlit-sharing"],"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/singingwithcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2022-06-16T20:09:11.000Z","updated_at":"2023-03-06T16:23:38.000Z","dependencies_parsed_at":"2024-03-20T01:37:49.265Z","dependency_job_id":"eac9a987-28bc-448e-bce9-dc546f8fdebb","html_url":"https://github.com/singingwithcode/YAML2ST","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singingwithcode%2FYAML2ST","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singingwithcode%2FYAML2ST/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singingwithcode%2FYAML2ST/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singingwithcode%2FYAML2ST/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/singingwithcode","download_url":"https://codeload.github.com/singingwithcode/YAML2ST/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248675067,"owners_count":21143762,"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":["streamlit","streamlit-components","streamlit-sharing"],"created_at":"2024-09-30T15:43:59.266Z","updated_at":"2026-02-08T16:30:51.156Z","avatar_url":"https://github.com/singingwithcode.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YAML 2 STREAMLIT\n## Description\nYAML2ST automates streamlit input widgets from an uploaded YAML or JSON file. All key value pairs will be displayed as streamlit input widgets. You can then export the data changes via YAML or share a URL that contains the YAML file.\n\n# Use: As A Package\n## To Install\nIn a python environment:\n\n`pip install YAML2ST`\n\n## To Import\nIn a python file:\n\n`import streamlit as st`\u003cbr\u003e\n`import YAML2ST as y2s`\n\n## To Display YAML/JSON as Input Widgets\nUse an UploadedFile type, e.g. a file from `st.file_uploader()`, and the Streamlit instance in the location you would like the input widgets displayed, e.g. `st.sidebar`, with the YAML2ST `build()` method:\n\n`df = y2s.build(uploadedFile, st.sidebar)`\u003cbr\u003e\nbuild() will return a pandas DataFrame in which you can capture and display all input widget changes. \n\n## To Export Data: Easy\nTo export with ease, use: the original  UploadedFile, the changes made in the DataFrame, an instance of Streamlit for where you want the export features drawn, and the domain of the URL that we can add a parameter to.\n\n`y2s.export(uploadedFile, df, st.sidebar, \"http://localhost:9097/\")`\u003cbr\u003e\nexport() will draw 2 widgets at the Streamlit instance, a download button and a code box with the share link. \n\n## To Export Data: Raw\nIf you do not want these widgets drawn on Streamlit, you can use exportRaw() to capture the data:\n\n`file, file_name, sharelink = exportRaw(uploadedFile, df, URL)`\n\n# Use: Demo File (GitHub)\nThe demo file dubbed main().py is on GitHub.\n## To Run\n`streamlit run app/main.py --server.port 9097`  \nUpload a YAML file.\n\n# YAML \u0026 Dynamics\n## YAML2ST Dynamics\nThe Streamlit input widgets are dynamically manifested using the following conditional order. \n| Widget | Value Input | \n| ------ | ------ |\n| `checkbox` | Any value that is 'True' or 'False' |\n| `number_input` (integer) | Any value that can be cast to an int. Step defaults to +1/-1.\n| `number_input` (decimal) | Any value that can be cast to a float. Step defaults to the smallest digit in the value. |\n| `date_input` | Any value that is ISO-8601 standard. E.g.: `\"2010-02-11\"`|\n| `datetime_input` | A YAML2ST custom  widget to support date and time. E.g.: `\"2015-06-17 14:03:40\"` |\n| `color_picker` | Any value that matches hexadecimal with #. E.g.: `\"#0EE2D7\"` |\n| `text_area` | Any value that contains a new line `\\n` |\n| `multiselect` | Any value that is a list e.g. starts with `[` |\n| `text_input` | All other data |\n## Example YAML\n### Example 1:\n`int: 1`\u003cbr\u003e\nYAML2ST will decide that the best way to display this will be with a Streamlit \"number_input\" and will draw a number_input with a title of \"int\" and a value of 1 on the Streamit instance provided. \n### Example 2:\n`string: \"Dynamic\"`\u003cbr\u003e\nYAML2ST will decide that the best way to display this will be with a Streamlit \"text_input\" and will draw a text_input with a title of \"string\" and a value of \"Dynamic\" on the Streamit instance provided. \n\n# YAML \u0026 YAML2ST #FORCE\nShould you wish to display the value of the parameter with a specific input widget, we have made that easy with the use of ` #FORCE: ` next to the YAML parameter in the YAML file. You may also separate each #FORCE: option with ` | ` (including the space before and after the pipe). This capability extends to all of the Streamlit input widget options as your options are taken literally if not recognized by YAML2ST.\n## Application Level Options \n| Option | Action | \n| ------ | ------ |\n| `hide=True` | Will ignore the YAML parameter. |\n| `type=int` | Will force the data type. |\n## Example YAML\n### Example 1:\n`int: 1 #FORCE: w=number_input | min_value=0 | max_value=10`\u003cbr\u003e\nThe YAML parameter \"int: 1\" will be read by YAML2ST as a Streamlit number_input. However, it is best practice to declare the \"number_input\" Streamlit input widget if there will be literal input widget options such as \"min_value\" and \"max_value\".\n### Example 2:\n`list1: [ \"one\", \"two\", \"three\", \"four\" ] #FORCE: w=selectbox | index=2`\n### Example 3:\n`block_shape5: [ \"five\", \"three\", \"four\"] #FORCE: w=selectbox | options=[ \"six\", \"one\", \"two\"] | index=2`\n### Example 4:\n`hidden_param: \"zero\" #FORCE: hide=True`\n\n\n# YAML Requirements\n1. The YAML key hierarchy must be unique.  \n`colors:`  \n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`color: Red`  \n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`color: Green`  \n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`color: Blue` # this will override the breadcrumb \"colors-\u003ecolor\" so only \"color: Blue\" will exist\n2. No blank lines (comments are fine).\n3. For now, it only supports single line data.\n\n# Feature: Share With Link Feature\nYou may share a YAML file as a URL. During export() a special URL will be encoded. The domain of the URL, in the code, may need to be updated. YAML2URL uses a single URL parameter dubbed 'YAML2URL' to share all contents of a YAML, including comments and the Y2S #FORCE feature. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsingingwithcode%2Fyaml2st","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsingingwithcode%2Fyaml2st","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsingingwithcode%2Fyaml2st/lists"}