Skip to content

armgit / burr

Public Imported from GitHub
0

Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.

Adds burr-demo CLI to make getting started easier

elijahbenizzyaad536286fb3
diff --git a/burr/cli/__main__.py b/burr/cli/__main__.py
index c7344fe9..39519a27 100644
--- a/burr/cli/__main__.py
+++ b/burr/cli/__main__.py
@@ -96,12 +96,7 @@ def build_ui():
_build_ui()
[email protected]("--port", default=7241, help="Port to run the server on")
[email protected]("--dev-mode", is_flag=True, help="Run the server in development mode")
[email protected]("--no-open", is_flag=True, help="Run the server without opening it")
[email protected]("--no-copy-demo_data", is_flag=True, help="Don't copy demo data over.")
-def run_server(port: int, dev_mode: bool, no_open: bool, no_copy_demo_data: bool):
+def _run_server(port: int, dev_mode: bool, no_open: bool, no_copy_demo_data: bool, initial_page=""):
_telemetry_if_enabled("run_server")
# TODO: Implement server running logic here
# Example: Start a web server, configure ports, etc.
@@ -122,7 +117,7 @@ def run_server(port: int, dev_mode: bool, no_open: bool, no_copy_demo_data: bool
thread = threading.Thread(
target=open_when_ready,
kwargs={
- "open_url": (open_url := f"http://localhost:{port}"),
+ "open_url": (open_url := f"http://localhost:{port}/{initial_page}"),
"check_url": f"{open_url}/ready",
},
daemon=True,
@@ -131,6 +126,21 @@ def run_server(port: int, dev_mode: bool, no_open: bool, no_copy_demo_data: bool
_command(cmd, capture_output=False)
[email protected]("--port", default=7241, help="Port to run the server on")
[email protected]("--dev-mode", is_flag=True, help="Run the server in development mode")
[email protected]("--no-open", is_flag=True, help="Run the server without opening it")
[email protected]("--no-copy-demo_data", is_flag=True, help="Don't copy demo data over.")
+def run_server(port: int, dev_mode: bool, no_open: bool, no_copy_demo_data: bool):
+ _run_server(port, dev_mode, no_open, no_copy_demo_data)
+
+
[email protected]("--port", default=7241, help="Port to run the server on")
+def demo_server(port: int):
+ _run_server(port, True, False, False, "demos/chatbot")
+
+
@cli.command(help="Publishes the package to a repository")
@click.option("--prod", is_flag=True, help="Publish to pypi (rather than test pypi)")
@click.option("--no-wipe-dist", is_flag=True, help="Wipe the dist/ directory before building")
diff --git a/pyproject.toml b/pyproject.toml
index 4bb146e7..b4583c27 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -114,6 +114,7 @@ Repository = "https://github.com/dagworks-inc/burr"
[project.scripts]
burr = "burr.cli.__main__:cli_run_server"
+burr-demo = "burr.cli.__main__:cli_demo_server"
burr-admin-server = "burr.cli.__main__:cli_run_server"
burr-admin-publish = "burr.cli.__main__:cli_build_and_publish"
burr-admin-build-ui = "burr.cli.__main__:cli_build_ui"