UncountablePythonSDK 0.0.14__py3-none-any.whl → 0.0.16__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.

Potentially problematic release.


This version of UncountablePythonSDK might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: UncountablePythonSDK
3
- Version: 0.0.14
3
+ Version: 0.0.16
4
4
  Summary: Uncountable SDK
5
5
  Project-URL: Homepage, https://github.com/uncountableinc/uncountable-python-sdk
6
6
  Project-URL: Repository, https://github.com/uncountableinc/uncountable-python-sdk.git
@@ -71,7 +71,7 @@ uncountable/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
71
71
  uncountable/core/__init__.py,sha256=GCXRRhhYv-yKzqKjAij7GcNiOr90BBbgdhhpusWtmUc,100
72
72
  uncountable/core/client.py,sha256=jcJBGwe31fOqfGiUJzW_KMcfE0hax55jgVVliALBNLQ,4160
73
73
  uncountable/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
- uncountable/integration/construct_client.py,sha256=fRIoxkK6HUf2HVAJkFieMvk4fAGOCgFD9y99brgXWdQ,912
74
+ uncountable/integration/construct_client.py,sha256=r6M5pnIO0fKcjf5d_AREPtWZ6AkWgcjkdu_jHQEYlT8,1084
75
75
  uncountable/integration/cron.py,sha256=TIPqMPMSMtMJTu4aXwLf6QY-OLrpmyITLDp48UIr4Ok,919
76
76
  uncountable/integration/entrypoint.py,sha256=sPtUeKJEivf0iqY-H4LHWhyeUHMZK_U4CrDj1Kw8Ld0,1395
77
77
  uncountable/integration/job.py,sha256=5QuCjeze9vtEirntP9P9hDD3LVrBn5pApDWh2IZeEiY,817
@@ -80,7 +80,7 @@ uncountable/integration/types.py,sha256=n9idu2_qHOA5CQdE6NK8HS6aZ8ugTZKTfTTnm4sy
80
80
  uncountable/integration/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
81
81
  uncountable/integration/db/connect.py,sha256=iI9e8a2hfbFP-dvH0MGLsrG-RpM0dHKCL-oCLkah9hs,181
82
82
  uncountable/integration/executors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
83
- uncountable/integration/executors/script_executor.py,sha256=l_mniGlS9Ni6FdmspN7bvMWVocOaXKCo8FM9SFW8n8c,600
83
+ uncountable/integration/executors/script_executor.py,sha256=6oMPAFe0PUdqt76e8jMi4vXszGVsVHLULob7Qbl3o38,816
84
84
  uncountable/types/__init__.py,sha256=SbBDFhHu5iqnvnYjWCBOkjg3_mXuaBHEGfnq021wfHw,3873
85
85
  uncountable/types/base.py,sha256=7yMC3sCQ13wd92896Ga2XbZffCqq98SKv09rFGb1ulg,2682
86
86
  uncountable/types/calculations.py,sha256=16J-KKMp-I8ZQUkYNmKCHfAn6DGb99cFinALcDIdGHY,562
@@ -139,7 +139,7 @@ uncountable/types/api/recipes/get_recipe_output_metadata.py,sha256=L9s2ykPP4pd02
139
139
  uncountable/types/api/recipes/get_recipes_data.py,sha256=dOKokz6rJp3AiqNrF8rAZFlmJSs3ejdNIJhwKw0Utr0,5317
140
140
  uncountable/types/api/recipes/set_recipe_inputs.py,sha256=sHEwPocBucWRnnoX7nbNaFqdflxFkqdjuVydNezqluY,1326
141
141
  uncountable/types/api/recipes/set_recipe_outputs.py,sha256=QYq39TNchQ80ET1C77OE9fwhbu_HmIoEDmrQJHkkCu0,1609
142
- UncountablePythonSDK-0.0.14.dist-info/METADATA,sha256=K3rzjPqELhDb7eb2I8e9qI2B3EYiDfA_ke3XHb2vsCg,1298
143
- UncountablePythonSDK-0.0.14.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
144
- UncountablePythonSDK-0.0.14.dist-info/top_level.txt,sha256=8ga1DCSWt4Uc_XJ5cR0QrDQuyoeo2uoSzaAJdQT2KBo,36
145
- UncountablePythonSDK-0.0.14.dist-info/RECORD,,
142
+ UncountablePythonSDK-0.0.16.dist-info/METADATA,sha256=XEMklRrImLVb1W7XuCzBmUq-TS3GyYMs4tQc-mfCQb0,1298
143
+ UncountablePythonSDK-0.0.16.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
144
+ UncountablePythonSDK-0.0.16.dist-info/top_level.txt,sha256=8ga1DCSWt4Uc_XJ5cR0QrDQuyoeo2uoSzaAJdQT2KBo,36
145
+ UncountablePythonSDK-0.0.16.dist-info/RECORD,,
@@ -8,13 +8,18 @@ from uncountable.integration.types import (
8
8
  )
9
9
 
10
10
 
11
- def construct_uncountable_client(
12
- profile_meta: ProfileMetadata
13
- ) -> Client:
11
+ def _get_env_var(name: str) -> str:
12
+ value = os.getenv(name)
13
+ if value is None:
14
+ raise Exception(f"environment variable {name} is missing")
15
+ return value
16
+
17
+
18
+ def construct_uncountable_client(profile_meta: ProfileMetadata) -> Client:
14
19
  match profile_meta.auth_retrieval:
15
20
  case AuthRetrievalEnv():
16
- api_id = os.getenv(f"UNC_PROFILE_{profile_meta.name.upper()}_API_ID")
17
- api_secret_key = os.getenv(
21
+ api_id = _get_env_var(f"UNC_PROFILE_{profile_meta.name.upper()}_API_ID")
22
+ api_secret_key = _get_env_var(
18
23
  f"UNC_PROFILE_{profile_meta.name.upper()}_API_SECRET_KEY"
19
24
  )
20
25
 
@@ -1,18 +1,19 @@
1
1
 
2
-
2
+ import os
3
3
  import importlib
4
4
  import inspect
5
5
  from uncountable.integration.job import Job
6
- from uncountable.integration.types import JobExecutorScript
6
+ from uncountable.integration.types import JobExecutorScript, ProfileMetadata
7
7
 
8
8
 
9
- def resolve_script_executor(executor: JobExecutorScript) -> type[Job]:
10
- job_module = importlib.import_module(executor.import_path)
9
+ def resolve_script_executor(executor: JobExecutorScript, profile_metadata: ProfileMetadata) -> type[Job]:
10
+ job_module_path = ".".join([os.environ["UNC_PROFILES_MODULE"], profile_metadata.name, executor.import_path])
11
+ job_module = importlib.import_module(job_module_path)
11
12
  found_jobs: list[type[Job]] = []
12
13
  for _, job_class in inspect.getmembers(job_module, inspect.isclass):
13
- if Job in job_class.__bases__:
14
+ if getattr(job_class, "_unc_job_registered", False):
14
15
  found_jobs.append(job_class())
15
16
  assert (
16
17
  len(found_jobs) == 1
17
- ), f"expected exactly one job class in {executor.import_path}"
18
+ ), f"expected exactly one job class in {executor.import_path}, found {len(found_jobs)}"
18
19
  return found_jobs[0]