sprocket-systems.coda.sdk 2.0.5__tar.gz → 2.0.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sprocket-systems.coda.sdk
3
- Version: 2.0.5
3
+ Version: 2.0.6
4
4
  Summary: The Coda SDK provides a Python interface to define Coda workflows, create jobs and run them.
5
5
  Keywords: python,coda,sdk
6
6
  Author-Email: Sprocket Systems <support@sprocket.systems>
@@ -9,13 +9,10 @@ License-File: LICENSE
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.7
14
- Classifier: Programming Language :: Python :: 3.8
15
- Classifier: Programming Language :: Python :: 3.9
16
- Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
17
14
  Project-URL: Documentation, https://v2.coda.sprocket.systems/docs/sdks/python/
18
- Requires-Python: >=3.7
15
+ Requires-Python: >=3.11
19
16
  Requires-Dist: requests
20
17
  Requires-Dist: soundfile>=0.13.1
21
18
  Description-Content-Type: text/markdown
@@ -5,7 +5,7 @@ description = "The Coda SDK provides a Python interface to define Coda workflows
5
5
  authors = [
6
6
  { name = "Sprocket Systems", email = "support@sprocket.systems" },
7
7
  ]
8
- requires-python = ">=3.7"
8
+ requires-python = ">=3.11"
9
9
  readme = "PYPI_README.md"
10
10
  license = "LicenseRef-Tomorrow-Open-Source-Technology-License-1.0"
11
11
  license-files = [
@@ -20,17 +20,14 @@ classifiers = [
20
20
  "Development Status :: 5 - Production/Stable",
21
21
  "Intended Audience :: Developers",
22
22
  "Topic :: Software Development :: Libraries :: Python Modules",
23
- "Programming Language :: Python :: 3",
24
- "Programming Language :: Python :: 3.7",
25
- "Programming Language :: Python :: 3.8",
26
- "Programming Language :: Python :: 3.9",
27
- "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
28
25
  ]
29
26
  dependencies = [
30
27
  "requests",
31
28
  "soundfile>=0.13.1",
32
29
  ]
33
- version = "2.0.5"
30
+ version = "2.0.6"
34
31
 
35
32
  [project.urls]
36
33
  Documentation = "https://v2.coda.sprocket.systems/docs/sdks/python/"
@@ -55,3 +52,8 @@ excludes = [
55
52
  "dev",
56
53
  "utilities",
57
54
  ]
55
+
56
+ [dependency-groups]
57
+ dev = [
58
+ "pydoc-markdown>=4.8.2",
59
+ ]
@@ -1,5 +1,5 @@
1
1
  # The versions below will be replaced automatically in CI.
2
2
  # You do not need to modify any of the versions below.
3
- __version__ = "2.0.5"
3
+ __version__ = "2.0.6"
4
4
  CODA_APP_SUITE_VERSION = "+coda-2.0.12"
5
5
  FINAL_VERSION = __version__ + CODA_APP_SUITE_VERSION
@@ -298,12 +298,13 @@ class Essence:
298
298
 
299
299
  @staticmethod
300
300
  def essences_from_files(
301
- files: List,
301
+ files: list,
302
302
  io_location_id: str | None = None,
303
- file_info: Dict | None = None,
303
+ file_info: dict | None = None,
304
304
  program: str = "",
305
- forced_frame_rate: str | None = None
306
- ) -> List["Essence"]:
305
+ forced_frame_rate: str | None = None,
306
+ no_file_scan: bool = False
307
+ ) -> list["Essence"]:
307
308
  """Create a list of CodaEssence objects from files.
308
309
 
309
310
  This method inspects local files using the 'coda inspect' command-line tool
@@ -328,6 +329,7 @@ class Essence:
328
329
  program (str, optional): The program identifier to assign to the essences.
329
330
  Defaults to "".
330
331
  forced_frame_rate (str, optional): Specify the frame rate to calculate the FFOA and LFOA
332
+ no_file_scan (bool, optional): Do not use Coda CLI to scan files for metadata
331
333
 
332
334
  Raises:
333
335
  ValueError: If `files` is not populated with a list of file paths.
@@ -355,7 +357,7 @@ class Essence:
355
357
 
356
358
  absfiles = [str(Path(f).resolve()) for f in local_files]
357
359
  codaexe = shutil.which("coda") or os.getenv(ENV_CODA_CLI_EXE)
358
- if not codaexe or os.getenv(ENV_NO_CODA_EXE) is not None:
360
+ if not codaexe or os.getenv(ENV_NO_CODA_EXE) is not None or no_file_scan is True:
359
361
  if not file_info:
360
362
  raise ValueError("Coda CLI not found and file_info was not provided for manual creation.")
361
363
 
@@ -214,9 +214,16 @@ class JobPayloadBuilder:
214
214
  JobPayloadBuilder: The builder instance for fluent chaining.
215
215
 
216
216
  Raises:
217
+ ValueError: If no essences have been added yet.
217
218
  ValueError: If any essence has an incompatible format.
218
219
 
219
220
  """
221
+ if not self._essences:
222
+ raise ValueError(
223
+ "Cannot force imax5. No essences have been added. "
224
+ "Call with_essences() before using this method."
225
+ )
226
+
220
227
  incompatible_formats = [
221
228
  essence.payload["definition"]["format"]
222
229
  for essence in self._essences
@@ -242,7 +249,16 @@ class JobPayloadBuilder:
242
249
  Returns:
243
250
  JobPayloadBuilder: The builder instance for fluent chaining.
244
251
 
252
+ Raises:
253
+ ValueError: If no essences have been added yet.
254
+
245
255
  """
256
+ if not self._essences:
257
+ raise ValueError(
258
+ "Cannot set input language. No essences have been added. "
259
+ "Call with_essences() before using this method."
260
+ )
261
+
246
262
  for essence in self._essences:
247
263
  essence.payload["definition"]["language"] = language.value
248
264
  return self
@@ -259,7 +275,16 @@ class JobPayloadBuilder:
259
275
  Returns:
260
276
  JobPayloadBuilder: The builder instance for fluent chaining.
261
277
 
278
+ Raises:
279
+ ValueError: If no essences have been added yet.
280
+
262
281
  """
282
+ if not self._essences:
283
+ raise ValueError(
284
+ "Cannot set program for type. No essences have been added. "
285
+ "Call with_essences() before using this method."
286
+ )
287
+
263
288
  for essence in self._essences:
264
289
  if type in essence.payload["definition"]["type"]:
265
290
  essence.payload["definition"]["program"] = program
@@ -277,7 +302,16 @@ class JobPayloadBuilder:
277
302
  Returns:
278
303
  JobPayloadBuilder: The builder instance for fluent chaining.
279
304
 
305
+ Raises:
306
+ ValueError: If no essences have been added yet.
307
+
280
308
  """
309
+ if not self._essences:
310
+ raise ValueError(
311
+ "Cannot set program for format. No essences have been added. "
312
+ "Call with_essences() before using this method."
313
+ )
314
+
281
315
  for essence in self._essences:
282
316
  if format == essence.payload["definition"]["format"]:
283
317
  essence.payload["definition"]["program"] = program
@@ -292,7 +326,16 @@ class JobPayloadBuilder:
292
326
  Returns:
293
327
  JobPayloadBuilder: The builder instance for fluent chaining.
294
328
 
329
+ Raises:
330
+ ValueError: If no essences have been added yet.
331
+
295
332
  """
333
+ if not self._essences:
334
+ raise ValueError(
335
+ "Cannot set unique program. No essences have been added. "
336
+ "Call with_essences() before using this method."
337
+ )
338
+
296
339
  for essence in self._essences:
297
340
  essence.payload["definition"]["program"] = program
298
341
  return self
@@ -168,7 +168,7 @@ class Preset:
168
168
 
169
169
  @staticmethod
170
170
  def get_io_location_id_by_name(io_location_name: str) -> str:
171
- """Get an IO Location ID by its name.
171
+ """Get an IO Location ID by its name. Requires Org Admin/Owner API token.
172
172
 
173
173
  Args:
174
174
  io_location_name (str): The name of the IO location to search for.
@@ -213,3 +213,27 @@ class Preset:
213
213
  raise ValueError(f"Multiple workflows found with name '{workflow_name}': {[w['id'] for w in matches]}")
214
214
 
215
215
  return matches[0]
216
+
217
+ @staticmethod
218
+ def get_naming_convention_by_name(naming_convention_name: str) -> dict:
219
+ """Get a naming convention by its name.
220
+
221
+ Args:
222
+ naming_convention_name (str): The name of the naming convention to search for.
223
+
224
+ Returns:
225
+ dict: The complete naming_convention object.
226
+
227
+ Raises:
228
+ ValueError: If no naming convention with the given name is found, or if multiple match.
229
+
230
+ """
231
+ naming_conventions = Preset.get_presets(PresetType.NAMING)
232
+ matches = [n for n in naming_conventions if n["name"] == naming_convention_name]
233
+
234
+ if len(matches) == 0:
235
+ raise ValueError(f"No naming convention found with name '{naming_convention_name}'")
236
+ if len(matches) > 1:
237
+ raise ValueError(f"Multiple naming conventions found with name '{naming_convention_name}': {[n['id'] for n in matches]}")
238
+
239
+ return matches[0]["convention_data"]