abxrcli 1.0.2__tar.gz → 1.0.3__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 (40) hide show
  1. {abxrcli-1.0.2 → abxrcli-1.0.3}/PKG-INFO +15 -8
  2. {abxrcli-1.0.2 → abxrcli-1.0.3}/README.md +14 -7
  3. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/apps.py +34 -26
  4. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/cli.py +2 -2
  5. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxrcli.egg-info/PKG-INFO +15 -8
  6. {abxrcli-1.0.2 → abxrcli-1.0.3}/pyproject.toml +1 -1
  7. {abxrcli-1.0.2 → abxrcli-1.0.3}/setup.py +1 -1
  8. {abxrcli-1.0.2 → abxrcli-1.0.3}/tests/test_apps.py +46 -0
  9. {abxrcli-1.0.2 → abxrcli-1.0.3}/LICENSE +0 -0
  10. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/api_service.py +0 -0
  11. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/app_bundles.py +0 -0
  12. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/audit_logs.py +0 -0
  13. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/constants.py +0 -0
  14. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/devices.py +0 -0
  15. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/files.py +0 -0
  16. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/formats.py +0 -0
  17. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/groups.py +0 -0
  18. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/multipart.py +0 -0
  19. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/org.py +0 -0
  20. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/output.py +0 -0
  21. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/system_apps.py +0 -0
  22. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/tags.py +0 -0
  23. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/users.py +0 -0
  24. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/version.py +0 -0
  25. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxr/videos.py +0 -0
  26. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxrcli.egg-info/SOURCES.txt +0 -0
  27. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxrcli.egg-info/dependency_links.txt +0 -0
  28. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxrcli.egg-info/entry_points.txt +0 -0
  29. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxrcli.egg-info/requires.txt +0 -0
  30. {abxrcli-1.0.2 → abxrcli-1.0.3}/abxrcli.egg-info/top_level.txt +0 -0
  31. {abxrcli-1.0.2 → abxrcli-1.0.3}/setup.cfg +0 -0
  32. {abxrcli-1.0.2 → abxrcli-1.0.3}/tests/test_api_service.py +0 -0
  33. {abxrcli-1.0.2 → abxrcli-1.0.3}/tests/test_app_bundles.py +0 -0
  34. {abxrcli-1.0.2 → abxrcli-1.0.3}/tests/test_devices.py +0 -0
  35. {abxrcli-1.0.2 → abxrcli-1.0.3}/tests/test_files.py +0 -0
  36. {abxrcli-1.0.2 → abxrcli-1.0.3}/tests/test_groups.py +0 -0
  37. {abxrcli-1.0.2 → abxrcli-1.0.3}/tests/test_multipart.py +0 -0
  38. {abxrcli-1.0.2 → abxrcli-1.0.3}/tests/test_org.py +0 -0
  39. {abxrcli-1.0.2 → abxrcli-1.0.3}/tests/test_output.py +0 -0
  40. {abxrcli-1.0.2 → abxrcli-1.0.3}/tests/test_system_apps.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: abxrcli
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: ArborXR CLI
5
5
  Author-email: Brian Rice <brian@arborxr.com>
6
6
  Description-Content-Type: text/markdown
@@ -111,23 +111,26 @@ These commands manage app-related operations.
111
111
 
112
112
  ##### release_channel_set_version
113
113
  * Usage:
114
- `abxr-cli apps release_channel_set_version app_id [--release_channel_id RELEASE_CHANNEL_ID] [--version_id VERSION_ID]`
114
+ `abxr-cli apps release_channel_set_version app_id --release_channel_id RELEASE_CHANNEL_ID (--version_id VERSION_ID | --bundle_id BUNDLE_ID)`
115
115
  * Positional Argument:
116
116
  * `app_id`: The unique identifier of the app.
117
- * Optional Arguments:
118
- * --release_channel_id: The identifier for the release channel.
117
+ * Arguments:
118
+ * --release_channel_id: The identifier for the release channel (required).
119
119
  * --version_id: The version identifier to set for the channel.
120
- * Description: Assign a specific version to a release channel.
120
+ * --bundle_id: The app bundle identifier to set for the channel. Give either --version_id or --bundle_id, not both.
121
+ * Description: Assign a specific version or app bundle to a release channel. A newly uploaded version can only be assigned once the server has finished processing it; until then this command fails with a 422 validation error. When scripting an upload followed by this command, pass `--wait` to `apps upload` so it returns only once the version is available, or assign the channel during the upload with `--release-channel-id`.
121
122
 
122
123
  ##### upload
123
124
  * Usage:
124
- `abxr-cli apps upload app_id filename [--version VERSION] [--notes NOTES] [--release-channel-id ID | --new-release-channel-title TITLE]`
125
+ `abxr-cli apps upload app_id filename [--version_number VERSION] [--notes NOTES] [--wait] [--wait_time SECONDS] [--release-channel-id ID | --new-release-channel-title TITLE]`
125
126
  * Positional Arguments:
126
127
  * `app_id`: The unique identifier of the app.
127
128
  * `filename`: Local path of the APK/ZIP (apk+obb) file to upload.
128
129
  * Optional Arguments:
129
- * -v, --version: Version number (note that the Uploaded APK itself can override this value).
130
+ * --version_number: Version number (note that the Uploaded APK itself can override this value).
130
131
  * -n, --notes: Release notes for the new version.
132
+ * -w, --wait: After the upload, wait until the server has finished processing the version and it is available. If it is still processing when --wait_time runs out, the command exits with an error (the upload itself is kept). Applies to APK uploads; it has no effect when a ZIP is uploaded as an app bundle.
133
+ * --wait_time: Maximum number of seconds `--wait` waits (default 60). Use 0 to wait with no limit.
131
134
  * --release-channel-id: ID of existing release channel to associate with this version.
132
135
  * --new-release-channel-title: Title for a new release channel to create and associate with this version.
133
136
  * Description: Upload a new version of an app (APK/ZIP only). To upload an app bundle with associated files, use the `app_bundles upload` command. You can optionally associate the upload with a release channel using either --release-channel-id or --new-release-channel-title (mutually exclusive).
@@ -346,7 +349,11 @@ These examples assume you have set the `ABXR_API_TOKEN` in your environment.
346
349
 
347
350
  Basic upload:
348
351
 
349
- `abxr-cli apps upload 123e4567-e89b-12d3-a456-426614174000 /path/to/app.apk --version 1.2.3 --notes "Bug fixes and performance improvements"`
352
+ `abxr-cli apps upload 123e4567-e89b-12d3-a456-426614174000 /path/to/app.apk --version_number 1.2.3 --notes "Bug fixes and performance improvements"`
353
+
354
+ Upload and wait up to 10 minutes for the version to finish processing (useful in CI before running `release_channel_set_version`):
355
+
356
+ `abxr-cli apps upload 123e4567-e89b-12d3-a456-426614174000 /path/to/app.apk --wait --wait_time 600`
350
357
 
351
358
  Upload to an existing release channel:
352
359
 
@@ -95,23 +95,26 @@ These commands manage app-related operations.
95
95
 
96
96
  ##### release_channel_set_version
97
97
  * Usage:
98
- `abxr-cli apps release_channel_set_version app_id [--release_channel_id RELEASE_CHANNEL_ID] [--version_id VERSION_ID]`
98
+ `abxr-cli apps release_channel_set_version app_id --release_channel_id RELEASE_CHANNEL_ID (--version_id VERSION_ID | --bundle_id BUNDLE_ID)`
99
99
  * Positional Argument:
100
100
  * `app_id`: The unique identifier of the app.
101
- * Optional Arguments:
102
- * --release_channel_id: The identifier for the release channel.
101
+ * Arguments:
102
+ * --release_channel_id: The identifier for the release channel (required).
103
103
  * --version_id: The version identifier to set for the channel.
104
- * Description: Assign a specific version to a release channel.
104
+ * --bundle_id: The app bundle identifier to set for the channel. Give either --version_id or --bundle_id, not both.
105
+ * Description: Assign a specific version or app bundle to a release channel. A newly uploaded version can only be assigned once the server has finished processing it; until then this command fails with a 422 validation error. When scripting an upload followed by this command, pass `--wait` to `apps upload` so it returns only once the version is available, or assign the channel during the upload with `--release-channel-id`.
105
106
 
106
107
  ##### upload
107
108
  * Usage:
108
- `abxr-cli apps upload app_id filename [--version VERSION] [--notes NOTES] [--release-channel-id ID | --new-release-channel-title TITLE]`
109
+ `abxr-cli apps upload app_id filename [--version_number VERSION] [--notes NOTES] [--wait] [--wait_time SECONDS] [--release-channel-id ID | --new-release-channel-title TITLE]`
109
110
  * Positional Arguments:
110
111
  * `app_id`: The unique identifier of the app.
111
112
  * `filename`: Local path of the APK/ZIP (apk+obb) file to upload.
112
113
  * Optional Arguments:
113
- * -v, --version: Version number (note that the Uploaded APK itself can override this value).
114
+ * --version_number: Version number (note that the Uploaded APK itself can override this value).
114
115
  * -n, --notes: Release notes for the new version.
116
+ * -w, --wait: After the upload, wait until the server has finished processing the version and it is available. If it is still processing when --wait_time runs out, the command exits with an error (the upload itself is kept). Applies to APK uploads; it has no effect when a ZIP is uploaded as an app bundle.
117
+ * --wait_time: Maximum number of seconds `--wait` waits (default 60). Use 0 to wait with no limit.
115
118
  * --release-channel-id: ID of existing release channel to associate with this version.
116
119
  * --new-release-channel-title: Title for a new release channel to create and associate with this version.
117
120
  * Description: Upload a new version of an app (APK/ZIP only). To upload an app bundle with associated files, use the `app_bundles upload` command. You can optionally associate the upload with a release channel using either --release-channel-id or --new-release-channel-title (mutually exclusive).
@@ -330,7 +333,11 @@ These examples assume you have set the `ABXR_API_TOKEN` in your environment.
330
333
 
331
334
  Basic upload:
332
335
 
333
- `abxr-cli apps upload 123e4567-e89b-12d3-a456-426614174000 /path/to/app.apk --version 1.2.3 --notes "Bug fixes and performance improvements"`
336
+ `abxr-cli apps upload 123e4567-e89b-12d3-a456-426614174000 /path/to/app.apk --version_number 1.2.3 --notes "Bug fixes and performance improvements"`
337
+
338
+ Upload and wait up to 10 minutes for the version to finish processing (useful in CI before running `release_channel_set_version`):
339
+
340
+ `abxr-cli apps upload 123e4567-e89b-12d3-a456-426614174000 /path/to/app.apk --wait --wait_time 600`
334
341
 
335
342
  Upload to an existing release channel:
336
343
 
@@ -77,6 +77,39 @@ class AppsService(ApiService):
77
77
 
78
78
  return response.json()
79
79
 
80
+ def _wait_until_available(self, app_id, version_id, max_wait_time_sec, pbar):
81
+ """Poll until the uploaded version finishes server processing.
82
+
83
+ A max_wait_time_sec of 0 or less waits with no limit. Raises if the
84
+ server reports an error, or if the limit passes before the version is
85
+ available, so callers never mistake a still-processing version for a
86
+ usable one.
87
+ """
88
+ waited_sec = 0
89
+
90
+ while True:
91
+ versions = self.get_all_versions_for_app(app_id)
92
+ version = next((v for v in versions if v['id'] == version_id), None)
93
+ if version is None:
94
+ raise Exception(f"Version {version_id} not found for uploaded app {app_id}.")
95
+
96
+ status = version['status']
97
+ if status == 'available':
98
+ return
99
+ if status == 'error':
100
+ raise Exception(f"Upload failed server processing for version {version_id} of app {app_id}.")
101
+
102
+ if 0 < max_wait_time_sec <= waited_sec:
103
+ raise TimeoutError(
104
+ f"Version {version_id} of app {app_id} was uploaded, but the server was still "
105
+ f"processing it (status '{status}') after {waited_sec} seconds. Raise --wait_time, "
106
+ f"or pass --wait_time 0 to wait with no limit."
107
+ )
108
+
109
+ pbar.set_description(f'Been waiting for upload to complete for {waited_sec} seconds')
110
+ time.sleep(1)
111
+ waited_sec += 1
112
+
80
113
  def upload_file(self, app_id, file_path, version_number, release_notes, silent, wait, max_wait_time_sec=60, app_build_type="standalone", release_channel_id=None, new_release_channel_title=None):
81
114
  file = MultipartFileS3(file_path)
82
115
 
@@ -110,33 +143,8 @@ class AppsService(ApiService):
110
143
 
111
144
  complete_response = self._complete_upload(app_id, version_id, upload_id, key, uploaded_parts, version_number, release_notes)
112
145
 
113
- total_time_sec = 0
114
- wait_indefinitely = max_wait_time_sec <= 0
115
-
116
- if wait_indefinitely:
117
- max_wait_time_sec = 1
118
-
119
- status = None
120
-
121
146
  if wait:
122
- while status != 'available' and total_time_sec < max_wait_time_sec:
123
- versions = self.get_all_versions_for_app(app_id)
124
- version = next((v for v in versions if v['id'] == version_id), None)
125
- if version:
126
- status = version['status']
127
- if status == 'available':
128
- break
129
- elif status == 'error':
130
- raise Exception(f"Upload failed server processing for version {version_id} of app {app_id}.")
131
- else:
132
- raise Exception(f"Version {version_id} not found for uploaded app {app_id}.")
133
-
134
- pbar.set_description(f'Been waiting for upload to complete for {total_time_sec} seconds')
135
- time.sleep(1)
136
- total_time_sec += 1
137
-
138
- if wait_indefinitely:
139
- max_wait_time_sec += 1
147
+ self._wait_until_available(app_id, version_id, max_wait_time_sec, pbar)
140
148
 
141
149
  # Include appBundleId in response if it was created
142
150
  if app_bundle_id:
@@ -84,8 +84,8 @@ def main():
84
84
  create_version_parser.add_argument("filename", help="Local path of the APK/ZIP (apk+obb) to upload", type=str)
85
85
  create_version_parser.add_argument("--version_number", help="Version Number (Uploaded APK can override this value)", type=str)
86
86
  create_version_parser.add_argument("-n", "--notes", help="Release Notes", type=str)
87
- create_version_parser.add_argument("-w", "--wait", help="Wait for the upload to complete", action="store_true")
88
- create_version_parser.add_argument("--wait_time", help="Maximum wait time in seconds for the upload to complete processing", type=int, default=60)
87
+ create_version_parser.add_argument("-w", "--wait", help="Wait until the server has finished processing the upload; exits with an error if it is still processing after --wait_time", action="store_true")
88
+ create_version_parser.add_argument("--wait_time", help="Maximum wait time in seconds for the upload to complete processing (0 waits with no limit)", type=int, default=60)
89
89
 
90
90
  # Release channel options (mutually exclusive)
91
91
  release_channel_group = create_version_parser.add_mutually_exclusive_group()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: abxrcli
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: ArborXR CLI
5
5
  Author-email: Brian Rice <brian@arborxr.com>
6
6
  Description-Content-Type: text/markdown
@@ -111,23 +111,26 @@ These commands manage app-related operations.
111
111
 
112
112
  ##### release_channel_set_version
113
113
  * Usage:
114
- `abxr-cli apps release_channel_set_version app_id [--release_channel_id RELEASE_CHANNEL_ID] [--version_id VERSION_ID]`
114
+ `abxr-cli apps release_channel_set_version app_id --release_channel_id RELEASE_CHANNEL_ID (--version_id VERSION_ID | --bundle_id BUNDLE_ID)`
115
115
  * Positional Argument:
116
116
  * `app_id`: The unique identifier of the app.
117
- * Optional Arguments:
118
- * --release_channel_id: The identifier for the release channel.
117
+ * Arguments:
118
+ * --release_channel_id: The identifier for the release channel (required).
119
119
  * --version_id: The version identifier to set for the channel.
120
- * Description: Assign a specific version to a release channel.
120
+ * --bundle_id: The app bundle identifier to set for the channel. Give either --version_id or --bundle_id, not both.
121
+ * Description: Assign a specific version or app bundle to a release channel. A newly uploaded version can only be assigned once the server has finished processing it; until then this command fails with a 422 validation error. When scripting an upload followed by this command, pass `--wait` to `apps upload` so it returns only once the version is available, or assign the channel during the upload with `--release-channel-id`.
121
122
 
122
123
  ##### upload
123
124
  * Usage:
124
- `abxr-cli apps upload app_id filename [--version VERSION] [--notes NOTES] [--release-channel-id ID | --new-release-channel-title TITLE]`
125
+ `abxr-cli apps upload app_id filename [--version_number VERSION] [--notes NOTES] [--wait] [--wait_time SECONDS] [--release-channel-id ID | --new-release-channel-title TITLE]`
125
126
  * Positional Arguments:
126
127
  * `app_id`: The unique identifier of the app.
127
128
  * `filename`: Local path of the APK/ZIP (apk+obb) file to upload.
128
129
  * Optional Arguments:
129
- * -v, --version: Version number (note that the Uploaded APK itself can override this value).
130
+ * --version_number: Version number (note that the Uploaded APK itself can override this value).
130
131
  * -n, --notes: Release notes for the new version.
132
+ * -w, --wait: After the upload, wait until the server has finished processing the version and it is available. If it is still processing when --wait_time runs out, the command exits with an error (the upload itself is kept). Applies to APK uploads; it has no effect when a ZIP is uploaded as an app bundle.
133
+ * --wait_time: Maximum number of seconds `--wait` waits (default 60). Use 0 to wait with no limit.
131
134
  * --release-channel-id: ID of existing release channel to associate with this version.
132
135
  * --new-release-channel-title: Title for a new release channel to create and associate with this version.
133
136
  * Description: Upload a new version of an app (APK/ZIP only). To upload an app bundle with associated files, use the `app_bundles upload` command. You can optionally associate the upload with a release channel using either --release-channel-id or --new-release-channel-title (mutually exclusive).
@@ -346,7 +349,11 @@ These examples assume you have set the `ABXR_API_TOKEN` in your environment.
346
349
 
347
350
  Basic upload:
348
351
 
349
- `abxr-cli apps upload 123e4567-e89b-12d3-a456-426614174000 /path/to/app.apk --version 1.2.3 --notes "Bug fixes and performance improvements"`
352
+ `abxr-cli apps upload 123e4567-e89b-12d3-a456-426614174000 /path/to/app.apk --version_number 1.2.3 --notes "Bug fixes and performance improvements"`
353
+
354
+ Upload and wait up to 10 minutes for the version to finish processing (useful in CI before running `release_channel_set_version`):
355
+
356
+ `abxr-cli apps upload 123e4567-e89b-12d3-a456-426614174000 /path/to/app.apk --wait --wait_time 600`
350
357
 
351
358
  Upload to an existing release channel:
352
359
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "abxrcli"
7
- version = "1.0.2"
7
+ version = "1.0.3"
8
8
  description = "ArborXR CLI"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Brian Rice", email = "brian@arborxr.com" }]
@@ -6,7 +6,7 @@ from setuptools import setup
6
6
 
7
7
  setup(
8
8
  name = 'abxrcli',
9
- version = '1.0.2',
9
+ version = '1.0.3',
10
10
  packages = ['abxr'],
11
11
  entry_points = {
12
12
  'console_scripts': [
@@ -157,6 +157,52 @@ class TestAppUpload:
157
157
  assert result == {"id": "v1"}
158
158
  assert svc.client.get.call_count == 3
159
159
 
160
+ def _mock_upload_calls(self, svc):
161
+ svc.client.post.side_effect = [
162
+ make_response({"versionId": "v1", "uploadId": "u1", "key": "k1"}),
163
+ make_response([{"partNumber": 1, "presignedUrl": "https://s3/1"}]),
164
+ make_response({"id": "v1"}),
165
+ ]
166
+ svc.client.put.return_value = make_response({}, headers={"ETag": '"e1"'})
167
+
168
+ def test_wait_raises_when_still_processing_at_wait_time(self, mocker):
169
+ """--wait must fail, not report success, when the version never becomes available."""
170
+ self._setup_fake_file(mocker)
171
+ svc = _service(mocker)
172
+ self._mock_upload_calls(svc)
173
+ svc.client.get.return_value = make_response({
174
+ "data": [{"id": "v1", "status": "uploaded"}],
175
+ })
176
+ sleep = mocker.patch("abxr.apps.time.sleep")
177
+
178
+ with pytest.raises(TimeoutError, match=r"v1.*still processing.*'uploaded'.*after 3 seconds"):
179
+ svc.upload_file(
180
+ "app-1", "/fake/path.apk", "1.0.0", "notes",
181
+ silent=True, wait=True, max_wait_time_sec=3,
182
+ )
183
+
184
+ assert sleep.call_count == 3
185
+ # polled at t=0,1,2 and once more at the 3-second limit
186
+ assert svc.client.get.call_count == 4
187
+
188
+ def test_wait_time_zero_waits_with_no_limit(self, mocker):
189
+ self._setup_fake_file(mocker)
190
+ svc = _service(mocker)
191
+ self._mock_upload_calls(svc)
192
+ svc.client.get.side_effect = (
193
+ [make_response({"data": [{"id": "v1", "status": "uploaded"}]})] * 100
194
+ + [make_response({"data": [{"id": "v1", "status": "available"}]})]
195
+ )
196
+ mocker.patch("abxr.apps.time.sleep")
197
+
198
+ result = svc.upload_file(
199
+ "app-1", "/fake/path.apk", "1.0.0", "notes",
200
+ silent=True, wait=True, max_wait_time_sec=0,
201
+ )
202
+
203
+ assert result == {"id": "v1"}
204
+ assert svc.client.get.call_count == 101
205
+
160
206
  def test_wait_false_skips_status_polling(self, mocker):
161
207
  self._setup_fake_file(mocker)
162
208
  svc = _service(mocker)
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes