locust-cloud 1.20.8.dev2__py3-none-any.whl → 1.20.8.dev4__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.
locust_cloud/args.py CHANGED
@@ -4,7 +4,9 @@ import gzip
4
4
  import io
5
5
  import os
6
6
  import pathlib
7
+ import shutil
7
8
  import sys
9
+ import tempfile
8
10
 
9
11
  if sys.version_info >= (3, 11):
10
12
  import tomllib
@@ -113,6 +115,39 @@ def transfer_encoded_args_files(paths: list[pathlib.Path], to_file: str | None)
113
115
  return transfer_encode(f"{to_file}.zip", buffer)
114
116
 
115
117
 
118
+ def flat_transfer_encoded_args_files(paths: list[pathlib.Path], to_file: str | None) -> dict[str, str]:
119
+ buffer = io.BytesIO()
120
+
121
+ with tempfile.TemporaryDirectory() as tmpdir:
122
+ tmp_path = pathlib.Path(tmpdir)
123
+
124
+ for src in paths:
125
+ src_path = pathlib.Path(src)
126
+ dest_path = tmp_path / src_path.name
127
+
128
+ if src_path.is_file():
129
+ shutil.copy(src_path, dest_path)
130
+ elif src_path.is_dir():
131
+ shutil.copytree(src_path, dest_path)
132
+ else:
133
+ print(f"Warning: {src} is not a valid file or directory")
134
+
135
+ # Create the zip archive
136
+ with ZipFile(buffer, "w") as zf:
137
+ for item in tmp_path.iterdir():
138
+ if item.is_file():
139
+ zf.write(item, arcname=item.name)
140
+ elif item.is_dir():
141
+ for root, _, files in os.walk(item):
142
+ for file in files:
143
+ file_path = pathlib.Path(root) / file
144
+ arcname = file_path.relative_to(tmp_path)
145
+ zf.write(file_path, arcname)
146
+
147
+ buffer.seek(0)
148
+ return transfer_encode(f"{to_file}.zip", buffer)
149
+
150
+
116
151
  class MergeToTransferEncodedZip(argparse.Action):
117
152
  def __call__(self, parser, namespace, values, option_string=None):
118
153
  paths = cast(list[pathlib.Path], values)
@@ -120,6 +155,13 @@ class MergeToTransferEncodedZip(argparse.Action):
120
155
  setattr(namespace, self.dest, value)
121
156
 
122
157
 
158
+ class MergeToTransferEncodedZipFlat(MergeToTransferEncodedZip):
159
+ def __call__(self, parser, namespace, values, option_string=None):
160
+ paths = cast(list[pathlib.Path], values)
161
+ value = flat_transfer_encoded_args_files(paths, option_string.lstrip("-"))
162
+ setattr(namespace, self.dest, value)
163
+
164
+
123
165
  cloud_parser = configargparse.ArgumentParser(add_help=False)
124
166
  cloud_parser.add_argument(
125
167
  "--login",
@@ -176,7 +218,7 @@ cloud_parser.add_argument(
176
218
  )
177
219
  cloud_parser.add_argument(
178
220
  "--extra-packages",
179
- action=MergeToTransferEncodedZip,
221
+ action=MergeToTransferEncodedZipFlat,
180
222
  nargs="*",
181
223
  type=valid_extra_packages_path,
182
224
  help="A list of extra packages to upload. Space-separated whl/tar.gz files or directory packages to be installed when running locust.",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: locust-cloud
3
- Version: 1.20.8.dev2
3
+ Version: 1.20.8.dev4
4
4
  Summary: Locust Cloud
5
5
  Project-URL: homepage, https://locust.cloud
6
6
  Project-URL: repository, https://github.com/locustcloud/locust-cloud
@@ -16,4 +16,6 @@ Description-Content-Type: text/markdown
16
16
 
17
17
  # Locust Cloud
18
18
 
19
- See https://locust.cloud for general information on Locust Cloud, or https://docs.locust.cloud for usage instructions.
19
+ See https://locust.cloud for general information on Locust Cloud, or https://docs.locust.cloud for usage instructions.
20
+
21
+ If you encounter issues with the code here, contact Locust Cloud support or file an issue here https://github.com/locustio/locust/issues
@@ -1,6 +1,6 @@
1
1
  locust_cloud/__init__.py,sha256=6z2hE5rUP9WJyYgr-7XC2GhIV-05m8XxjOsnb8ae1WY,56
2
2
  locust_cloud/apisession.py,sha256=fz3mJsHbS-LdlVcuaJurf4_nq_Oa_XdBTZ7sVpux_mA,4376
3
- locust_cloud/args.py,sha256=XmIzg5wOF52g-f7sXe83NhyT0S_RGWKAmJO91D9IMD8,8380
3
+ locust_cloud/args.py,sha256=_U2bxFu32H7SyGupzd_gNk9kud4pX0KRyOJUcZBzkVw,9944
4
4
  locust_cloud/cloud.py,sha256=DqIxLnbdoX6E266yXpXixI4OtyWT9m-vMzVuyI8t3X0,6363
5
5
  locust_cloud/common.py,sha256=GVKkWcbbqd9n8oU-fHZRVZw3jGtuIVGSCLD2ZizeEo0,1160
6
6
  locust_cloud/input_events.py,sha256=MyxccgboHByICuK6VpQCCJhZQqTZAacNmkSpw-gxBEw,3420
@@ -11,8 +11,8 @@ locust_cloud/docs/1-first-run.rst,sha256=Z34qKIxIniwCELeUmEQbNLsN7HWM5fq-a3Wc4fu
11
11
  locust_cloud/docs/2-examples.rst,sha256=uT-Byr4twmWakhMdHNqRvFP0f5hUxqrieBzxBHus51Y,9806
12
12
  locust_cloud/docs/locust-cloud.rst,sha256=q0WSBOJI0LR3zxuaE9Lor0_bzv4AOKr3aCz9VC6sIzs,137
13
13
  locust_cloud/docs/images/locust-cloud-screenshot.png,sha256=ag0IxBi-40VexC84MApol1GCgRCL2h-l8NQDTMaeTyE,477350
14
- locust_cloud-1.20.8.dev2.dist-info/METADATA,sha256=Z49Dl-x719zsGvfB3Mgfck8RjPfqpdOgxbXqtHOscmY,649
15
- locust_cloud-1.20.8.dev2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- locust_cloud-1.20.8.dev2.dist-info/entry_points.txt,sha256=PGyAb4e3aTsGS3N3VGShDl6VzJaXy7QwsEgsLOC7V00,57
17
- locust_cloud-1.20.8.dev2.dist-info/licenses/LICENSE,sha256=Ow6fY6ta4KIjdlWalmxGvRP8yLmetvkbkl-SdHMjPIs,1093
18
- locust_cloud-1.20.8.dev2.dist-info/RECORD,,
14
+ locust_cloud-1.20.8.dev4.dist-info/METADATA,sha256=TFQKlGqPhQwclgtI3QOGrc6X7F5mhueOI-tMpOxpRn8,788
15
+ locust_cloud-1.20.8.dev4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
+ locust_cloud-1.20.8.dev4.dist-info/entry_points.txt,sha256=PGyAb4e3aTsGS3N3VGShDl6VzJaXy7QwsEgsLOC7V00,57
17
+ locust_cloud-1.20.8.dev4.dist-info/licenses/LICENSE,sha256=Ow6fY6ta4KIjdlWalmxGvRP8yLmetvkbkl-SdHMjPIs,1093
18
+ locust_cloud-1.20.8.dev4.dist-info/RECORD,,