Clipboard Copy Utilities for Streamlit
This Python package provides easy-to-use functions to copy text to the clipboard within Streamlit applications, supporting both HTTP and HTTPS contexts.
Key Features
-
Works seamlessly on both HTTP and HTTPS:
Supports the modern, secure Clipboard API (navigator.clipboard.writeText) used in HTTPS environments,
and falls back to the legacydocument.execCommand('copy')method for HTTP or older browsers. -
No dependency on UI elements:
Clipboard copy commands can be triggered programmatically anywhere in your Streamlit app
without requiring explicit user interaction with buttons, making integration flexible and convenient. -
Fully compatible with Streamlit's iframe-based rendering:
1% UI footprint — runs almost invisibly without affecting layout.
Why Use This Package?
Streamlit apps run inside iframes and are often served over HTTPS, which imposes strict browser security policies on clipboard access.
This package provides a reliable way to copy text to the clipboard regardless of the protocol or browser limitations by using both secure and fallback methods.
Installation
pip install st-clipboard
Usage Example
Here is an example Streamlit app showing two columns with text inputs and buttons — one using the secure clipboard copy (for HTTPS), and the other using the unsecured fallback (for HTTP):
import streamlit as st
from st_clipboard import copy_to_clipboard, copy_to_clipboard_unsecured
# Create two columns: HTTPS (left), HTTP (right)
col_https, col_http = st.columns(2)
with col_https:
st.markdown("### HTTPS Clipboard Copy")
https_text = st.text_input("Enter text to copy (HTTPS):", value="Hello HTTPS")
if st.button("Copy to clipboard (HTTPS)"):
copy_to_clipboard(https_text)
st.success("Copied to clipboard using secure method!")
with col_http:
st.markdown("### HTTP Clipboard Copy")
http_text = st.text_input("Enter text to copy (HTTP):", value="Hello HTTP")
if st.button("Copy to clipboard (HTTP)"):
copy_to_clipboard_unsecured(http_text)
st.success("Copied to clipboard using unsecured method!")
Metadata
Release files for st-clipboard 0.0.1
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 | |
|---|---|---|---|---|
| st_clipboard-0.0.1.tar.gz | 4.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| st_clipboard-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.3 kB
Release files / st_clipboard-0.0.1.tar.gz
| Download URL | st_clipboard-0.0.1.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5537bf869f37230a6142290497f3fc98de8181f3f1746e2aefaaf4d75ee103e0
|
|
BLAKE2b-256 checksum How to use checksums |
20748a7cb27056cca5a5264f705eb077106e0ed3ed530f600da536619c9915f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Release files / st_clipboard-0.0.1-py3-none-any.whl
| Download URL | st_clipboard-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8efcec6628cd4f8dd13b4cf9d850d1032d81f5a46cfdcfa2463f14d8c8b9e90
|
|
BLAKE2b-256 checksum How to use checksums |
ba770a9008e9f3ded535dcd22326346033e09e9206e2dba3a3cd0fbc2c78a82b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Security for st-clipboard 0.0.1
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.