ExecBox - Execute Python code from inside your Streamlit apps!
Execbox is basically a text editor plus exec().
Installation
First install Streamlit (of course!) then pip-install this library:
pip install streamlit
pip install st-execbox
Example usage
import streamlit as st
from st_execbox import execbox
# Draw a text editor and a "Run" button. When you press "Run", the code in the editor executes!
execbox()
# Makes the code run automatically on each keystroke.
execbox(autorun=False)
# Draw an execbox with some initial text.
execbox("""
a = 10
b = 20
st.write(a + b)
""")
Parameters
The execbox() function accepts any of the following arguments:
-
body (str. default: '')
The initial code to show in the execbox.
-
button_label (str. default: 'Run')
The label to use for the "Run" button.
-
autorun (bool. default: False)
Whether the code should execute with each keystroke.
-
height (int or None. default: None)
The height of the execbox, in pixels. If
None, calculates the height smartly to fill the content and a couple more lines. -
line_numbers (bool. default: False)
Whether to show line numbers.
-
key (str or None. default: None)
An optional string to use as the unique key for the widget. If this is omitted, a key will be generated for the widget based on its content. Multiple widgets of the same type may not share the same key.
To-do
Just one to-do:
- Write tests! Contributions accepted :wink:
Metadata
Release files for st-execbox 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| st-execbox-1.0.0.tar.gz | 3.1 kB | Without provenance | Details for st-execbox-1.0.0.tar.gz |
Release files / st-execbox-1.0.0.tar.gz
| Download URL | st-execbox-1.0.0.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3510038e82019391d5f0f3ae752f43e2f4768a7c2f56087b82bba94a9fa48e79
|
|
BLAKE2b-256 checksum How to use checksums |
ca3402c1540badd23c2d453ee280e1f478949ff1873b9ea5acdab5dff184ab93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5
|
Security for st-execbox 1.0.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.