File tree Expand file tree Collapse file tree 5 files changed +41
-6
lines changed Expand file tree Collapse file tree 5 files changed +41
-6
lines changed Original file line number Diff line number Diff line change 14
14
.envrc
15
15
codegen.log
16
16
Brewfile.lock.json
17
+ screenshot.png
Original file line number Diff line number Diff line change @@ -50,17 +50,18 @@ so that your API Key is not stored in source control.
50
50
51
51
See the [ examples] ( examples ) directory for more usage examples.
52
52
53
+ > [ !NOTE]
54
+ > Running the examples requires [ Rye] ( https://rye.astral.sh/ ) to be installed.
55
+
53
56
To run the examples, clone this repository and run the following commands from the project root (this directory):
54
57
55
58
``` bash
56
- python3 -m venv .venv
57
- source .venv/bin/activate
58
- python3 -m pip install .
59
- python3 -m examples/02_create_session.py # replace with the example you want to run
59
+ rye sync
60
+ rye run run-example 02_create_session.py # replace with the example you want to run
60
61
```
61
62
62
- !!! note
63
- Make sure you have a ` .env ` file that matches the [ .env.example] ( .env.example ) file in the root of this repository.
63
+ > [ !NOTE ]
64
+ > Make sure you have a ` .env ` file that matches the [ .env.example] ( .env.example ) file in the root of this repository.
64
65
65
66
## Async usage
66
67
Original file line number Diff line number Diff line change @@ -50,12 +50,15 @@ dev-dependencies = [
50
50
" respx" ,
51
51
" pytest" ,
52
52
" pytest-asyncio" ,
53
+ " pytest-playwright" ,
53
54
" ruff" ,
54
55
" time-machine" ,
55
56
" nox" ,
56
57
" dirty-equals>=0.6.0" ,
57
58
" importlib-metadata>=6.7.0" ,
58
59
" rich>=13.7.1" ,
60
+ " python-dotenv" ,
61
+ " playwright" ,
59
62
]
60
63
61
64
[tool .rye .scripts ]
@@ -79,10 +82,13 @@ format = { chain = [
79
82
80
83
"check:importable" = " python -c 'import browserbase'"
81
84
85
+ "run-example" = " python -c 'import sys; from pathlib import Path; example = Path(\" examples\" ) / sys.argv[1]; exec(open(example).read())'"
86
+
82
87
typecheck = { chain = [
83
88
" typecheck:pyright" ,
84
89
" typecheck:mypy"
85
90
]}
91
+
86
92
"typecheck:pyright" = " pyright"
87
93
"typecheck:verify-types" = " pyright --verifytypes browserbase --ignoreexternal"
88
94
"typecheck:mypy" = " mypy ."
Original file line number Diff line number Diff line change 7
7
# all-features: true
8
8
# with-sources: false
9
9
# generate-hashes: false
10
+ # universal: false
10
11
11
12
-e file:.
12
13
annotated-types==0.6.0
@@ -21,6 +22,9 @@ attrs==23.1.0
21
22
certifi==2023.7.22
22
23
# via httpcore
23
24
# via httpx
25
+ # via requests
26
+ charset-normalizer==3.4.0
27
+ # via requests
24
28
colorlog==6.7.0
25
29
# via nox
26
30
dirty-equals==0.6.0
@@ -32,6 +36,8 @@ exceptiongroup==1.1.3
32
36
# via anyio
33
37
filelock==3.12.4
34
38
# via virtualenv
39
+ greenlet==3.1.1
40
+ # via playwright
35
41
h11==0.14.0
36
42
# via httpcore
37
43
httpcore==1.0.2
@@ -42,6 +48,7 @@ httpx==0.25.2
42
48
idna==3.4
43
49
# via anyio
44
50
# via httpx
51
+ # via requests
45
52
importlib-metadata==7.0.0
46
53
iniconfig==2.0.0
47
54
# via pytest
@@ -60,6 +67,8 @@ packaging==23.2
60
67
# via pytest
61
68
platformdirs==3.11.0
62
69
# via virtualenv
70
+ playwright==1.48.0
71
+ # via pytest-playwright
63
72
pluggy==1.3.0
64
73
# via pytest
65
74
py==1.11.0
@@ -68,16 +77,28 @@ pydantic==2.7.1
68
77
# via browserbase
69
78
pydantic-core==2.18.2
70
79
# via pydantic
80
+ pyee==12.0.0
81
+ # via playwright
71
82
pygments==2.18.0
72
83
# via rich
73
84
pyright==1.1.380
74
85
pytest==7.1.1
75
86
# via pytest-asyncio
87
+ # via pytest-base-url
88
+ # via pytest-playwright
76
89
pytest-asyncio==0.21.1
90
+ pytest-base-url==2.1.0
91
+ # via pytest-playwright
92
+ pytest-playwright==0.5.2
77
93
python-dateutil==2.8.2
78
94
# via time-machine
95
+ python-dotenv==1.0.1
96
+ python-slugify==8.0.4
97
+ # via pytest-playwright
79
98
pytz==2023.3.post1
80
99
# via dirty-equals
100
+ requests==2.32.3
101
+ # via pytest-base-url
81
102
respx==0.20.2
82
103
rich==13.7.1
83
104
ruff==0.6.9
@@ -89,6 +110,8 @@ sniffio==1.3.0
89
110
# via anyio
90
111
# via browserbase
91
112
# via httpx
113
+ text-unidecode==1.3
114
+ # via python-slugify
92
115
time-machine==2.9.0
93
116
tomli==2.0.1
94
117
# via mypy
@@ -99,6 +122,9 @@ typing-extensions==4.8.0
99
122
# via mypy
100
123
# via pydantic
101
124
# via pydantic-core
125
+ # via pyee
126
+ urllib3==2.2.3
127
+ # via requests
102
128
virtualenv==20.24.5
103
129
# via nox
104
130
zipp==3.17.0
Original file line number Diff line number Diff line change 7
7
# all-features: true
8
8
# with-sources: false
9
9
# generate-hashes: false
10
+ # universal: false
10
11
11
12
-e file:.
12
13
annotated-types==0.6.0
You can’t perform that action at this time.
0 commit comments