atsphinx.toybox.stlite

Note

Added by v2024.12.1

Overview

This it to embed Stlite content into your documents.

Usage

Enable extension

Add this into your conf.py of Sphinx.

conf.py
extensions = [
    "atsphinx.toybox.stlite",
]

Configuration

stlite_version
Type: str
Default: "0.76.0"

Using Stlite version.

Demo

Source

.. stlite::
   :id: stlite-demo
   :requirements: matplotlib

   import streamlit as st
   import matplotlib.pyplot as plt
   import numpy as np

   size = st.slider("Sample size", 100, 1000)

   arr = np.random.normal(1, 1, size=size)
   fig, ax = plt.subplots()
   ax.hist(arr, bins=20)

   st.pyplot(fig)

Output

Refs