workers-py 1.5.0__py3-none-any.whl → 1.6.0__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/cli.py CHANGED
@@ -4,7 +4,12 @@ import sys
4
4
  import textwrap
5
5
  import click
6
6
 
7
- from .utils import setup_logging, write_success, WRANGLER_COMMAND
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")
@@ -60,6 +65,13 @@ class ProxyToWranglerGroup(click.Group):
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
 
@@ -98,7 +110,7 @@ def app(ctx, debug=False):
98
110
  "-o",
99
111
  "--outdir",
100
112
  type=click.Path(writable=True),
101
- help="The output directory to write the generated types. Default: .venv/lib/python3.vv/site-packages/js-stubs",
113
+ help="The output directory to write the generated types. Default: ./src",
102
114
  )
103
115
  @click.option(
104
116
  "-c",
@@ -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/utils.py CHANGED
@@ -7,6 +7,7 @@ from rich.logging import Console, RichHandler
7
7
  from rich.theme import Theme
8
8
 
9
9
  WRANGLER_COMMAND = ["npx", "--yes", "wrangler"]
10
+ WRANGLER_CREATE_COMMAND = ["npx", "--yes", "create-cloudflare"]
10
11
 
11
12
  logger = logging.getLogger(__name__)
12
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: workers-py
3
- Version: 1.5.0
3
+ Version: 1.6.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
@@ -52,19 +52,14 @@ uv run pywrangler sync
52
52
 
53
53
  ### Development
54
54
 
55
- To run the CLI tool while developing it, use:
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
  ```
@@ -1,11 +1,11 @@
1
1
  pywrangler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  pywrangler/__main__.py,sha256=BnrUM7YiBmlM4HAn2MI9hP1kVNtzeK_kEgQhRy5HTq0,38
3
- pywrangler/cli.py,sha256=yKLn7GU9lWuw0Lhc6XPl5N9SlJ6y5KNGRQtZJT6a8LM,5728
3
+ pywrangler/cli.py,sha256=MBY2S5Bx4D-CxmNm5WT5ln0ch-KrDfahUer4b031GZM,6616
4
4
  pywrangler/metadata.py,sha256=vttmaCtouSr9ADj8ncvNGqeaWEGFP8pamH2T6ohFjnA,408
5
5
  pywrangler/sync.py,sha256=CAJdZRZb_xGBX0c4pskfJFrKt8cq6wBpDtPbrWnVJeQ,14248
6
6
  pywrangler/types.py,sha256=RyOTVFFC75vJ0NxGzXWJGouRpQ5k4gsf3Jsiq-i_ans,1174
7
- pywrangler/utils.py,sha256=Vtg0qenIWArGXPhI2jL_4c8tUQByUqQKUVzGbCeoqrw,3318
8
- workers_py-1.5.0.dist-info/METADATA,sha256=SzUilHhIKFo2gP42JrQzh5CONGXek4wC1OvuGfYkAas,1854
9
- workers_py-1.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- workers_py-1.5.0.dist-info/entry_points.txt,sha256=pt6X-Nv5-gSiKUwrnvLwzlSXs9yP37m7zdTAi8f6nAM,50
11
- workers_py-1.5.0.dist-info/RECORD,,
7
+ pywrangler/utils.py,sha256=JOPCXy_O_RZ-ClSSWL5pel2Iltyclj_JV13IxKr_WRo,3382
8
+ workers_py-1.6.0.dist-info/METADATA,sha256=3Y3CB4to-UbKMPT8fMK26JkI3lQslRKrKuqnNwLS0hs,1732
9
+ workers_py-1.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
+ workers_py-1.6.0.dist-info/entry_points.txt,sha256=pt6X-Nv5-gSiKUwrnvLwzlSXs9yP37m7zdTAi8f6nAM,50
11
+ workers_py-1.6.0.dist-info/RECORD,,