Streamlit Canary
Streamlit-flavored components with an event-driven (no-rerun) runtime.
The app function runs once to build a persistent component tree. Later interactions run only the handlers registered on signals, and the browser patches the DOM in place. There is no page reload and no script re-run.
Highlights
- Performant by design. The app function runs once. An interaction executes only the handlers attached to it, then patches the DOM. The script never re-runs.
- Reactive, polished event-driven syntax.
sc.bindandsc.bbindbuild derived and two-way values,on_changeand component signals attach handlers, and a forced notification (set(value, notify=True)) refreshes output when the value itself did not change. - Desktop windows.
sc.run(..., show_window=True)serves the app and opens it in a nativepyapp-windowwindow, sized in CSS pixels. - Custom components included. Folder trees,
PathInputBrowse, a PDF viewer, a live log panel, animated toasts, and the rest of the library ship with the package. dunder_literal.PageConfig(dunder_literal=True)keeps names such as__init__and__name__from turning into bold text.- Fewer dependencies. The core runs without Streamlit, pandas,
NumPy, SciPy, pyarrow, or Altair. Altair is needed only if you use
AltairChart.
Install
pip install streamlit-canary
Python 3.11 or newer is required.
Quick start
import streamlit_canary as sc
class State(sc.State):
count = sc.Property(0)
state = State()
def app():
sc.PageTitle('Click Counter')
with sc.Row('center'):
with sc.Text('Click count: 0') as txt:
@state.count.on_change.partial(sc._self)
def _(cnt):
txt.text.set('Click count: {}'.format(cnt.get()))
with sc.Button('Increase counter', type='primary') as btn:
@btn.on_click
def _():
state['count'] += 1
if __name__ == '__main__':
sc.run(app, port=2201)
Save it as app.py, run python app.py, and open
http://localhost:2201. Clicking the button updates the text in place;
app() is not called again.
Native window
sc.run(
app,
show_window=True,
window_size=(980, 760),
window_title='My App',
)
window_size is the page viewport in CSS pixels, so the layout receives
exactly the size requested, independent of the display scale factor.
'maximized' and 'fullscreen' are also accepted.
Examples
examples/click_counter.py— the minimal event-driven app.examples/bind_multi_source.py— single-source and multi-sourcesc.bind, plus batched updates withsc.pending_updates().examples/tree_select_multicross.py— folder trees with single, multiple, and cross-folder selection.
Run any of them directly:
python examples/click_counter.py
Documentation
The full user manual lives in
docs/user-manual/src/index.md.
To preview it locally:
cd docs/user-manual
mdbook serve
Metadata
Release files for streamlit-canary 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| streamlit_canary-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / streamlit_canary-0.5.0-py3-none-any.whl
| Download URL | streamlit_canary-0.5.0-py3-none-any.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20edbac3b2b765dd7310ac2e45792433f2e9828657823a194f388eaad58ec2c3
|
|
BLAKE2b-256 checksum How to use checksums |
46f32b797263875885ece241d0aa7b266494c9220f52de6de87c341bc8c9da5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for streamlit-canary 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.