splunk-soar-sdk 3.2.0__py3-none-any.whl → 3.2.2__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.
@@ -5,9 +5,11 @@ from datetime import datetime, UTC
5
5
  from pathlib import Path
6
6
  from pprint import pprint
7
7
 
8
+ from packaging.specifiers import SpecifierSet
9
+
8
10
  from soar_sdk.app import App
9
11
  from soar_sdk.cli.path_utils import context_directory
10
- from soar_sdk.compat import UPDATE_TIME_FORMAT
12
+ from soar_sdk.compat import UPDATE_TIME_FORMAT, PythonVersion
11
13
  from soar_sdk.meta.adapters import TOMLDataAdapter
12
14
  from soar_sdk.meta.app import AppMeta
13
15
  from soar_sdk.meta.dependencies import UvLock
@@ -24,6 +26,22 @@ class ManifestProcessor:
24
26
  self.manifest_path = manifest_path
25
27
  self.project_context = Path(project_context)
26
28
 
29
+ def get_target_python_versions(self) -> list[str]:
30
+ """Get the intersection of project requires-python and SDK-supported versions."""
31
+ sdk_versions = [str(v) for v in PythonVersion.all()]
32
+
33
+ with open(self.project_context / "pyproject.toml") as f:
34
+ requires_python = toml.load(f).get("project", {}).get("requires-python", "")
35
+
36
+ if not requires_python:
37
+ return sdk_versions
38
+
39
+ # Use packaging.specifiers to check version compatibility
40
+ specifier_set = SpecifierSet(requires_python)
41
+ compatible = [version for version in sdk_versions if version in specifier_set]
42
+
43
+ return compatible
44
+
27
45
  def build(self, is_sdk_locally_built: bool = False) -> AppMeta:
28
46
  """Builds full AppMeta information including actions and other extra fields."""
29
47
  app_meta: AppMeta = self.load_toml_app_meta()
@@ -41,8 +59,11 @@ class ManifestProcessor:
41
59
  dep for dep in dependencies if dep.name != "splunk-soar-sdk"
42
60
  ]
43
61
 
62
+ # Get target Python versions from requires-python constraint
63
+ target_python_versions = self.get_target_python_versions()
64
+
44
65
  app_meta.pip313_dependencies, app_meta.pip314_dependencies = (
45
- uv_lock.resolve_dependencies(dependencies)
66
+ uv_lock.resolve_dependencies(dependencies, target_python_versions)
46
67
  )
47
68
 
48
69
  if app.webhook_meta is not None:
@@ -277,9 +277,7 @@ class UvPackage(BaseModel):
277
277
  for abi in abi_precedence:
278
278
  abi_wheels = [wheel for wheel in self.wheels if abi in wheel.abi_tags]
279
279
  for python in python_precedence:
280
- python_wheels = [
281
- wheel for wheel in abi_wheels if python in wheel.python_tags
282
- ]
280
+ python_wheels = self._filter_python_wheels(abi_wheels, python, abi)
283
281
  for platform in platform_precedence:
284
282
  platform_wheels = [
285
283
  wheel
@@ -293,6 +291,54 @@ class UvPackage(BaseModel):
293
291
  f"Could not find a suitable wheel for {self.name=}, {self.version=}, {abi_precedence=}, {python_precedence=}, {platform_precedence=}"
294
292
  )
295
293
 
294
+ def _filter_python_wheels(
295
+ self, wheels: list[UvWheel], target_python: str, abi: str
296
+ ) -> list[UvWheel]:
297
+ """Filter and sort wheels by Python version compatibility.
298
+
299
+ For abi3 wheels, prefers the highest compatible minimum version
300
+ (e.g., cp311-abi3 over cp38-abi3 for Python 3.13).
301
+ """
302
+ compatible = [
303
+ wheel
304
+ for wheel in wheels
305
+ if self._is_python_compatible(wheel, target_python, abi)
306
+ ]
307
+
308
+ # For abi3 wheels, prefer highest minimum version (closest to target)
309
+ if abi == "abi3" and compatible:
310
+ compatible = sorted(
311
+ compatible,
312
+ key=lambda w: max(
313
+ (int(tag[2:]) for tag in w.python_tags if tag.startswith("cp")),
314
+ default=0,
315
+ ),
316
+ reverse=True,
317
+ )
318
+
319
+ return compatible
320
+
321
+ def _is_python_compatible(
322
+ self, wheel: UvWheel, target_python: str, abi: str
323
+ ) -> bool:
324
+ """Check if a wheel is compatible with the target Python version.
325
+
326
+ For abi3 wheels, the Python tag indicates minimum version (e.g., cp311-abi3 works with Python ≥3.11).
327
+ For non-abi3 wheels, exact tag matching is required.
328
+ """
329
+ if target_python in wheel.python_tags:
330
+ return True
331
+
332
+ # For abi3 wheels, check if target >= minimum version (e.g., cp313 >= cp311)
333
+ if abi == "abi3":
334
+ return any(
335
+ int(tag[2:]) <= int(target_python[2:])
336
+ for tag in wheel.python_tags
337
+ if tag.startswith("cp") and target_python.startswith("cp")
338
+ )
339
+
340
+ return False
341
+
296
342
  _manylinux_precedence: ClassVar[list[str]] = [
297
343
  "_2_28", # glibc 2.28, latest stable version, supports Ubuntu 18.10+ and RHEL/Oracle 8+
298
344
  "_2_17", # glibc 2.17, LTS-ish, supports Ubuntu 13.10+ and RHEL/Oracle 7+
@@ -450,23 +496,35 @@ class UvLock(BaseModel):
450
496
  @staticmethod
451
497
  def resolve_dependencies(
452
498
  packages: list[UvPackage],
499
+ python_versions: list[str] | None = None,
453
500
  ) -> tuple[DependencyList, DependencyList]:
454
- """Resolve the dependencies for the given packages."""
455
- py313_wheels: list[DependencyWheel] = []
456
- py314_wheels: list[DependencyWheel] = []
501
+ """Resolve the dependencies for the given packages.
502
+
503
+ Args:
504
+ packages: List of packages to resolve dependencies for.
505
+ python_versions: List of Python versions to resolve for (e.g., ["3.13", "3.14"]).
506
+ If None, defaults to ["3.13", "3.14"] for backwards compatibility.
507
+
508
+ Returns:
509
+ Tuple of (py313_dependencies, py314_dependencies).
510
+ """
511
+ python_versions = python_versions or ["3.13", "3.14"]
512
+ resolve_both = len(python_versions) == 2
513
+
514
+ py313_wheels, py314_wheels = [], []
457
515
 
458
516
  for package in packages:
459
- wheel_313 = package.resolve_py313()
460
- wheel_314 = package.resolve_py314()
461
-
462
- if wheel_313 == wheel_314:
463
- wheel_313.add_platform_prefix("shared")
464
- wheel_314.add_platform_prefix("shared")
465
- else:
466
- wheel_313.add_platform_prefix("python313")
467
- wheel_314.add_platform_prefix("python314")
468
-
469
- py313_wheels.append(wheel_313)
470
- py314_wheels.append(wheel_314)
517
+ wheel_313 = package.resolve_py313() if "3.13" in python_versions else None
518
+ wheel_314 = package.resolve_py314() if "3.14" in python_versions else None
519
+
520
+ prefix = "shared" if not resolve_both or wheel_313 == wheel_314 else None
521
+
522
+ if wheel_313:
523
+ wheel_313.add_platform_prefix(prefix or "python313")
524
+ py313_wheels.append(wheel_313)
525
+
526
+ if wheel_314:
527
+ wheel_314.add_platform_prefix(prefix or "python314")
528
+ py314_wheels.append(wheel_314)
471
529
 
472
530
  return DependencyList(wheel=py313_wheels), DependencyList(wheel=py314_wheels)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: splunk-soar-sdk
3
- Version: 3.2.0
3
+ Version: 3.2.2
4
4
  Summary: The official framework for developing and testing Splunk SOAR Apps
5
5
  Project-URL: Homepage, https://github.com/phantomcyber/splunk-soar-sdk
6
6
  Project-URL: Documentation, https://github.com/phantomcyber/splunk-soar-sdk
@@ -38,7 +38,7 @@ soar_sdk/cli/init/cli.py,sha256=LWwGb_N5KPpKjnk8Kn3IppSrGsHQb65CvDn2NXPokAE,1461
38
38
  soar_sdk/cli/manifests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
39
  soar_sdk/cli/manifests/cli.py,sha256=cly5xVdj4bBIdZVMQPIWTXRgUfd1ON3qKO-76Fwql18,524
40
40
  soar_sdk/cli/manifests/deserializers.py,sha256=TjcmPvcfr1auGkf3hBRwjVc0dSuuDNmH5jMOqXHz27s,16515
41
- soar_sdk/cli/manifests/processors.py,sha256=uHWEjY6tu3TZ680SbBbmupwtLhINI6lwdmEsfw4Bkw0,3912
41
+ soar_sdk/cli/manifests/processors.py,sha256=PbzARZvMUCkQrrzjRVVOsb0dTV_u5BMXx52e3t0V9-w,4797
42
42
  soar_sdk/cli/manifests/serializers.py,sha256=hSfOcBNhv7s437A7t5BM1NXG5dfjKmh_xbHXQTuBklA,3632
43
43
  soar_sdk/cli/package/cli.py,sha256=8AWItAAXzfjJMRLwDIRbrN9cQhy7clBX7WrOmdcGClw,9499
44
44
  soar_sdk/cli/package/utils.py,sha256=zZmpWg76Vb3rtGn28aPhPHt1JUWR6eIByU6DTTRC3ng,1584
@@ -62,7 +62,7 @@ soar_sdk/meta/actions.py,sha256=YadG8Zkc0SWmcG5-Dj4NyWlYYAh4CyJksLYp_GmNZNM,1818
62
62
  soar_sdk/meta/adapters.py,sha256=KjSYIUtkCz2eesA_vhsNCjfi5C-Uz71tbSuDIjhuB8U,1112
63
63
  soar_sdk/meta/app.py,sha256=eZlM8GIY1B_o-RzJrRNCNVEQSx0sFupxZqCM7sIWGv4,2777
64
64
  soar_sdk/meta/datatypes.py,sha256=piR-oBVAATiRciXSdVE7XaqjUZTgSaOvTEqcOcNvCS0,795
65
- soar_sdk/meta/dependencies.py,sha256=DZr38K_1rKh7OzlIb5nLbdDH8xOHArr48H8Ra6rcB4k,18259
65
+ soar_sdk/meta/dependencies.py,sha256=tU-73gXUCCh_vCU8RD5lBDdJV4fXlrFSmtNzw6GXeIE,20446
66
66
  soar_sdk/meta/webhooks.py,sha256=E5pdoD9j7FDeM2DBTO2h9Yw6-5flzp-NfhM_M1oPAUU,1216
67
67
  soar_sdk/models/__init__.py,sha256=ql7RRFAxmSdzU-IsoU1OFQ53E6WxZJ7YQQAhHl4Ssbk,380
68
68
  soar_sdk/models/artifact.py,sha256=OlYp150sf9sYvTz6tC7PaYV1qbBvQYrz1bXmC2xNj8Q,1086
@@ -100,8 +100,8 @@ soar_sdk/views/components/pie_chart.py,sha256=LVTeHVJN6nf2vjUs9y7PDBhS0U1fKW750l
100
100
  soar_sdk/webhooks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
101
101
  soar_sdk/webhooks/models.py,sha256=PG9SDs5xXqtFndm5C8AsJOTYXU5v_UTY7SpYosWT_CA,4542
102
102
  soar_sdk/webhooks/routing.py,sha256=MnzbnIDy2uG_5mJzsTeX-NsE6QYvzyqEGbHmEFj-DG8,6900
103
- splunk_soar_sdk-3.2.0.dist-info/METADATA,sha256=sL-PyINCXBsGJ-bPeHqiXCshp4IeLhs4HGHT171Uucs,7334
104
- splunk_soar_sdk-3.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
105
- splunk_soar_sdk-3.2.0.dist-info/entry_points.txt,sha256=CgBjo2ZWpYNkt9TgvToL26h2Tg1yt8FbvYTb5NVgNuc,51
106
- splunk_soar_sdk-3.2.0.dist-info/licenses/LICENSE,sha256=gNCGrGhrSQb1PUzBOByVUN1tvaliwLZfna-QU2r2hQ8,11345
107
- splunk_soar_sdk-3.2.0.dist-info/RECORD,,
103
+ splunk_soar_sdk-3.2.2.dist-info/METADATA,sha256=AH5_rxuydArLcHkhpueEJbpJuOgXfl4d8zVh9YCZ3mA,7334
104
+ splunk_soar_sdk-3.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
105
+ splunk_soar_sdk-3.2.2.dist-info/entry_points.txt,sha256=CgBjo2ZWpYNkt9TgvToL26h2Tg1yt8FbvYTb5NVgNuc,51
106
+ splunk_soar_sdk-3.2.2.dist-info/licenses/LICENSE,sha256=gNCGrGhrSQb1PUzBOByVUN1tvaliwLZfna-QU2r2hQ8,11345
107
+ splunk_soar_sdk-3.2.2.dist-info/RECORD,,