From ce939ccf63612c20abc15ddbd1b490cce62d4905 Mon Sep 17 00:00:00 2001 From: Filip Michalsky Date: Wed, 9 Jul 2025 18:25:58 +0200 Subject: [PATCH 1/5] loosen rich dep and update example render --- examples/agent_example.py | 12 +++++++++++- examples/example.py | 23 +++++++++++++++++++++-- pyproject.toml | 4 ++-- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/examples/agent_example.py b/examples/agent_example.py index c9f0a24..64a9837 100644 --- a/examples/agent_example.py +++ b/examples/agent_example.py @@ -9,6 +9,16 @@ from stagehand import Stagehand, StagehandConfig, configure_logging +# Compatibility function for Panel.fit (available in Rich >= 14.0.0) +def create_panel(content, **kwargs): + """Create a panel with fallback for older Rich versions.""" + try: + # Try to use Panel.fit if available + return Panel.fit(content, **kwargs) + except AttributeError: + # Fallback to regular Panel for older Rich versions + return Panel(content, **kwargs) + # Create a custom theme for consistent styling custom_theme = Theme( { @@ -100,7 +110,7 @@ async def main(): # Add a fancy header console.print( "\n", - Panel.fit( + create_panel( "[light_gray]Stagehand 🤘 Agent Example[/]", border_style="green", padding=(1, 10), diff --git a/examples/example.py b/examples/example.py index c006792..de6952c 100644 --- a/examples/example.py +++ b/examples/example.py @@ -10,6 +10,16 @@ from stagehand import Stagehand, StagehandConfig from stagehand.utils import configure_logging +# Compatibility function for Panel.fit (available in Rich >= 14.0.0) +def create_panel(content, **kwargs): + """Create a panel with fallback for older Rich versions.""" + try: + # Try to use Panel.fit if available + return Panel.fit(content, **kwargs) + except AttributeError: + # Fallback to regular Panel for older Rich versions + return Panel(content, **kwargs) + # Configure logging with cleaner format configure_logging( level=logging.INFO, @@ -35,7 +45,16 @@ load_dotenv() console.print( - Panel.fit( + create_panel( + "[yellow]Stagehand Python SDK Example[/]\n" + "[white]This example demonstrates basic Stagehand functionality.[/]", + title="Welcome", + border_style="blue", + ) +) + +console.print( + create_panel( "[yellow]Logging Levels:[/]\n" "[white]- Set [bold]verbose=0[/] for errors (ERROR)[/]\n" "[white]- Set [bold]verbose=1[/] for minimal logs (INFO)[/]\n" @@ -127,7 +146,7 @@ async def main(): # Add a fancy header console.print( "\n", - Panel.fit( + create_panel( "[light_gray]Stagehand 🤘 Python Example[/]", border_style="green", padding=(1, 10), diff --git a/pyproject.toml b/pyproject.toml index 0da4a48..e2bd898 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta" [project] name = "stagehand" -version = "0.4.0" +version = "0.4.1" description = "Python SDK for Stagehand" readme = "README.md" classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent",] requires-python = ">=3.9" -dependencies = [ "httpx>=0.24.0", "python-dotenv>=1.0.0", "pydantic>=1.10.0", "playwright>=1.42.1", "requests>=2.31.0", "browserbase>=1.4.0", "rich>=14.0.0", "openai>=1.83.0", "anthropic>=0.51.0", "litellm>=1.72.0",] +dependencies = [ "httpx>=0.24.0", "python-dotenv>=1.0.0", "pydantic>=1.10.0", "playwright>=1.42.1", "requests>=2.31.0", "browserbase>=1.4.0", "rich>=13.7.0", "openai>=1.83.0", "anthropic>=0.51.0", "litellm>=1.72.0",] [[project.authors]] name = "Browserbase, Inc." email = "support@browserbase.com" From 680818d3064a4270a6ba189091d37c47c9d5bc48 Mon Sep 17 00:00:00 2001 From: Filip Michalsky Date: Wed, 9 Jul 2025 18:46:52 +0200 Subject: [PATCH 2/5] example run fix by moving configure_logging --- examples/example.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/example.py b/examples/example.py index de6952c..dbf225c 100644 --- a/examples/example.py +++ b/examples/example.py @@ -7,8 +7,7 @@ from rich.panel import Panel from rich.theme import Theme -from stagehand import Stagehand, StagehandConfig -from stagehand.utils import configure_logging +from stagehand import Stagehand, StagehandConfig, configure_logging # Compatibility function for Panel.fit (available in Rich >= 14.0.0) def create_panel(content, **kwargs): From 121af77dfd9aaa772fbcc24d4233772c16c5e801 Mon Sep 17 00:00:00 2001 From: Filip Michalsky Date: Wed, 9 Jul 2025 21:11:46 +0200 Subject: [PATCH 3/5] revert version bump --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e2bd898..fe7b7f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "stagehand" -version = "0.4.1" +version = "0.4.0" description = "Python SDK for Stagehand" readme = "README.md" classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent",] From cccbbcdb54d8bd18cbc2d584be482d9bc22187f5 Mon Sep 17 00:00:00 2001 From: Filip Michalsky Date: Sun, 13 Jul 2025 18:25:20 -0400 Subject: [PATCH 4/5] remove panel function --- examples/agent_example.py | 12 +----------- examples/example.py | 16 +++------------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/examples/agent_example.py b/examples/agent_example.py index 64a9837..9d7e9b7 100644 --- a/examples/agent_example.py +++ b/examples/agent_example.py @@ -9,16 +9,6 @@ from stagehand import Stagehand, StagehandConfig, configure_logging -# Compatibility function for Panel.fit (available in Rich >= 14.0.0) -def create_panel(content, **kwargs): - """Create a panel with fallback for older Rich versions.""" - try: - # Try to use Panel.fit if available - return Panel.fit(content, **kwargs) - except AttributeError: - # Fallback to regular Panel for older Rich versions - return Panel(content, **kwargs) - # Create a custom theme for consistent styling custom_theme = Theme( { @@ -110,7 +100,7 @@ async def main(): # Add a fancy header console.print( "\n", - create_panel( + Panel( "[light_gray]Stagehand 🤘 Agent Example[/]", border_style="green", padding=(1, 10), diff --git a/examples/example.py b/examples/example.py index dbf225c..7a4a232 100644 --- a/examples/example.py +++ b/examples/example.py @@ -9,16 +9,6 @@ from stagehand import Stagehand, StagehandConfig, configure_logging -# Compatibility function for Panel.fit (available in Rich >= 14.0.0) -def create_panel(content, **kwargs): - """Create a panel with fallback for older Rich versions.""" - try: - # Try to use Panel.fit if available - return Panel.fit(content, **kwargs) - except AttributeError: - # Fallback to regular Panel for older Rich versions - return Panel(content, **kwargs) - # Configure logging with cleaner format configure_logging( level=logging.INFO, @@ -44,7 +34,7 @@ def create_panel(content, **kwargs): load_dotenv() console.print( - create_panel( + Panel( "[yellow]Stagehand Python SDK Example[/]\n" "[white]This example demonstrates basic Stagehand functionality.[/]", title="Welcome", @@ -53,7 +43,7 @@ def create_panel(content, **kwargs): ) console.print( - create_panel( + Panel( "[yellow]Logging Levels:[/]\n" "[white]- Set [bold]verbose=0[/] for errors (ERROR)[/]\n" "[white]- Set [bold]verbose=1[/] for minimal logs (INFO)[/]\n" @@ -145,7 +135,7 @@ async def main(): # Add a fancy header console.print( "\n", - create_panel( + Panel( "[light_gray]Stagehand 🤘 Python Example[/]", border_style="green", padding=(1, 10), From e4ec9b000648d1aa8067763e66c4f55f40c8e547 Mon Sep 17 00:00:00 2001 From: Filip Michalsky Date: Sun, 13 Jul 2025 18:30:51 -0400 Subject: [PATCH 5/5] update --- examples/example.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/examples/example.py b/examples/example.py index 7a4a232..5f86ef5 100644 --- a/examples/example.py +++ b/examples/example.py @@ -33,15 +33,6 @@ load_dotenv() -console.print( - Panel( - "[yellow]Stagehand Python SDK Example[/]\n" - "[white]This example demonstrates basic Stagehand functionality.[/]", - title="Welcome", - border_style="blue", - ) -) - console.print( Panel( "[yellow]Logging Levels:[/]\n"