Step 5: Put it all together

Let’s dive in on how to develop the component with the following code:

class RootFlow(LightningFlow):
    def __init__(self):
        super().__init__()
        # Create the flow
        self.flow = Flow()

    def run(self):
        # Run the flow
        self.flow.run()

    def configure_layout(self):
        # 1: Add the main StreamLit UI
        selection_tab = [{
            "name": "Run your Github Repo",
            "content": self.flow,
        }]
        # 2: Add a new tab whenever a new work is dynamically created
        run_tabs = [e.configure_layout() for e in self.flow.ws.values()]
        # 3: Returns the list of tabs.
        return selection_tab + run_tabs


app = LightningApp(RootFlow())

Run the application

Clone the Lightning repo and run the following command:

lightning run app docs/source/examples/github_repo_runner/app.py

Add --cloud to run this application in the cloud.

lightning run app docs/source/examples/github_repo_runner/app.py --cloud