UncountablePythonSDK 0.0.40__py3-none-any.whl → 0.0.41__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.40
3
+ Version: 0.0.41
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
@@ -22,13 +22,14 @@ pkgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  pkgs/argument_parser/__init__.py,sha256=CsQ6QoPKSLLRVl-z6URAmPkiUL9ZPZoV4rJHgy_-RjA,385
23
23
  pkgs/argument_parser/_is_enum.py,sha256=Gw6jJa8nBwYGqXwwCZbSnWL8Rvr5alkg5lSVAqXtOZM,257
24
24
  pkgs/argument_parser/_is_namedtuple.py,sha256=Rjc1bKanIPPogl3qG5JPBxglG1TqWYOo1nxxhBASQWY,265
25
- pkgs/argument_parser/argument_parser.py,sha256=pcU4IhgFkea-I6PhHUex43BoVaQvnoRV-Mw3qOqCdBQ,17274
25
+ pkgs/argument_parser/argument_parser.py,sha256=wNGidf80hO0PrPq2zC6NPQXm3Ia_qbrhlsiCXtGIETY,17272
26
26
  pkgs/argument_parser/case_convert.py,sha256=NuJLJUJRbyVb6_Slen4uqaStEHbcOS1d-hBBfDrrw-c,605
27
27
  pkgs/serialization/__init__.py,sha256=LifasRW0a50A3qRFmo2bf3FQ6TXhZWOTz2-CVTgPjcQ,753
28
28
  pkgs/serialization/missing_sentry.py,sha256=aM_9KxbCk9dVvXvcOKgkIQBqFWvLhv8QlIUCiuFEXMo,806
29
29
  pkgs/serialization/opaque_key.py,sha256=FIfXEE0DA1U8R_taFbQ1RCoTSgehrPjP06-qvo-GeNQ,177
30
30
  pkgs/serialization/serial_class.py,sha256=r0hrQdIbJA_X0W0_jKEVrxi_JzVRT9qHCjsUgGu3cCI,5290
31
31
  pkgs/serialization/serial_union.py,sha256=z8Ptj4bVHyb1ROfg0UPTwZ6Ef6iXLr0YJfAH5o_PU9A,2601
32
+ pkgs/serialization/yaml.py,sha256=t-31FS0pL1YbhfspK88iQEGa1WDn60Fw16CpoLSClJM,1453
32
33
  pkgs/serialization_util/__init__.py,sha256=MVKqHTUl2YnWZAFG9xCxu1SgmkQ5xPofrAGlYg6h7rI,330
33
34
  pkgs/serialization_util/_get_type_for_serialization.py,sha256=dW5_W9MFd6wgWfW5qlWork-GBb-QFLtiOZkjk2Zqn2M,1177
34
35
  pkgs/serialization_util/convert_to_snakecase.py,sha256=H2BAo5ZdcCDN77RpLb-uP0s7-FQ5Ukwnsd3VYc1vD0M,583
@@ -38,14 +39,14 @@ pkgs/strenum_compat/strenum_compat.py,sha256=uOUAgpYTjHs1MX8dG81jRlyTkt3KNbkV_25
38
39
  pkgs/type_spec/__init__.py,sha256=h5DmJTca4QVV10sZR1x0-MlkZfuGYDfapR3zHvXfzto,19
39
40
  pkgs/type_spec/__main__.py,sha256=5bJaX9Y_-FavP0qwzhk-z-V97UY7uaezJTa1zhO_HHQ,1048
40
41
  pkgs/type_spec/builder.py,sha256=xQcY2HcQTI2FSOMycgx3yD23_Oz3_LfWdyW65pDaHoc,46667
41
- pkgs/type_spec/config.py,sha256=INfEiDcUsZFUKasHprsE6i33siPB0RnfmTKOsWcGnQ8,5043
42
+ pkgs/type_spec/config.py,sha256=IQyo2Vj11uNt7_d6jQxvominAOU-oPB8ldEmuGzJLpU,4644
42
43
  pkgs/type_spec/emit_io_ts.py,sha256=Ghd8XYqyNYldHQDepwa9GLfHXcoi48ztBw84K28ETic,5707
43
- pkgs/type_spec/emit_open_api.py,sha256=NVVXAvjPHC_MPqch_SMY6klj3kPnckOa7fJsb-ZsFTs,24371
44
+ pkgs/type_spec/emit_open_api.py,sha256=8BTZpiQlD628WoFsjDVzRdmM0ZBfMP19QSJOOcdZoLQ,24397
44
45
  pkgs/type_spec/emit_open_api_util.py,sha256=9tWLMT6NTeCa2caO8DdWo6aYoi0b4AEFiAXNaaQKJIs,2373
45
46
  pkgs/type_spec/emit_python.py,sha256=djF_nUs0v3c5NI8BJjOj0gbLtf_PgbMgk5CCgvh2aPg,46469
46
47
  pkgs/type_spec/emit_typescript.py,sha256=cdr5h8N70PuwORcvhURUujzwH9r1LVwJB8V2EoipGkw,17917
47
48
  pkgs/type_spec/emit_typescript_util.py,sha256=sR7ys3Ilnh6SQiXJbfYk4pxfOu0bDjbUFTEYEW-ud6c,863
48
- pkgs/type_spec/load_types.py,sha256=xEHwdB_miR3vNs161Oy1luafE0VC-yk9-utAyCJmbEo,3629
49
+ pkgs/type_spec/load_types.py,sha256=BOLyndtxPqqhUqZAh-lIbN5IZBaW_m-bdYpKGsbPyXM,3654
49
50
  pkgs/type_spec/open_api_util.py,sha256=IGh-_snGPST_P_8FdYtO8MTEa9PUxRW6Rzg9X9EgQik,7114
50
51
  pkgs/type_spec/test.py,sha256=4ueujBq-pEgnX3Z69HyPmD-bullFXmpixcpVzfOkhP4,489
51
52
  pkgs/type_spec/util.py,sha256=6m6MPfY-SwjyZf2FWQKclswWB5o7gcdd-3tdpViPYOQ,4844
@@ -57,7 +58,7 @@ pkgs/type_spec/parts/base.ts.prepart,sha256=2FJJvpg2olCcavxj0nbYWdwKl6KeScour2Jj
57
58
  pkgs/type_spec/type_info/__main__.py,sha256=pmVjVqXyVh8vKTNCTFgz80Sg74C5BKToP3E6GS-X_So,857
58
59
  pkgs/type_spec/type_info/emit_type_info.py,sha256=7FtMm_WOhxoT8Hy2DDorexIccwCNVZ9mJTBURD8l9Rk,13282
59
60
  pkgs/type_spec/value_spec/__init__.py,sha256=Z-grlcZtxAfEXhPHsK0nD7PFLGsv4eqvunaPN7_TA84,83
60
- pkgs/type_spec/value_spec/__main__.py,sha256=-9L5pXYx02plnTetqNknaUZPieLRtzbyWdZDT6B-cWA,8294
61
+ pkgs/type_spec/value_spec/__main__.py,sha256=6bzP85p_Cm4bPp5tXz8D_4p64wMn5SKsXC7SqSZquYc,8318
61
62
  pkgs/type_spec/value_spec/convert_type.py,sha256=SAYyEV6orQJJbkXSE4hhtOQJ2vKUXJCKPeYPrB8G9oA,2272
62
63
  pkgs/type_spec/value_spec/emit_python.py,sha256=rjg6LIGYdaagrZ19XpDfW_Z7LPNwCMDceBje5dsMFbw,6959
63
64
  pkgs/type_spec/value_spec/types.py,sha256=a2zxbbCRWepY1l8OtjeCDKgBKFPFHVgV99oP6pTtaro,441
@@ -70,9 +71,9 @@ uncountable/core/file_upload.py,sha256=t4cutIFB5rNN2qVCx3H0HotSjCSJSxis2_QBarDuX
70
71
  uncountable/core/types.py,sha256=s2CjqYJpsmbC7xMwxxT7kJ_V9bwokrjjWVVjpMcQpKI,333
71
72
  uncountable/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
72
73
  uncountable/integration/construct_client.py,sha256=N3K-wck7teqvHTrOh0N2bGF3u6kyuwQvgo7gsKLihQ0,1077
73
- uncountable/integration/cron.py,sha256=DNnMkeLYi70U-3wrcDAX382FgEGq16KL6xy-6OBv5Us,938
74
- uncountable/integration/entrypoint.py,sha256=MNXl9xv0N03V3_0vplckWlUio2CDFJ0jsjM8uvY1dTE,1404
75
- uncountable/integration/job.py,sha256=u4Vhm9l5KUvex7I7R_ysBHjmm1BBB1KvnjRvZvFkOig,807
74
+ uncountable/integration/cron.py,sha256=JIBgHUi4BqUULEPwYCZlDsvdJXLtl-EgCt7RVIdVmSE,995
75
+ uncountable/integration/entrypoint.py,sha256=zpYd1mzbc7uZ68IyXIkODqKPvzsUZ_3Lkj2H2bhKor0,1377
76
+ uncountable/integration/job.py,sha256=Cy10LUfy2HaGcVz0uH7I00WeyyFYKYgEd-rE_OqVkUc,819
76
77
  uncountable/integration/server.py,sha256=5Wh80VyfgUUHA5NiFGn9LjS4KJ9zJz3QbNTLLKhFAso,3342
77
78
  uncountable/integration/types.py,sha256=n9idu2_qHOA5CQdE6NK8HS6aZ8ugTZKTfTTnm4sy8tI,2066
78
79
  uncountable/integration/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -216,7 +217,7 @@ uncountable/types/api/recipes/unarchive_recipes.py,sha256=W_tOZgz_FEVQcI3y1tnxJz
216
217
  uncountable/types/api/recipes/unlock_recipes.py,sha256=BORmGgYjQfBVRnqimVXc-RcvG3QJkvexesTGuKdgoOw,1094
217
218
  uncountable/types/api/triggers/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr8APdZYUniAor8,55
218
219
  uncountable/types/api/triggers/run_trigger.py,sha256=nV81yBsxmBi5u4hJyO8RhOd6zG0BK0y1aN33zLDbJmM,884
219
- UncountablePythonSDK-0.0.40.dist-info/METADATA,sha256=shiGvKxG1hChoJWA-x-1_EFJOOYRGWZb77vshDSgc6U,1577
220
- UncountablePythonSDK-0.0.40.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
221
- UncountablePythonSDK-0.0.40.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
222
- UncountablePythonSDK-0.0.40.dist-info/RECORD,,
220
+ UncountablePythonSDK-0.0.41.dist-info/METADATA,sha256=Y8go69WL8lqmsIZjvbolQvZSZKv2aHelEUa0Ghi2ZI0,1577
221
+ UncountablePythonSDK-0.0.41.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
222
+ UncountablePythonSDK-0.0.41.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
223
+ UncountablePythonSDK-0.0.41.dist-info/RECORD,,
@@ -8,13 +8,13 @@ from decimal import Decimal
8
8
  from importlib import resources
9
9
 
10
10
  import dateutil.parser
11
- import yaml
12
11
 
13
12
  from pkgs.serialization import (
14
13
  MissingSentryType,
15
14
  OpaqueKey,
16
15
  get_serial_class_data,
17
16
  get_serial_union_data,
17
+ yaml,
18
18
  )
19
19
 
20
20
  from ._is_enum import is_string_enum_class
@@ -0,0 +1,54 @@
1
+ from decimal import Decimal
2
+ from typing import TYPE_CHECKING, Any
3
+
4
+ import yaml
5
+
6
+ if TYPE_CHECKING:
7
+ from _typeshed import SupportsRead as SupportsReadT
8
+ from _typeshed import SupportsWrite as SupportsWriteT
9
+
10
+ SupportsRead = SupportsReadT[Any]
11
+ SupportsWrite = SupportsWriteT[Any]
12
+ else:
13
+ SupportsRead = object
14
+ SupportsWrite = object
15
+
16
+
17
+ def _decimal_constructor(loader, node): # type:ignore
18
+ value = loader.construct_scalar(node)
19
+ return Decimal(value)
20
+
21
+
22
+ # A semi-acceptable patch to force a number to be parsed as a decimal, since pyyaml
23
+ # parses them as lossy floats otherwise. Though a bit ugly, at least this way we have
24
+ # support for decimal constants
25
+ yaml.SafeLoader.add_constructor("!decimal", _decimal_constructor)
26
+
27
+
28
+ class YAMLError(BaseException):
29
+ pass
30
+
31
+
32
+ def dumps(obj: Any, sort_keys: bool = False) -> str:
33
+ return yaml.dump(obj, sort_keys=sort_keys)
34
+
35
+
36
+ def dump(obj: Any, f: SupportsWrite, sort_keys: bool = False) -> None:
37
+ yaml.dump(obj, f, sort_keys=sort_keys)
38
+
39
+
40
+ def safe_load(src: str | bytes | SupportsRead) -> Any:
41
+ try:
42
+ return yaml.safe_load(src)
43
+ except yaml.YAMLError as e:
44
+ raise YAMLError() from e
45
+
46
+
47
+ def safe_dump(
48
+ obj: Any, sort_keys: bool = False, indent: int | None = None, width: int | None = None
49
+ ) -> str:
50
+ return yaml.safe_dump(obj, sort_keys=sort_keys, indent=indent, width=width)
51
+
52
+
53
+ def c_load(f: SupportsRead) -> Any:
54
+ return yaml.load(f, Loader=yaml.CLoader)
pkgs/type_spec/config.py CHANGED
@@ -1,10 +1,9 @@
1
1
  import os
2
2
  from collections.abc import Callable, Mapping
3
3
  from dataclasses import dataclass
4
- from decimal import Decimal
5
4
  from typing import Self, TypeVar
6
5
 
7
- import yaml
6
+ from pkgs.serialization import yaml
8
7
 
9
8
  ConfigValueType = str | None | Mapping[str, str | None] | list[str]
10
9
 
@@ -103,17 +102,6 @@ def _parse_language(config_class: type[_T], raw_value: ConfigValueType) -> _T:
103
102
  return config_class(**raw_value)
104
103
 
105
104
 
106
- def _decimal_constructor(loader, node): # type:ignore
107
- value = loader.construct_scalar(node)
108
- return Decimal(value)
109
-
110
-
111
- # A semi-acceptable patch to force a number to be parsed as a decimal, since pyyaml
112
- # parses them as lossy floats otherwise. Though a bit ugly, at least this way we have
113
- # support for decimal constants
114
- yaml.SafeLoader.add_constructor("!decimal", _decimal_constructor)
115
-
116
-
117
105
  def parse_yaml_config(config_file: str) -> Config:
118
106
  with open(config_file, encoding="utf-8") as input:
119
107
  raw_config: dict[str, ConfigValueType] = yaml.safe_load(input)
@@ -9,7 +9,7 @@ import json
9
9
  import re
10
10
  from typing import Collection, cast
11
11
 
12
- import yaml
12
+ from pkgs.serialization import yaml
13
13
 
14
14
  from . import builder, util
15
15
  from .builder import EndpointGuideKey, RootGuideKey
@@ -169,7 +169,7 @@ def _serialize_global_context(ctx: EmitOpenAPIGlobalContext) -> str:
169
169
  oa_paths[path.path] = {"$ref": path.ref}
170
170
  oa_root["paths"] = oa_paths
171
171
 
172
- return yaml.dump(oa_root, sort_keys=False)
172
+ return yaml.dumps(oa_root, sort_keys=False)
173
173
 
174
174
 
175
175
  def _is_empty_object_type(typ: OpenAPIType) -> bool:
@@ -413,7 +413,7 @@ def _emit_namespace(
413
413
 
414
414
  path = f"{config.types_output}/common/{'/'.join(namespace.path)}.yaml"
415
415
  oa_namespace = {"components": oa_components}
416
- _rewrite_with_notice(path, yaml.dump(oa_namespace, sort_keys=False))
416
+ _rewrite_with_notice(path, yaml.dumps(oa_namespace, sort_keys=False))
417
417
 
418
418
 
419
419
  def _emit_type(
@@ -3,9 +3,10 @@ from collections.abc import Callable
3
3
  from io import StringIO
4
4
  from typing import Optional
5
5
 
6
- import yaml
7
6
  from shelljob import fs
8
7
 
8
+ from pkgs.serialization import yaml
9
+
9
10
  from .builder import SpecBuilder
10
11
  from .config import Config
11
12
 
@@ -20,9 +20,9 @@ import sys
20
20
  from typing import TypeVar, cast
21
21
 
22
22
  import regex as re
23
- import yaml
24
23
 
25
24
  from main.base.types import base_t, value_spec_t
25
+ from pkgs.serialization import yaml
26
26
 
27
27
  from ..util import parse_type_str, rewrite_file
28
28
  from .convert_type import convert_to_value_spec_type
@@ -27,4 +27,6 @@ def cron_job_executor(**kwargs: dict) -> None:
27
27
  args_passed.definition.executor, args_passed.profile_metadata
28
28
  )
29
29
 
30
+ print(f"running job {args_passed.definition.name}")
31
+
30
32
  job.run(args=args)
@@ -9,10 +9,9 @@ from uncountable.integration.types import ProfileDefinition
9
9
  profile_parser = CachedParser(ProfileDefinition)
10
10
 
11
11
 
12
- def main() -> None:
12
+ def main(blocking: bool) -> None:
13
13
  profiles_module = os.environ["UNC_PROFILES_MODULE"]
14
14
  with IntegrationServer(create_db_engine()) as server:
15
- # TODO: Loop through all job spec yaml files and call server.add_job
16
15
  profiles = [
17
16
  entry
18
17
  for entry in resources.files(profiles_module).iterdir()
@@ -26,7 +25,7 @@ def main() -> None:
26
25
  resource="profile.yaml",
27
26
  )
28
27
  except FileNotFoundError as e:
29
- print("WARN: profile.yaml not found", e)
28
+ print(f"WARN: profile.yaml not found for {profile_name}", e)
30
29
  continue
31
30
  server.register_profile(
32
31
  profile_name=profile_name,
@@ -35,8 +34,8 @@ def main() -> None:
35
34
  jobs=profile.jobs,
36
35
  )
37
36
 
38
- server.serve_forever()
37
+ if blocking:
38
+ server.serve_forever()
39
39
 
40
40
 
41
- if __name__ == "__main__":
42
- main()
41
+ main(__name__ == "__main__")
@@ -37,6 +37,6 @@ class CronJob(Job):
37
37
  def run(self, args: CronJobArguments) -> JobResult: ...
38
38
 
39
39
 
40
- def register_job(cls: Job) -> Job:
40
+ def register_job(cls: type[Job]) -> type[Job]:
41
41
  cls._unc_job_registered = True
42
42
  return cls