Skip to content

Enable Burr UI to be added to existing FastAPI app#671

Open
Smitaambiger wants to merge 2 commits intoapache:mainfrom
Smitaambiger:feature/burr-ui-mount
Open

Enable Burr UI to be added to existing FastAPI app#671
Smitaambiger wants to merge 2 commits intoapache:mainfrom
Smitaambiger:feature/burr-ui-mount

Conversation

@Smitaambiger
Copy link
Contributor

This PR adds a reusable FastAPI factory and helper function to allow the Burr UI
to be mounted inside an existing FastAPI application.

Changes:

  • Added create_burr_ui_app() factory to construct the Burr UI FastAPI app.
  • Added mount_burr_ui(parent_app, path="/burr") helper to mount the UI as a sub-application.
  • Preserved existing behaviour with app = create_burr_ui_app().

This enables users to run Burr tracking UI alongside their own FastAPI services
in the same application.

Closes #503

Mount the Burr UI inside another FastAPI app.
"""
ui_app = create_burr_ui_app()
parent_app.mount(path, ui_app, name="burr-ui")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's expose name as a parameter


def mount_burr_ui(parent_app: FastAPI, path: str = "/burr") -> None:
"""
Mount the Burr UI inside another FastAPI app.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc string for parameters

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and example code on how to mount it from some other code.

Also can you add and example to /examples and docs to docs/ for this new feature you're adding so that it's documented on how to use it? The example will show folks and prove out that this works.

@Smitaambiger
Copy link
Contributor Author

@skrawcz,Thanks for the feedback! I've updated the PR to:

• expose the name parameter in mount_burr_ui
• add parameter docstrings and an example in the function docstring
• add a working example under /examples
• add documentation under docs/concepts/tracking.rst

Let me know if any further adjustments are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable Burr UI to be added to existing FastAPI app

2 participants