create-browser-app 0.1.1__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,27 @@
1
+ Metadata-Version: 2.4
2
+ Name: create-browser-app
3
+ Version: 0.1.3
4
+ Summary: Start your Stagehand project with a single command
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: stagehand
8
+ Requires-Dist: click>=8.0
9
+ Requires-Dist: rich>=13.0
10
+ Requires-Dist: inquirer>=3.0
11
+
12
+ # create-browser-app (Python)
13
+
14
+ The fastest way to start building with Stagehand, the AI-powered browser automation framework.
15
+
16
+ ## Quick Start
17
+
18
+ ```bash
19
+ uvx create-browser-app
20
+ ```
21
+
22
+ ## What You Get
23
+
24
+ - Pre-configured Stagehand project
25
+ - Environment setup for Browserbase
26
+ - Ready-to-run example code
27
+ - All dependencies included
@@ -0,0 +1,16 @@
1
+ # create-browser-app (Python)
2
+
3
+ The fastest way to start building with Stagehand, the AI-powered browser automation framework.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ uvx create-browser-app
9
+ ```
10
+
11
+ ## What You Get
12
+
13
+ - Pre-configured Stagehand project
14
+ - Environment setup for Browserbase
15
+ - Ready-to-run example code
16
+ - All dependencies included
@@ -0,0 +1,27 @@
1
+ Metadata-Version: 2.4
2
+ Name: create-browser-app
3
+ Version: 0.1.3
4
+ Summary: Start your Stagehand project with a single command
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: stagehand
8
+ Requires-Dist: click>=8.0
9
+ Requires-Dist: rich>=13.0
10
+ Requires-Dist: inquirer>=3.0
11
+
12
+ # create-browser-app (Python)
13
+
14
+ The fastest way to start building with Stagehand, the AI-powered browser automation framework.
15
+
16
+ ## Quick Start
17
+
18
+ ```bash
19
+ uvx create-browser-app
20
+ ```
21
+
22
+ ## What You Get
23
+
24
+ - Pre-configured Stagehand project
25
+ - Environment setup for Browserbase
26
+ - Ready-to-run example code
27
+ - All dependencies included
@@ -9,112 +9,14 @@ from rich.prompt import Prompt, Confirm
9
9
  from rich.panel import Panel
10
10
  from rich.text import Text
11
11
  import shutil
12
+ from templates import TEMPLATE_BASIC, TEMPLATE_REQUIREMENTS, TEMPLATE_ENV, TEMPLATE_README, TEMPLATE_GITIGNORE
13
+ from template_fetcher import get_template_by_name, fetch_template_content
12
14
 
13
15
  console = Console()
14
16
 
15
- TEMPLATE_BASIC = '''from stagehand import Stagehand
16
- import asyncio
17
-
18
- async def main():
19
- """Basic Stagehand browser automation example."""
20
- async with Stagehand() as stagehand:
21
- page = stagehand.page
22
-
23
- # Navigate to a website
24
- await page.goto("https://example.com")
25
-
26
- # Your automation code here
27
- print(f"Page title: {await page.title()}")
28
-
29
- if __name__ == "__main__":
30
- asyncio.run(main())
31
- '''
32
-
33
- TEMPLATE_REQUIREMENTS = '''stagehand
34
- python-dotenv
35
- '''
36
-
37
- TEMPLATE_ENV = '''# Add your environment variables here
38
- # BROWSERBASE_API_KEY=your_api_key_here
39
- # BROWSERBASE_PROJECT_ID=your_project_id_here
40
- '''
41
-
42
- TEMPLATE_README = '''# {project_name}
43
-
44
- A Stagehand browser automation project.
45
-
46
- ## Setup
47
-
48
- 1. Install dependencies:
49
- ```bash
50
- pip install -r requirements.txt
51
- ```
52
-
53
- 2. Configure your environment variables in `.env`:
54
- ```bash
55
- BROWSERBASE_API_KEY=your_api_key_here
56
- BROWSERBASE_PROJECT_ID=your_project_id_here
57
- ```
58
-
59
- 3. Run the project:
60
- ```bash
61
- python main.py
62
- ```
63
-
64
- ## About Stagehand
65
-
66
- Stagehand is a Python library for browser automation built on Playwright. Learn more at:
67
- - [Stagehand Documentation](https://github.com/browserbase/stagehand)
68
- - [Browserbase](https://browserbase.com)
69
- '''
70
-
71
- TEMPLATE_GITIGNORE = '''# Python
72
- __pycache__/
73
- *.py[cod]
74
- *$py.class
75
- *.so
76
- .Python
77
- build/
78
- develop-eggs/
79
- dist/
80
- downloads/
81
- eggs/
82
- .eggs/
83
- lib/
84
- lib64/
85
- parts/
86
- sdist/
87
- var/
88
- wheels/
89
- *.egg-info/
90
- .installed.cfg
91
- *.egg
92
-
93
- # Virtual Environment
94
- venv/
95
- ENV/
96
- env/
97
- .venv
98
-
99
- # Environment variables
100
- .env
101
- .env.local
102
-
103
- # IDE
104
- .vscode/
105
- .idea/
106
- *.swp
107
- *.swo
108
- *~
109
- .DS_Store
110
-
111
- # Logs
112
- *.log
113
- '''
114
-
115
17
  @click.command()
116
18
  @click.argument('name', default='my-stagehand-app', required=False)
117
- @click.option('--template', '-t', default='basic', help='Template to get started with')
19
+ @click.option('--template', '-t', default='basic', help='Template to use (basic or GitHub examples: quickstart, example, agent-example)')
118
20
  def main(name, template):
119
21
  """Start your Stagehand project with a single command"""
120
22
 
@@ -152,9 +54,26 @@ def main(name, template):
152
54
  # Create directories
153
55
  project_path.mkdir(parents=True, exist_ok=True)
154
56
 
57
+ # Determine which template to use
58
+ template_content = TEMPLATE_BASIC
59
+
60
+ # If not using basic template, try to fetch from GitHub
61
+ if template != 'basic':
62
+ console.print(f"Fetching template [cyan]{template}[/cyan] from GitHub...")
63
+ template_info = get_template_by_name(template)
64
+ if template_info:
65
+ fetched_content = fetch_template_content(template_info)
66
+ if fetched_content:
67
+ template_content = fetched_content
68
+ console.print(f"[green]✓[/green] Using template from GitHub: {template}")
69
+ else:
70
+ console.print(f"[yellow]⚠[/yellow] Could not fetch template, using basic template")
71
+ else:
72
+ console.print(f"[yellow]⚠[/yellow] Template '{template}' not found, using basic template")
73
+
155
74
  # Create main.py
156
75
  main_file = project_path / "main.py"
157
- main_file.write_text(TEMPLATE_BASIC)
76
+ main_file.write_text(template_content)
158
77
 
159
78
  # Create requirements.txt
160
79
  requirements_file = project_path / "requirements.txt"
@@ -178,10 +97,9 @@ def main(name, template):
178
97
  # Styled next steps
179
98
  console.print(Panel(
180
99
  f"[bold cyan]1.[/bold cyan] cd {project_dir}\n"
181
- f"[bold cyan]2.[/bold cyan] pip install -r requirements.txt\n"
182
- f"[bold cyan]3.[/bold cyan] cp .env.example .env\n"
183
- f"[bold cyan]4.[/bold cyan] [dim]Add your Browserbase API key to .env[/dim]\n"
184
- f"[bold cyan]5.[/bold cyan] python main.py",
100
+ f"[bold cyan]2.[/bold cyan] cp .env.example .env\n"
101
+ f"[bold cyan]3.[/bold cyan] [dim]Add your Browserbase API key to .env[/dim]\n"
102
+ f"[bold cyan]4.[/bold cyan] python main.py",
185
103
  title="[bold yellow]🚀 Launch now 🚀[/bold yellow]",
186
104
  border_style="yellow",
187
105
  padding=(1, 2)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "create-browser-app"
3
- version = "0.1.1"
3
+ version = "0.1.3"
4
4
  description = "Start your Stagehand project with a single command"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -1,10 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: create-browser-app
3
- Version: 0.1.1
4
- Summary: Start your Stagehand project with a single command
5
- Requires-Python: >=3.10
6
- Description-Content-Type: text/markdown
7
- Requires-Dist: stagehand
8
- Requires-Dist: click>=8.0
9
- Requires-Dist: rich>=13.0
10
- Requires-Dist: inquirer>=3.0
File without changes
@@ -1,10 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: create-browser-app
3
- Version: 0.1.1
4
- Summary: Start your Stagehand project with a single command
5
- Requires-Python: >=3.10
6
- Description-Content-Type: text/markdown
7
- Requires-Dist: stagehand
8
- Requires-Dist: click>=8.0
9
- Requires-Dist: rich>=13.0
10
- Requires-Dist: inquirer>=3.0