Registry / web-framework / streamlit-embedcode

streamlit-embedcode

JSON →
library0.1.2pypypi✓ verified 35d ago

streamlit-embedcode is a Streamlit custom component that simplifies embedding code snippets from various popular services, including GitHub Gist, GitLab Snippets, Pastebin, CodePen, Ideone, and TagMyCode, directly into Streamlit applications. The library is currently at version 0.1.2. It has an infrequent release cadence, with the last update in May 2021, suggesting a stable and mature, albeit not actively feature-developed, component.

web-framework
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

The functions for each service are directly importable from the top-level package.

from streamlit_embedcode import github_gist

Similar import pattern for other services like `codepen`, `pastebin`, etc.

from streamlit_embedcode import gitlab_snippet

This quickstart demonstrates how to embed a GitHub Gist into a Streamlit application using the `github_gist` function. The example also shows how to set optional parameters for the embedded content.

import streamlit as st from streamlit_embedcode import github_gist st.set_page_config(layout='wide', page_title='Streamlit EmbedCode Example') st.title('Streamlit EmbedCode Example') st.write( 'This app demonstrates embedding various code snippets using `streamlit-embedcode`.' ) # Example GitHub Gist st.subheader('GitHub Gist Example') github_gist('https://gist.github.com/randyzwitch/be8c5e9fb5b8e7b046afebcac12e5087/') st.caption('Optionally, you can provide arguments for height, width, and scrolling.') st.code(""" import streamlit as st from streamlit_embedcode import github_gist st.title('My App') github_gist('https://gist.github.com/randyzwitch/be8c5e9fb5b8e7b046afebcac12e5087/') """)
Debug
Known footguns
gotchaEmbedded content (iframes) can be affected by browser security settings, particularly third-party cookie blocking. Users with strict browser settings may see blank spaces instead of the embedded code.
gotchaThe component relies on external code-sharing services. If a service (e.g., GitHub Gist, CodePen) changes its embedding policy, API, or experiences downtime, the corresponding `streamlit-embedcode` function might stop working or display incorrectly.
gotchaStreamlit's execution model reruns the entire script from top to bottom on every user interaction. If the URLs or parameters passed to `streamlit-embedcode` functions are derived from interactive widgets, ensure proper state management (e.g., using `st.session_state`) to prevent unintended resets or content flickering.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources