Install & Compatibility
Where this runs
tested against v0.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 1.733s · 444.8MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 15.6s · import 0.966s · 414MB
433MB installed
● package 433MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
st_keyup
✓ from st_keyup import st_keyup
This example demonstrates the basic usage of `st_keyup`, including setting a default value, using the `debounce` parameter to control update frequency, and combining `max_chars`, `placeholder`, and `disabled` arguments.
import streamlit as st
from st_keyup import st_keyup
st.title("Streamlit Keyup Demo")
# Basic usage: value updates after every key press
value_basic = st_keyup("Enter text here", key="keyup_basic")
st.write(f"Basic Input: {value_basic}")
# Usage with a default value
value_with_default = st_keyup("Enter with default", value="Hello world", key="keyup_default")
st.write(f"Input with default: {value_with_default}")
# Usage with debounce to limit update frequency (e.g., update every 500ms)
value_debounced = st_keyup("Enter with debounce", debounce=500, key="keyup_debounced")
st.write(f"Debounced Input: {value_debounced}")
# Example with max_chars, placeholder, and disabled
value_complex = st_keyup(
"Limited and Placeholder",
max_chars=10,
placeholder="Max 10 chars",
disabled=False, # Use os.environ.get for dynamic disable
key="keyup_complex"
)
st.write(f"Complex Input: {value_complex}")
Debug
Known issues
gotchaThe `disabled` argument did not update dynamically in versions prior to `0.3.0`, meaning its initial state would persist even if changed programmatically. This was fixed in `v0.3.0`.fixUpgrade to `streamlit-keyup` version `0.3.0` or newer to ensure the `disabled` state updates dynamically.
affects: <0.3.0
gotchaCompatibility issues can arise with specific Streamlit versions. For example, `v0.2.4` addressed a rendering issue with Streamlit `1.32.2`.fixEnsure you are using `streamlit-keyup` `v0.2.4` or newer for compatibility with Streamlit `1.32.2` and subsequent versions. Always test component behavior after Streamlit upgrades.
affects: <0.2.4
gotchaThe `key` parameter is essential for Streamlit components to maintain their state across reruns. While `streamlit-keyup` generates a default key if none is provided, explicitly setting unique keys for each `st_keyup` instance is a best practice to prevent unexpected behavior and component state collisions.fixAlways provide a unique `key` argument for each `st_keyup` instance in your application (e.g., `key="my_unique_input_1"`).
affects: All versions
deprecatedNew arguments like `max_chars`, `type`, `placeholder`, `disabled`, `label_visibility` were introduced in `v0.2.0`, and `on_change` in `v0.1.8`. While not strictly breaking, code written for older versions will not leverage these new functionalities. Review your usage if upgrading from significantly older versions.fixUpdate your `st_keyup` calls to include the new arguments where appropriate to utilize the enhanced functionality, especially for `max_chars`, `placeholder`, and `disabled`.
affects: <0.2.0 for most, <0.1.8 for on_change
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'streamlit_keyup'
The `streamlit-keyup` package has not been installed in your Python environment or is not accessible.
fixInstall the package using pip: `pip install streamlit-keyup`
NameError: name 'st_keyup' is not defined
The `st_keyup` function was called without being properly imported from the `streamlit_keyup` library.
fixImport `st_keyup` from `streamlit_keyup` before using it: `from streamlit_keyup import st_keyup`
streamlit.errors.StreamlitAPIException: Every widget must have a unique key.
When using multiple instances of `st_keyup`, or if `st_keyup` is within a loop or conditional block, Streamlit requires a unique `key` parameter for each instance to maintain its state.
fixProvide a unique string value for the `key` parameter to each `st_keyup` call: `st_keyup('Enter text', key='my_unique_key')` TypeError: expected string or bytes-like object
The `value` parameter for `st_keyup` expects a string, but a non-string type (e.g., integer, float, list) was provided as its initial value.
fixEnsure the value passed to the `value` parameter is always a string: `st_keyup('Enter text', value=str(my_numeric_variable))` Upgrade
Version history
0.3.0latest on PyPI · released Jan 2, 2025
Audit
Dependencies
streamlitrequiredstreamlit-keyup is a custom component built for Streamlit applications.