Skip to content

Commit cb804fc

Browse files
committed
docs show using uv
1 parent 5cbee8c commit cb804fc

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,10 @@ Or [install uv manually](https://docs.astral.sh/uv/getting-started/installation/
1414
$ uv sync --all-extras
1515
```
1616

17-
You can then run scripts using `uv run python script.py` or by manually activating the virtual environment:
17+
You can then run scripts using `uv run python script.py`:
1818

1919
```sh
20-
# manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work
21-
$ source .venv/bin/activate
22-
23-
# now you can omit the `uv run` prefix
24-
$ python script.py
25-
```
26-
27-
### Without `uv`
28-
29-
Alternatively if you don't want to install `uv`, you can stick with the standard `pip` setup by ensuring you have the Python version specified in `.python-version`, create a virtual environment however you desire and then install dependencies using this command:
30-
31-
```sh
32-
$ pip install -r requirements-dev.lock
20+
uv run python script.py
3321
```
3422

3523
## Modifying/Adding code
@@ -103,7 +91,7 @@ If you’d like to use the repository from source, you can either install from g
10391
To install via git:
10492

10593
```sh
106-
$ pip install git+ssh://git@github.com/browserbase/stagehand-python#stainless.git
94+
uv run pip install git+ssh://git@github.com/browserbase/stagehand-python#stainless.git
10795
```
10896

10997
Alternatively, you can build from source and install the wheel file:
@@ -115,13 +103,13 @@ To create a distributable version of the library, all you have to do is run this
115103
```sh
116104
$ uv build
117105
# or
118-
$ python -m build
106+
$ uv run python -m build
119107
```
120108

121109
Then to install:
122110

123111
```sh
124-
$ pip install ./path-to-wheel-file.whl
112+
uv run pip install ./path-to-wheel-file.whl
125113
```
126114

127115
## Running tests
@@ -134,7 +122,7 @@ $ npx prism mock path/to/your/openapi.yml
134122
```
135123

136124
```sh
137-
$ ./scripts/test
125+
$ uv run -- ./scripts/test
138126
```
139127

140128
## Linting and formatting
@@ -145,13 +133,13 @@ This repository uses [ruff](https://github.com/astral-sh/ruff) and
145133
To lint:
146134

147135
```sh
148-
$ ./scripts/lint
136+
$ uv run -- ./scripts/lint
149137
```
150138

151139
To format and fix all ruff issues automatically:
152140

153141
```sh
154-
$ ./scripts/format
142+
$ uv run -- ./scripts/format
155143
```
156144

157145
## Publishing and releases

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ It is generated with [Stainless](https://www.stainless.com/).
1212
pip install stagehand-alpha
1313
```
1414

15+
For local development or when working from this repository, sync the dependency lockfile with `uv` (see the Local development section below) before running project scripts.
16+
1517
## Requirements
1618

1719
Python 3.9 or higher.
@@ -27,8 +29,25 @@ export BROWSERBASE_API_KEY="your-bb-api-key"
2729
export BROWSERBASE_PROJECT_ID="your-bb-project-uuid"
2830
export MODEL_API_KEY="sk-proj-your-llm-api-key"
2931

30-
python examples/full_example.py
32+
uv run python examples/full_example.py
33+
```
34+
35+
<details>
36+
<summary><strong>Local development</strong></summary>
37+
38+
This repository relies on `uv` to install the sanctioned Python version and dependencies. After cloning, bootstrap the environment with:
39+
40+
```sh
41+
./scripts/bootstrap
42+
```
43+
Once the environment is ready, execute repo scripts with `uv run`:
44+
45+
```sh
46+
uv run python examples/full_example.py
47+
uv run python scripts/download-binary.py
48+
uv run --isolated --all-extras pytest
3149
```
50+
</details>
3251

3352
## Usage
3453

@@ -210,7 +229,7 @@ By default, the async client uses `httpx` for HTTP requests. For improved concur
210229
Install `aiohttp`:
211230

212231
```sh
213-
pip install stagehand-alpha[aiohttp]
232+
uv run pip install stagehand-alpha[aiohttp]
214233
```
215234

216235
Then instantiate the client with `http_client=DefaultAioHttpClient()`:

0 commit comments

Comments
 (0)