workers-py 1.3.0__tar.gz → 1.4.0__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.
- {workers_py-1.3.0 → workers_py-1.4.0}/CHANGELOG.md +8 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/PKG-INFO +1 -1
- {workers_py-1.3.0 → workers_py-1.4.0}/pyproject.toml +1 -1
- {workers_py-1.3.0 → workers_py-1.4.0}/src/pywrangler/cli.py +5 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/src/pywrangler/sync.py +44 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/tests/test_cli.py +44 -2
- {workers_py-1.3.0 → workers_py-1.4.0}/uv.lock +1 -1
- {workers_py-1.3.0 → workers_py-1.4.0}/.github/workflows/commitlint.yml +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/.github/workflows/lint.yml +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/.github/workflows/release.yml +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/.github/workflows/tests.yml +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/.gitignore +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/.pre-commit-config.yaml +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/CLAUDE.md +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/CONTRIBUTING.md +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/README.md +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/src/pywrangler/__init__.py +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/src/pywrangler/__main__.py +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/src/pywrangler/metadata.py +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/src/pywrangler/utils.py +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/tests/__init__.py +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/tests/test_py_version_detect.py +0 -0
- {workers_py-1.3.0 → workers_py-1.4.0}/workers.py +0 -0
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- version list -->
|
|
4
4
|
|
|
5
|
+
## v1.4.0 (2025-10-10)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- Adds wrangler version check
|
|
10
|
+
([`ed41bcc`](https://github.com/cloudflare/workers-py/commit/ed41bccf24d5130b2c628edc7c3ece48edf14253))
|
|
11
|
+
|
|
12
|
+
|
|
5
13
|
## v1.3.0 (2025-10-08)
|
|
6
14
|
|
|
7
15
|
### Features
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: workers-py
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
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
|
|
@@ -57,6 +57,11 @@ class ProxyToWranglerGroup(click.Group):
|
|
|
57
57
|
if cmd_name in ["dev", "publish", "deploy", "versions"]:
|
|
58
58
|
ctx.invoke(sync_command, force=False, directly_requested=False)
|
|
59
59
|
|
|
60
|
+
if cmd_name == "dev":
|
|
61
|
+
from pywrangler.sync import check_wrangler_version
|
|
62
|
+
|
|
63
|
+
check_wrangler_version()
|
|
64
|
+
|
|
60
65
|
_proxy_to_wrangler(cmd_name, remaining_args)
|
|
61
66
|
sys.exit(0)
|
|
62
67
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import os
|
|
3
|
+
import re
|
|
3
4
|
import shutil
|
|
4
5
|
import tempfile
|
|
5
6
|
from contextlib import contextmanager
|
|
@@ -229,6 +230,7 @@ def create_workers_venv():
|
|
|
229
230
|
|
|
230
231
|
|
|
231
232
|
MIN_UV_VERSION = (0, 8, 10)
|
|
233
|
+
MIN_WRANGLER_VERSION = (4, 42, 1)
|
|
232
234
|
|
|
233
235
|
|
|
234
236
|
def check_uv_version():
|
|
@@ -243,6 +245,48 @@ def check_uv_version():
|
|
|
243
245
|
raise click.exceptions.Exit(code=1)
|
|
244
246
|
|
|
245
247
|
|
|
248
|
+
def check_wrangler_version():
|
|
249
|
+
"""
|
|
250
|
+
Check that the installed wrangler version is at least 4.42.1.
|
|
251
|
+
|
|
252
|
+
Raises:
|
|
253
|
+
click.exceptions.Exit: If wrangler is not installed or version is too old.
|
|
254
|
+
"""
|
|
255
|
+
result = run_command(
|
|
256
|
+
["npx", "--yes", "wrangler", "--version"], capture_output=True, check=False
|
|
257
|
+
)
|
|
258
|
+
if result.returncode != 0:
|
|
259
|
+
logger.error("Failed to get wrangler version. Is wrangler installed?")
|
|
260
|
+
logger.error("Install wrangler with: npm install wrangler@latest")
|
|
261
|
+
raise click.exceptions.Exit(code=1)
|
|
262
|
+
|
|
263
|
+
# Parse version from output like "wrangler 4.42.1" or " ⛅️ wrangler 4.42.1"
|
|
264
|
+
version_line = result.stdout.strip()
|
|
265
|
+
# Extract version number using regex
|
|
266
|
+
version_match = re.search(r"wrangler\s+(\d+)\.(\d+)\.(\d+)", version_line)
|
|
267
|
+
|
|
268
|
+
if not version_match:
|
|
269
|
+
logger.error(f"Could not parse wrangler version from: {version_line}")
|
|
270
|
+
logger.error("Install wrangler with: npm install wrangler@latest")
|
|
271
|
+
raise click.exceptions.Exit(code=1)
|
|
272
|
+
|
|
273
|
+
major, minor, patch = map(int, version_match.groups())
|
|
274
|
+
current_version = (major, minor, patch)
|
|
275
|
+
|
|
276
|
+
if current_version < MIN_WRANGLER_VERSION:
|
|
277
|
+
min_version_str = ".".join(str(x) for x in MIN_WRANGLER_VERSION)
|
|
278
|
+
current_version_str = ".".join(str(x) for x in current_version)
|
|
279
|
+
logger.error(
|
|
280
|
+
f"wrangler version at least {min_version_str} required, have {current_version_str}."
|
|
281
|
+
)
|
|
282
|
+
logger.error("Update wrangler with: npm install wrangler@latest")
|
|
283
|
+
raise click.exceptions.Exit(code=1)
|
|
284
|
+
|
|
285
|
+
logger.debug(
|
|
286
|
+
f"wrangler version {'.'.join(str(x) for x in current_version)} is sufficient"
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
|
|
246
290
|
def create_pyodide_venv():
|
|
247
291
|
if PYODIDE_VENV_PATH.is_dir():
|
|
248
292
|
logger.debug(
|
|
@@ -3,7 +3,7 @@ import os
|
|
|
3
3
|
import shutil
|
|
4
4
|
import subprocess
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from unittest.mock import patch
|
|
6
|
+
from unittest.mock import patch, Mock
|
|
7
7
|
from textwrap import dedent
|
|
8
8
|
|
|
9
9
|
import pytest
|
|
@@ -406,10 +406,13 @@ def test_proxy_to_wrangler_unknown_command(mock_proxy_to_wrangler):
|
|
|
406
406
|
)
|
|
407
407
|
|
|
408
408
|
|
|
409
|
+
@patch("pywrangler.sync.check_wrangler_version")
|
|
409
410
|
@patch("pywrangler.cli._proxy_to_wrangler")
|
|
410
411
|
@patch("pywrangler.cli.sync_command")
|
|
411
412
|
@patch("sys.argv", ["pywrangler", "dev", "--local"])
|
|
412
|
-
def test_proxy_auto_sync_commands(
|
|
413
|
+
def test_proxy_auto_sync_commands(
|
|
414
|
+
mock_sync_command, mock_proxy_to_wrangler, mock_check_wrangler_version
|
|
415
|
+
):
|
|
413
416
|
"""Test that dev, publish, and deploy commands automatically run sync first."""
|
|
414
417
|
runner = CliRunner()
|
|
415
418
|
|
|
@@ -530,3 +533,42 @@ def test_sync_recreates_venv_on_python_version_mismatch(clean_test_dir):
|
|
|
530
533
|
assert "3.13" in version_result.stdout, (
|
|
531
534
|
f"Python version is not 3.13: {version_result.stdout}"
|
|
532
535
|
)
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
# Wrangler version check tests
|
|
539
|
+
@patch("pywrangler.sync.run_command")
|
|
540
|
+
def test_check_wrangler_version_sufficient(mock_run_command):
|
|
541
|
+
"""Test that check_wrangler_version passes with sufficient version."""
|
|
542
|
+
from pywrangler.sync import check_wrangler_version
|
|
543
|
+
|
|
544
|
+
# Mock successful wrangler version output
|
|
545
|
+
mock_result = Mock()
|
|
546
|
+
mock_result.returncode = 0
|
|
547
|
+
mock_result.stdout = "wrangler 4.42.1"
|
|
548
|
+
mock_run_command.return_value = mock_result
|
|
549
|
+
|
|
550
|
+
# Should not raise an exception
|
|
551
|
+
check_wrangler_version()
|
|
552
|
+
|
|
553
|
+
# Verify the command was called correctly
|
|
554
|
+
mock_run_command.assert_called_once_with(
|
|
555
|
+
["npx", "--yes", "wrangler", "--version"], capture_output=True, check=False
|
|
556
|
+
)
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
@patch("pywrangler.sync.run_command")
|
|
560
|
+
def test_check_wrangler_version_insufficient(mock_run_command):
|
|
561
|
+
"""Test that check_wrangler_version fails with insufficient version."""
|
|
562
|
+
from pywrangler.sync import check_wrangler_version
|
|
563
|
+
|
|
564
|
+
# Mock wrangler version output with old version
|
|
565
|
+
mock_result = Mock()
|
|
566
|
+
mock_result.returncode = 0
|
|
567
|
+
mock_result.stdout = "⛅️ wrangler 4.40.0"
|
|
568
|
+
mock_run_command.return_value = mock_result
|
|
569
|
+
|
|
570
|
+
# Should raise SystemExit
|
|
571
|
+
import click
|
|
572
|
+
|
|
573
|
+
with pytest.raises(click.exceptions.Exit):
|
|
574
|
+
check_wrangler_version()
|
|
@@ -650,7 +650,7 @@ wheels = [
|
|
|
650
650
|
|
|
651
651
|
[[package]]
|
|
652
652
|
name = "workers-py"
|
|
653
|
-
version = "1.
|
|
653
|
+
version = "1.4.0"
|
|
654
654
|
source = { editable = "." }
|
|
655
655
|
dependencies = [
|
|
656
656
|
{ name = "click", version = "8.1.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|