locust-cloud 1.20.7__tar.gz → 1.20.8.dev2__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.
Files changed (31) hide show
  1. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/PKG-INFO +1 -1
  2. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/locust_cloud/args.py +21 -3
  3. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/locust_cloud/cloud.py +3 -0
  4. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/tests/args_test.py +3 -3
  5. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/uv.lock +352 -352
  6. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/.github/workflows/daily-check.yml +0 -0
  7. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/.github/workflows/tests.yml +0 -0
  8. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/.gitignore +0 -0
  9. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/.pre-commit-config.yaml +0 -0
  10. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/.vscode/extensions.json +0 -0
  11. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/.vscode/launch.json +0 -0
  12. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/.vscode/settings.json +0 -0
  13. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/LICENSE +0 -0
  14. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/README.md +0 -0
  15. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/locust_cloud/__init__.py +0 -0
  16. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/locust_cloud/apisession.py +0 -0
  17. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/locust_cloud/common.py +0 -0
  18. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/locust_cloud/docs/.gitignore +0 -0
  19. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/locust_cloud/docs/1-first-run.rst +0 -0
  20. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/locust_cloud/docs/2-examples.rst +0 -0
  21. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/locust_cloud/docs/images/locust-cloud-screenshot.png +0 -0
  22. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/locust_cloud/docs/locust-cloud.rst +0 -0
  23. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/locust_cloud/input_events.py +0 -0
  24. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/locust_cloud/web_login.py +0 -0
  25. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/locust_cloud/websocket.py +0 -0
  26. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/locustfile.py +0 -0
  27. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/pyproject.toml +0 -0
  28. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/testdata/extra.txt +0 -0
  29. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/tests/cloud_test.py +0 -0
  30. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/tests/web_login_test.py +0 -0
  31. {locust_cloud-1.20.7 → locust_cloud-1.20.8.dev2}/tests/websocket_test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: locust-cloud
3
- Version: 1.20.7
3
+ Version: 1.20.8.dev2
4
4
  Summary: Locust Cloud
5
5
  Project-URL: homepage, https://locust.cloud
6
6
  Project-URL: repository, https://github.com/locustcloud/locust-cloud
@@ -61,6 +61,17 @@ def valid_extra_files_path(file_path: str) -> pathlib.Path:
61
61
  return p
62
62
 
63
63
 
64
+ def valid_extra_packages_path(file_path: str) -> pathlib.Path:
65
+ p = pathlib.Path(file_path).resolve()
66
+
67
+ if not p.exists():
68
+ raise ArgumentTypeError(f"Path not found: {file_path}")
69
+ if p.is_file() and not (p.suffix == ".whl" or p.suffixes == [".tar", ".gz"]):
70
+ raise ArgumentTypeError(f"Invalid file suffix (must be '.whl' or '.tar.gz'): {file_path}")
71
+
72
+ return p
73
+
74
+
64
75
  def transfer_encode(file_name: str, stream: IO[bytes]) -> dict[str, str]:
65
76
  return {
66
77
  "filename": file_name,
@@ -91,7 +102,7 @@ def expanded(paths: list[pathlib.Path]) -> Generator[pathlib.Path, None, None]:
91
102
  yield path
92
103
 
93
104
 
94
- def transfer_encoded_extra_files(paths: list[pathlib.Path]) -> dict[str, str]:
105
+ def transfer_encoded_args_files(paths: list[pathlib.Path], to_file: str | None) -> dict[str, str]:
95
106
  buffer = io.BytesIO()
96
107
 
97
108
  with ZipFile(buffer, "w") as zf:
@@ -99,13 +110,13 @@ def transfer_encoded_extra_files(paths: list[pathlib.Path]) -> dict[str, str]:
99
110
  zf.write(path.relative_to(CWD))
100
111
 
101
112
  buffer.seek(0)
102
- return transfer_encode("extra-files.zip", buffer)
113
+ return transfer_encode(f"{to_file}.zip", buffer)
103
114
 
104
115
 
105
116
  class MergeToTransferEncodedZip(argparse.Action):
106
117
  def __call__(self, parser, namespace, values, option_string=None):
107
118
  paths = cast(list[pathlib.Path], values)
108
- value = transfer_encoded_extra_files(paths)
119
+ value = transfer_encoded_args_files(paths, option_string.lstrip("-"))
109
120
  setattr(namespace, self.dest, value)
110
121
 
111
122
 
@@ -163,6 +174,13 @@ cloud_parser.add_argument(
163
174
  type=valid_extra_files_path,
164
175
  help="A list of extra files or directories to upload. Space-separated, e.g. `--extra-files testdata.csv *.py my-directory/`.",
165
176
  )
177
+ cloud_parser.add_argument(
178
+ "--extra-packages",
179
+ action=MergeToTransferEncodedZip,
180
+ nargs="*",
181
+ type=valid_extra_packages_path,
182
+ help="A list of extra packages to upload. Space-separated whl/tar.gz files or directory packages to be installed when running locust.",
183
+ )
166
184
  cloud_parser.add_argument(
167
185
  "--testrun-tags",
168
186
  nargs="*",
@@ -101,6 +101,9 @@ def main():
101
101
  if options.extra_files:
102
102
  payload["extra_files"] = options.extra_files
103
103
 
104
+ if options.extra_packages:
105
+ payload["extra_packages"] = options.extra_packages
106
+
104
107
  for attempt in range(1, 16):
105
108
  try:
106
109
  response = session.post("/deploy", json=payload)
@@ -12,7 +12,7 @@ from locust_cloud.args import (
12
12
  expanded,
13
13
  pipe,
14
14
  transfer_encode,
15
- transfer_encoded_extra_files,
15
+ transfer_encoded_args_files,
16
16
  transfer_encoded_file,
17
17
  valid_extra_files_path,
18
18
  )
@@ -63,8 +63,8 @@ def test_expanded():
63
63
  assert result == [pathlib.Path("locustfile.py"), pathlib.Path("testdata/extra.txt")]
64
64
 
65
65
 
66
- def test_transfer_encoded_extra_files():
67
- result = transfer_encoded_extra_files([pathlib.Path("testdata").resolve()])
66
+ def test_transfer_encoded_args_files():
67
+ result = transfer_encoded_args_files([pathlib.Path("testdata").resolve()], "extra-files")
68
68
  assert result["filename"] == "extra-files.zip"
69
69
 
70
70
  buffer = pipe(