workers-py 1.5.1__py3-none-any.whl → 1.6.1__py3-none-any.whl
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.
- pywrangler/__main__.py +1 -1
- pywrangler/cli.py +28 -3
- pywrangler/sync.py +3 -3
- pywrangler/utils.py +1 -0
- {workers_py-1.5.1.dist-info → workers_py-1.6.1.dist-info}/METADATA +4 -9
- workers_py-1.6.1.dist-info/RECORD +11 -0
- workers_py-1.5.1.dist-info/RECORD +0 -11
- {workers_py-1.5.1.dist-info → workers_py-1.6.1.dist-info}/WHEEL +0 -0
- {workers_py-1.5.1.dist-info → workers_py-1.6.1.dist-info}/entry_points.txt +0 -0
pywrangler/__main__.py
CHANGED
pywrangler/cli.py
CHANGED
|
@@ -4,7 +4,12 @@ import sys
|
|
|
4
4
|
import textwrap
|
|
5
5
|
import click
|
|
6
6
|
|
|
7
|
-
from .utils import
|
|
7
|
+
from .utils import (
|
|
8
|
+
setup_logging,
|
|
9
|
+
write_success,
|
|
10
|
+
WRANGLER_COMMAND,
|
|
11
|
+
WRANGLER_CREATE_COMMAND,
|
|
12
|
+
)
|
|
8
13
|
|
|
9
14
|
setup_logging()
|
|
10
15
|
logger = logging.getLogger("pywrangler")
|
|
@@ -56,10 +61,17 @@ class ProxyToWranglerGroup(click.Group):
|
|
|
56
61
|
ctx.invoke(sync_command, force=False, directly_requested=False)
|
|
57
62
|
|
|
58
63
|
if cmd_name == "dev":
|
|
59
|
-
from
|
|
64
|
+
from .sync import check_wrangler_version
|
|
60
65
|
|
|
61
66
|
check_wrangler_version()
|
|
62
67
|
|
|
68
|
+
if cmd_name == "init":
|
|
69
|
+
# explicitly call `create-cloudflare` so we can instruct it to only show Python templates
|
|
70
|
+
_proxy_to_create_cloudflare(
|
|
71
|
+
["--lang=python", "--no-deploy"] + remaining_args
|
|
72
|
+
)
|
|
73
|
+
sys.exit(0)
|
|
74
|
+
|
|
63
75
|
_proxy_to_wrangler(cmd_name, remaining_args)
|
|
64
76
|
sys.exit(0)
|
|
65
77
|
|
|
@@ -122,7 +134,7 @@ def sync_command(force=False, directly_requested=True):
|
|
|
122
134
|
Also creates a virtual env for Workers that you can use for testing.
|
|
123
135
|
"""
|
|
124
136
|
# This module is imported locally because it searches for pyproject.toml at the top-level.
|
|
125
|
-
from
|
|
137
|
+
from .sync import (
|
|
126
138
|
check_requirements_txt,
|
|
127
139
|
check_wrangler_config,
|
|
128
140
|
is_sync_needed,
|
|
@@ -175,3 +187,16 @@ def _proxy_to_wrangler(command_name, args_list):
|
|
|
175
187
|
f"Wrangler not found. Ensure Node.js and Wrangler are installed and in your PATH. Error was: {str(e)}"
|
|
176
188
|
)
|
|
177
189
|
click.get_current_context().exit(1)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def _proxy_to_create_cloudflare(args_list):
|
|
193
|
+
command_to_run = WRANGLER_CREATE_COMMAND + args_list
|
|
194
|
+
logger.info(f"Passing command to npx create-cloudflare: {' '.join(command_to_run)}")
|
|
195
|
+
try:
|
|
196
|
+
process = subprocess.run(command_to_run, check=False, cwd=".")
|
|
197
|
+
click.get_current_context().exit(process.returncode)
|
|
198
|
+
except FileNotFoundError as e:
|
|
199
|
+
logger.error(
|
|
200
|
+
f"Create-cloudflare not found. Ensure Node.js and create-cloudflare are installed and in your PATH. Error was: {str(e)}"
|
|
201
|
+
)
|
|
202
|
+
click.get_current_context().exit(1)
|
pywrangler/sync.py
CHANGED
|
@@ -11,11 +11,11 @@ from typing import Literal
|
|
|
11
11
|
import click
|
|
12
12
|
import pyjson5
|
|
13
13
|
|
|
14
|
-
from
|
|
14
|
+
from .utils import (
|
|
15
15
|
run_command,
|
|
16
16
|
find_pyproject_toml,
|
|
17
17
|
)
|
|
18
|
-
from
|
|
18
|
+
from .metadata import PYTHON_COMPAT_VERSIONS
|
|
19
19
|
|
|
20
20
|
try:
|
|
21
21
|
import tomllib # Standard in Python 3.11+
|
|
@@ -263,7 +263,7 @@ def check_wrangler_version():
|
|
|
263
263
|
# Parse version from output like "wrangler 4.42.1" or " ⛅️ wrangler 4.42.1"
|
|
264
264
|
version_line = result.stdout.strip()
|
|
265
265
|
# Extract version number using regex
|
|
266
|
-
version_match = re.search(r"
|
|
266
|
+
version_match = re.search(r"(\d+)\.(\d+)\.(\d+)", version_line)
|
|
267
267
|
|
|
268
268
|
if not version_match:
|
|
269
269
|
logger.error(f"Could not parse wrangler version from: {version_line}")
|
pywrangler/utils.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: workers-py
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.1
|
|
4
4
|
Summary: A set of libraries and tools for Python Workers
|
|
5
5
|
Project-URL: Homepage, https://github.com/cloudflare/workers-py
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/cloudflare/workers-py/issues
|
|
@@ -52,19 +52,14 @@ uv run pywrangler sync
|
|
|
52
52
|
|
|
53
53
|
### Development
|
|
54
54
|
|
|
55
|
-
To run the CLI tool while developing it,
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
export REPO_ROOT=/path/to/repo
|
|
59
|
-
uv run --project $REPO_ROOT $REPO_ROOT/src/pywrangler --help
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
On Linux, to install it globally, you may also be able to run:
|
|
55
|
+
To run the CLI tool while developing it, install it globally:
|
|
63
56
|
|
|
64
57
|
```
|
|
65
58
|
uv tool install -e .
|
|
66
59
|
```
|
|
67
60
|
|
|
61
|
+
Then run it via `pywrangler`.
|
|
62
|
+
|
|
68
63
|
Alternatively, you can add `workers-py` to your pyproject.toml:
|
|
69
64
|
|
|
70
65
|
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
pywrangler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
pywrangler/__main__.py,sha256=wcCrL4PjG51r5wVKqJhcoJPTLfHW0wNbD31DrUN0MWI,28
|
|
3
|
+
pywrangler/cli.py,sha256=voUaP2tHCwxznzZ45O6ZAJ91vbp6q9UNb7H2OlgnZ_k,6596
|
|
4
|
+
pywrangler/metadata.py,sha256=vttmaCtouSr9ADj8ncvNGqeaWEGFP8pamH2T6ohFjnA,408
|
|
5
|
+
pywrangler/sync.py,sha256=fFavYhbvBXF4memxrJLnMJpApET_3fx9NmJ_O6NDzxw,14217
|
|
6
|
+
pywrangler/types.py,sha256=RyOTVFFC75vJ0NxGzXWJGouRpQ5k4gsf3Jsiq-i_ans,1174
|
|
7
|
+
pywrangler/utils.py,sha256=JOPCXy_O_RZ-ClSSWL5pel2Iltyclj_JV13IxKr_WRo,3382
|
|
8
|
+
workers_py-1.6.1.dist-info/METADATA,sha256=0oipVsEgOgZhdUXJp9ckB7HWqGVvqqsh2sbcQBL1yIY,1732
|
|
9
|
+
workers_py-1.6.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
10
|
+
workers_py-1.6.1.dist-info/entry_points.txt,sha256=pt6X-Nv5-gSiKUwrnvLwzlSXs9yP37m7zdTAi8f6nAM,50
|
|
11
|
+
workers_py-1.6.1.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
pywrangler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
pywrangler/__main__.py,sha256=BnrUM7YiBmlM4HAn2MI9hP1kVNtzeK_kEgQhRy5HTq0,38
|
|
3
|
-
pywrangler/cli.py,sha256=Srvc5mi710HVCjJWjA-o10QEVl2YNfTfd35IQ4esZ0A,5690
|
|
4
|
-
pywrangler/metadata.py,sha256=vttmaCtouSr9ADj8ncvNGqeaWEGFP8pamH2T6ohFjnA,408
|
|
5
|
-
pywrangler/sync.py,sha256=CAJdZRZb_xGBX0c4pskfJFrKt8cq6wBpDtPbrWnVJeQ,14248
|
|
6
|
-
pywrangler/types.py,sha256=RyOTVFFC75vJ0NxGzXWJGouRpQ5k4gsf3Jsiq-i_ans,1174
|
|
7
|
-
pywrangler/utils.py,sha256=Vtg0qenIWArGXPhI2jL_4c8tUQByUqQKUVzGbCeoqrw,3318
|
|
8
|
-
workers_py-1.5.1.dist-info/METADATA,sha256=4BGL7NsUnHjJOreZ-A6v52ECquRrZYz1VD2_VopODKo,1854
|
|
9
|
-
workers_py-1.5.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
10
|
-
workers_py-1.5.1.dist-info/entry_points.txt,sha256=pt6X-Nv5-gSiKUwrnvLwzlSXs9yP37m7zdTAi8f6nAM,50
|
|
11
|
-
workers_py-1.5.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|