Retrieving code executed by Streamlit

Is there a way to see the actual code that was executed with a call to streamlit run Ideally, I’m looking for a history of contents each time it was called by streamlit run. Does Streamlit log anything like this?

Hi @Ronn_Shaw,

That’s an interesting question. Streamlit doesn’t currently create logging to that degree, but I suppose that’s a feature that could be built.

One thing you could do is use the python debugger. For example:

import streamlit as st
import pandas as pd

import trace
import sys

def main():
    points=pd.DataFrame([[50,0.01],[51,0.1],[51.05,1.05]], columns = ["lat","lon"])

# create a Trace object, telling it what to ignore, and whether to
# do tracing or line-counting or both.
tracer = trace.Trace(
    ignoredirs=[sys.prefix, sys.exec_prefix],

# run the new command using the given tracer'main()')

# make a report, placing output in the current directory
r = tracer.results()
r.write_results(show_missing=True, coverdir=".")

In the output of the above you’ll see lines like this:     points=pd.DataFrame([[50,0.01],[51,0.1],[51.05,1.05]], columns = ["lat","lon"])

With the sample code I posted, it will also show calls to the streamlit module. I believe there’s a way you can configure the tracer to filter out lines from modules you don’t want to see. Let me know if you figure it out. :slight_smile:

Thanks for the question!