Skip to content

Commit 62dbaaa

Browse files
committed
Update all examples to use pywrangler
And add CI jobs for all 5 of them. langchain is currently xfailed because of a problem with urllib3.
1 parent c0f5936 commit 62dbaaa

40 files changed

+2144
-321
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v4
18+
19+
- name: Set up Python
20+
run: uv python install
21+
22+
- name: Install dependencies
23+
run: uv sync --dev
24+
25+
- name: Run tests
26+
run: uv run pytest

.github/workflows/vendoring.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/vendoring/unix.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/vendoring/windows.bat

Lines changed: 0 additions & 18 deletions
This file was deleted.

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
**/.wrangler
2-
**/node_modules
1+
.wrangler
2+
node_modules
3+
python_modules
4+
__pycache__

01-hello/README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@ your code between now and official release time as APIs may change.
66

77
## How to Run
88

9-
First ensure that your Wrangler version is up to date (3.30.0 and above).
9+
First ensure that `uv` is installed:
10+
https://docs.astral.sh/uv/getting-started/installation/#standalone-installer
1011

11-
```bash
12-
$ wrangler -v
13-
⛅️ wrangler 3.30.0
14-
```
15-
16-
Now, if you run `wrangler dev` within this directory, it should use the config
12+
Now, if you run `uv run pywrangler dev` within this directory, it should use the config
1713
in `wrangler.toml` to run the example.
1814

19-
You can also run `wrangler deploy` to deploy the example.
15+
You can also run `uv run pywrangler deploy` to deploy the example.

01-hello/pyproject.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[project]
2+
name = "hello-python"
3+
version = "0.1.0"
4+
description = "Python hello world worker"
5+
readme = "README.md"
6+
requires-python = ">=3.12"
7+
dependencies = [
8+
"webtypy>=0.1.7",
9+
]
10+
11+
[dependency-groups]
12+
dev = [
13+
"workers-py"
14+
]

01-hello/uv.lock

Lines changed: 155 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

02-binding/README.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
# Bindings Example
1+
# Environment Binding Example
22

33
Warning: Python support in Workers is experimental and things will break. This
44
example is meant for reference only right now; you should be prepared to update
55
your code between now and official release time as APIs may change.
66

77
## How to Run
88

9-
First ensure that your Wrangler version is up to date (3.30.0 and above).
9+
First ensure that `uv` is installed:
10+
https://docs.astral.sh/uv/getting-started/installation/#standalone-installer
1011

11-
```bash
12-
$ wrangler -v
13-
⛅️ wrangler 3.30.0
14-
```
15-
16-
Now, you must set up a [KV namespace](https://developers.cloudflare.com/kv/reference/kv-namespaces/). Edit `wrangler.toml` to reflect the KV namespace you created.
17-
18-
Now, if you run `wrangler dev` within this directory, it should use the config
12+
Now, if you run `uv run pywrangler dev` within this directory, it should use the config
1913
in `wrangler.toml` to run the example.
2014

21-
You can also run `wrangler deploy` to deploy the example.
15+
You can also run `uv run pywrangler deploy` to deploy the example.

02-binding/pyproject.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[project]
2+
name = "hello-python-bindings"
3+
version = "0.1.0"
4+
description = "Python bindings example"
5+
readme = "README.md"
6+
requires-python = ">=3.12"
7+
dependencies = [
8+
"webtypy>=0.1.7",
9+
]
10+
11+
[dependency-groups]
12+
dev = [
13+
"workers-py"
14+
]

0 commit comments

Comments
 (0)