Cheat sheet
Toutes les fonctions BPM en un coup d'œil. Copier-collable directement dans un script.
import bpm
# Texte
bpm.title("Mon titre")
bpm.header("Section")
bpm.subheader("Sous-section")
bpm.markdown("Du **markdown**")
bpm.write("Texte ou objet Python")
bpm.caption("Légende")
bpm.code("snippet", language="python")
bpm.latex(r"e^{i\\pi}+1=0")
bpm.badge("Nouveau", type="info")
bpm.html("<p>HTML brut</p>")
# Données
bpm.metric("Valeur", 142500, delta=3200)
bpm.dataframe(df)
bpm.table(df)
bpm.json({"a": 1})
# Layout
col1, col2 = bpm.columns(2)
tab1, tab2 = bpm.tabs(["Onglet 1", "Onglet 2"])
with bpm.sidebar:
bpm.select("Page", ["Accueil", "Données"])
with bpm.expander("Voir plus"):
bpm.write("Contenu")
with bpm.form("f"):
bpm.input("Nom")
bpm.form_submit_button("Envoyer")
bpm.space()
# Inputs
bpm.button("Cliquer")
bpm.toggle("Activer")
bpm.checkbox("Cocher")
bpm.radio("Choix", ["A", "B"])
bpm.select("Option", ["A", "B", "C"])
bpm.multiselect("Plusieurs", ["A", "B", "C"])
bpm.slider("Valeur", 0, 100, 50)
bpm.input("Texte")
bpm.number_input("Nombre", 0, 100, 10)
bpm.textarea("Paragraphe")
bpm.date_input("Date")
bpm.time_input("Heure")
bpm.datetime_input("Date et heure")
bpm.file_uploader("Fichier")
bpm.download_button("Télécharger", data=bytes(), file_name="out.csv")
bpm.color_picker("Couleur")
# Charts
bpm.chart.line(df)
bpm.chart.bar(df)
bpm.chart.area(df)
bpm.chart.scatter(df)
bpm.chart.map(df)
bpm.chart.plotly(fig)
bpm.chart.altair(chart)
bpm.chart.pyplot(fig)
# Panels
bpm.panel("Info importante", variant="info")
bpm.panel("Attention", variant="warning")
bpm.panel("Erreur", variant="error")
bpm.panel("Succès", variant="success")
# Médias
bpm.image(url_or_path, caption="Légende")
bpm.audio(src)
bpm.video(src)
bpm.pdf(src)
bpm.logo()
# Status
with bpm.spinner("Chargement..."):
time.sleep(2)
bpm.progress(0.75, text="75 %")
bpm.toast("Terminé !")
bpm.balloons()
bpm.snow()
with bpm.status("Traitement"):
bpm.write("Étape 1...")
bpm.exception(e)
# Chat
with bpm.chat.message("user"):
bpm.write("Message")
with bpm.chat.message("assistant"):
bpm.write("Réponse")
bpm.chat.input("Placeholder")
bpm.write_stream(generator)
# Config & perf
bpm.set_page_config(page_title="App", layout="wide")
bpm.theme(primary_color="#d4af37")
@bpm.cache_data
def load(): return pd.read_csv("data.csv")
@bpm.cache_resource
def model(): return load_model()
bpm.rerun()
bpm.stop()
bpm.switch_page("other")
bpm.query_params["key"] = "value"
Groupé par catégorie : Texte, Données, Layout, Inputs, Charts, Panels, Médias, Status, Chat, Config.