create-browser-app 0.1.0__tar.gz → 0.1.1__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.
- create_browser_app-0.1.1/PKG-INFO +10 -0
- create_browser_app-0.1.1/create_browser_app.egg-info/PKG-INFO +10 -0
- {create_browser_app-0.1.0 → create_browser_app-0.1.1}/create_browser_app.egg-info/SOURCES.txt +1 -0
- create_browser_app-0.1.1/create_browser_app.egg-info/entry_points.txt +2 -0
- create_browser_app-0.1.1/create_browser_app.egg-info/requires.txt +4 -0
- create_browser_app-0.1.1/main.py +195 -0
- create_browser_app-0.1.1/pyproject.toml +15 -0
- create_browser_app-0.1.0/PKG-INFO +0 -7
- create_browser_app-0.1.0/create_browser_app.egg-info/PKG-INFO +0 -7
- create_browser_app-0.1.0/create_browser_app.egg-info/requires.txt +0 -1
- create_browser_app-0.1.0/main.py +0 -6
- create_browser_app-0.1.0/pyproject.toml +0 -7
- {create_browser_app-0.1.0 → create_browser_app-0.1.1}/README.md +0 -0
- {create_browser_app-0.1.0 → create_browser_app-0.1.1}/create_browser_app.egg-info/dependency_links.txt +0 -0
- {create_browser_app-0.1.0 → create_browser_app-0.1.1}/create_browser_app.egg-info/top_level.txt +0 -0
- {create_browser_app-0.1.0 → create_browser_app-0.1.1}/setup.cfg +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
{create_browser_app-0.1.0 → create_browser_app-0.1.1}/create_browser_app.egg-info/SOURCES.txt
RENAMED
|
@@ -4,5 +4,6 @@ pyproject.toml
|
|
|
4
4
|
create_browser_app.egg-info/PKG-INFO
|
|
5
5
|
create_browser_app.egg-info/SOURCES.txt
|
|
6
6
|
create_browser_app.egg-info/dependency_links.txt
|
|
7
|
+
create_browser_app.egg-info/entry_points.txt
|
|
7
8
|
create_browser_app.egg-info/requires.txt
|
|
8
9
|
create_browser_app.egg-info/top_level.txt
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
import subprocess
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import click
|
|
7
|
+
from rich.console import Console
|
|
8
|
+
from rich.prompt import Prompt, Confirm
|
|
9
|
+
from rich.panel import Panel
|
|
10
|
+
from rich.text import Text
|
|
11
|
+
import shutil
|
|
12
|
+
|
|
13
|
+
console = Console()
|
|
14
|
+
|
|
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
|
+
@click.command()
|
|
116
|
+
@click.argument('name', default='my-stagehand-app', required=False)
|
|
117
|
+
@click.option('--template', '-t', default='basic', help='Template to get started with')
|
|
118
|
+
def main(name, template):
|
|
119
|
+
"""Start your Stagehand project with a single command"""
|
|
120
|
+
|
|
121
|
+
console.print("""[yellow]
|
|
122
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
123
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡾⠻⣶⡀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
124
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⢠⡶⠛⢳⡆⠀⠀⠀⠀⢸⡇⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀
|
|
125
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⢸⣷⠶⣦⣴⠶⣾⡇⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀
|
|
126
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⢸⡇⠀⢸⡇⠀⢸⡇⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀
|
|
127
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠘⠷⣤⢾⡏⠉⠉⠉⠙⣾⡇⠀⠀⠀⠀⠀⠀⠀⠀
|
|
128
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠈⣻⡿⠟⠂⠀⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀
|
|
129
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠈⣷⠀⠀⠀⠀⢰⡏⠀⠀⠀⢀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
130
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣷⡀⠀⠀⠀⠀⠀⠀⢀⡾⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
131
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠷⣦⣤⣤⣴⠾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
132
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
133
|
+
[/yellow]""")
|
|
134
|
+
console.print("[yellow]Stagehand[/yellow]")
|
|
135
|
+
console.print("[dim]The AI Browser Framework[/dim]\n")
|
|
136
|
+
|
|
137
|
+
project_name = name
|
|
138
|
+
|
|
139
|
+
# Sanitize project name for directory
|
|
140
|
+
project_dir = project_name.lower().replace(" ", "-").replace("_", "-")
|
|
141
|
+
project_path = Path.cwd() / project_dir
|
|
142
|
+
|
|
143
|
+
# Check if directory exists
|
|
144
|
+
if project_path.exists():
|
|
145
|
+
console.print(f"[red]Error: Directory '{project_dir}' already exists[/red]")
|
|
146
|
+
sys.exit(1)
|
|
147
|
+
|
|
148
|
+
# Create project structure
|
|
149
|
+
try:
|
|
150
|
+
console.print(f"Creating [bold cyan]{project_dir}[/bold cyan]...\n")
|
|
151
|
+
|
|
152
|
+
# Create directories
|
|
153
|
+
project_path.mkdir(parents=True, exist_ok=True)
|
|
154
|
+
|
|
155
|
+
# Create main.py
|
|
156
|
+
main_file = project_path / "main.py"
|
|
157
|
+
main_file.write_text(TEMPLATE_BASIC)
|
|
158
|
+
|
|
159
|
+
# Create requirements.txt
|
|
160
|
+
requirements_file = project_path / "requirements.txt"
|
|
161
|
+
requirements_file.write_text(TEMPLATE_REQUIREMENTS)
|
|
162
|
+
|
|
163
|
+
# Create .env.example
|
|
164
|
+
env_file = project_path / ".env.example"
|
|
165
|
+
env_file.write_text(TEMPLATE_ENV)
|
|
166
|
+
|
|
167
|
+
# Create README.md
|
|
168
|
+
readme_file = project_path / "README.md"
|
|
169
|
+
readme_file.write_text(TEMPLATE_README.format(project_name=project_name))
|
|
170
|
+
|
|
171
|
+
# Create .gitignore
|
|
172
|
+
gitignore_file = project_path / ".gitignore"
|
|
173
|
+
gitignore_file.write_text(TEMPLATE_GITIGNORE)
|
|
174
|
+
|
|
175
|
+
# Success message
|
|
176
|
+
console.print(f"[green]✓[/green] Find your project at [cyan]{project_path}[/cyan]\n")
|
|
177
|
+
|
|
178
|
+
# Styled next steps
|
|
179
|
+
console.print(Panel(
|
|
180
|
+
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",
|
|
185
|
+
title="[bold yellow]🚀 Launch now 🚀[/bold yellow]",
|
|
186
|
+
border_style="yellow",
|
|
187
|
+
padding=(1, 2)
|
|
188
|
+
))
|
|
189
|
+
|
|
190
|
+
except Exception as e:
|
|
191
|
+
console.print(f"[red]Error creating project: {e}[/red]")
|
|
192
|
+
sys.exit(1)
|
|
193
|
+
|
|
194
|
+
if __name__ == "__main__":
|
|
195
|
+
main()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "create-browser-app"
|
|
3
|
+
version = "0.1.1"
|
|
4
|
+
description = "Start your Stagehand project with a single command"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"stagehand",
|
|
9
|
+
"click>=8.0",
|
|
10
|
+
"rich>=13.0",
|
|
11
|
+
"inquirer>=3.0"
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[project.scripts]
|
|
15
|
+
create-browser-app = "main:main"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
stagehand
|
create_browser_app-0.1.0/main.py
DELETED
|
File without changes
|
|
File without changes
|
{create_browser_app-0.1.0 → create_browser_app-0.1.1}/create_browser_app.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|