{"id":7765,"library":"streamlit-faker","title":"Streamlit Faker","description":"streamlit-faker is a Python library designed to easily fake Streamlit commands. It allows developers to quickly draft a user interface or use it as a QA tool by generating random parameters for Streamlit functions, streamlining the prototyping process. It is built upon the popular `faker` project. The current version is 0.0.4, and it has an active, though not rapid, release cadence.","status":"active","version":"0.0.4","language":"en","source_language":"en","source_url":"https://github.com/arnaudmiribel/streamlit-faker","tags":["streamlit","faker","mocking","testing","prototyping","ui-development"],"install":[{"cmd":"pip install streamlit-faker","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core dependency for generating diverse fake data patterns for Streamlit commands.","package":"faker","optional":false},{"reason":"The underlying framework whose commands are being faked.","package":"streamlit","optional":false}],"imports":[{"note":"The primary entry point is the `get_streamlit_faker` function, not the module itself.","wrong":"import streamlit_faker","symbol":"get_streamlit_faker","correct":"from streamlit_faker import get_streamlit_faker"}],"quickstart":{"code":"import streamlit as st\nfrom streamlit_faker import get_streamlit_faker\n\nst.title(\"Streamlit Faker Demo\")\n\nst_faker = get_streamlit_faker(seed=42) # Optional: set a seed for reproducible fake data\n\nst.subheader(\"Faked UI Elements:\")\nst_faker.markdown()\nst_faker.selectbox()\nst_faker.slider()\nst_faker.map()\nst_faker.button(\"Faked Button\")\n\nst.info(\"This entire section was generated with fake data using streamlit-faker.\")","lang":"python","description":"This quickstart demonstrates how to instantiate `streamlit-faker` and use it to render various Streamlit UI elements with randomly generated content. Run this script with `streamlit run your_app.py`."},"warnings":[{"fix":"Use for initial layout and visual feedback. For robust testing or complex logic, implement actual Streamlit components with specific test data or a dedicated testing framework.","message":"streamlit-faker is primarily designed for rapid prototyping and UI drafting. It generates plausible, but random, data and may not accurately reflect complex real-world Streamlit app behavior, especially concerning intricate user interactions, state management, or custom components.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Carefully review and explicitly define `key` arguments for stateful widgets and manage application state via `st.session_state` when replacing `streamlit-faker` calls with actual Streamlit API calls.","message":"When migrating from faked UI to real Streamlit components, ensure proper handling of widget keys (`key` parameter) and `st.session_state` to prevent unexpected behavior. The faked commands automatically handle some aspects, which need manual attention in real code.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to v0.0.4 or later. Ensure your application does not directly or indirectly depend on `streamlit-extras` features that might have been implicitly provided by older `streamlit-faker` versions.","message":"Prior to v0.0.4, the library internally relied on `streamlit-extras`. This dependency was replaced with `altex`. While this was primarily an internal change, users relying on any indirectly exposed `streamlit-extras` functionality might need to adjust their assumptions about underlying components.","severity":"deprecated","affected_versions":"<0.0.4"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install streamlit-faker` to install the library.","cause":"The `streamlit-faker` package is not installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'streamlit_faker'"},{"fix":"Verify the Streamlit command name against the official Streamlit documentation. `streamlit-faker` aims to support common Streamlit commands but might not cover all edge cases or newly introduced APIs immediately.","cause":"Attempting to call a Streamlit command that does not exist or is not supported by the `streamlit-faker` wrapper.","error":"AttributeError: 'StreamlitFaker' object has no attribute 'non_existent_command'"}]}