pycraftcore 0.2.2__tar.gz → 0.2.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 (129) hide show
  1. {pycraftcore-0.2.2/src/pycraftcore.egg-info → pycraftcore-0.2.3}/PKG-INFO +9 -5
  2. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/Readme.md +8 -4
  3. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/pyproject.toml +3 -3
  4. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/adapter/schema.py +0 -1
  5. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/model/operation.py +0 -7
  6. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/port/configuration.py +2 -3
  7. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/port/configuration_reader.py +2 -1
  8. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/computation_engine/adapter/compute_engine.py +5 -3
  9. pycraftcore-0.2.3/src/pycraftcore/computation_engine/port/arithmetic_operation.py +15 -0
  10. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/computation_engine/port/calculus_operation.py +4 -3
  11. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/computation_engine/port/engine.py +5 -4
  12. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/adapter/aiohttp_client.py +2 -2
  13. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/adapter/resilient_client.py +6 -2
  14. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/port/async_circuit_breaker.py +2 -1
  15. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/port/async_http_client.py +4 -4
  16. pycraftcore-0.2.3/src/pycraftcore/http/port/async_resilient_http_client.py +8 -0
  17. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/port/retry.py +2 -1
  18. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/logger/port/logger.py +2 -1
  19. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/query_language/sql/sql_handler.py +3 -1
  20. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/repository/repository.py +3 -1
  21. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/runtime/code.py +3 -1
  22. pycraftcore-0.2.3/src/pycraftcore/serializer/port/serializer.py +12 -0
  23. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/telemetry/port/telemetry.py +3 -1
  24. {pycraftcore-0.2.2 → pycraftcore-0.2.3/src/pycraftcore.egg-info}/PKG-INFO +9 -5
  25. pycraftcore-0.2.2/src/pycraftcore/computation_engine/port/arithmetic_operation.py +0 -16
  26. pycraftcore-0.2.2/src/pycraftcore/http/port/async_resilient_http_client.py +0 -6
  27. pycraftcore-0.2.2/src/pycraftcore/serializer/port/serializer.py +0 -11
  28. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/LICENSE +0 -0
  29. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/setup.cfg +0 -0
  30. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/__init__.py +0 -0
  31. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/__init__.py +0 -0
  32. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/adapter/__init__.py +0 -0
  33. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/adapter/load_application_configuration.py +0 -0
  34. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/adapter/omega_configuration_reader.py +0 -0
  35. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/enum/__init__.py +0 -0
  36. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/enum/connector_type.py +0 -0
  37. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/enum/file_operation_action.py +0 -0
  38. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/enum/operation_type.py +0 -0
  39. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/enum/run_type_application.py +0 -0
  40. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/enum/run_type_environment.py +0 -0
  41. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/model/__init__.py +0 -0
  42. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/model/configuration.py +0 -0
  43. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/model/connector.py +0 -0
  44. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/application_configuration/port/__init__.py +0 -0
  45. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/authentication/__init__.py +0 -0
  46. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/authentication/model/__init__.py +0 -0
  47. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/authentication/model/auth_type.py +0 -0
  48. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/authentication/model/basic_auth.py +0 -0
  49. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/authentication/model/no_auth.py +0 -0
  50. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/authentication/model/token_auth.py +0 -0
  51. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/computation_engine/__init__.py +0 -0
  52. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/computation_engine/adapter/__init__.py +0 -0
  53. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/computation_engine/adapter/numpy_arithmetic_operation.py +0 -0
  54. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/computation_engine/adapter/scipy_calculus_operation.py +0 -0
  55. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/computation_engine/const_typing.py +0 -0
  56. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/computation_engine/port/__init__.py +0 -0
  57. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/file_handler/__init__.py +0 -0
  58. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/file_handler/adapter/__init__.py +0 -0
  59. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/file_handler/adapter/extension/__init__.py +0 -0
  60. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/file_handler/adapter/extension/yml_reader.py +0 -0
  61. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/file_handler/adapter/extension/yml_writer.py +0 -0
  62. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/file_handler/adapter/factory.py +0 -0
  63. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/file_handler/adapter/handler.py +0 -0
  64. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/file_handler/adapter/provider.py +0 -0
  65. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/file_handler/adapter/strategy.py +0 -0
  66. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/file_handler/port/__init__.py +0 -0
  67. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/file_handler/port/reader.py +0 -0
  68. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/file_handler/port/writer.py +0 -0
  69. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/__init__.py +0 -0
  70. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/adapter/__init__.py +0 -0
  71. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/adapter/circuit_breaker_policy.py +0 -0
  72. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/adapter/httpx_client.py +0 -0
  73. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/adapter/retry_policy.py +0 -0
  74. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/configuration/__init__.py +0 -0
  75. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/configuration/circuite_breaker_configuration.py +0 -0
  76. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/configuration/client_configuration.py +0 -0
  77. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/configuration/http_client_configuration.py +0 -0
  78. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/configuration/limits_configuration.py +0 -0
  79. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/configuration/retry_configuration.py +0 -0
  80. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/configuration/security_configuration.py +0 -0
  81. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/context/__init__.py +0 -0
  82. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/context/request_context.py +0 -0
  83. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/enum/__init__.py +0 -0
  84. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/enum/circuit_breaker_status.py +0 -0
  85. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/enum/http_method.py +0 -0
  86. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/exception/__init__.py +0 -0
  87. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/exception/circuit_breaker_open_exception.py +0 -0
  88. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/middleware/__init__.py +0 -0
  89. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/middleware/request_id_middleware.py +0 -0
  90. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/middleware/request_middleware.py +0 -0
  91. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/http/port/__init__.py +0 -0
  92. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/logger/__init__.py +0 -0
  93. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/logger/adapter/__init__.py +0 -0
  94. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/logger/adapter/loguru_logger.py +0 -0
  95. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/logger/port/__init__.py +0 -0
  96. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/profiler/__init__.py +0 -0
  97. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/profiler/profiled.py +0 -0
  98. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/query_language/__init__.py +0 -0
  99. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/query_language/constants/__init__.py +0 -0
  100. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/query_language/constants/allowed_root_statements.py +0 -0
  101. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/query_language/constants/forbidden_statements.py +0 -0
  102. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/query_language/sql/__init__.py +0 -0
  103. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/query_language/sql/adapter.py +0 -0
  104. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/query_language/sql/factory.py +0 -0
  105. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/repository/__init__.py +0 -0
  106. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/repository/sqlite/__init__.py +0 -0
  107. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/repository/sqlite/adapter.py +0 -0
  108. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/repository/sqlite/factory.py +0 -0
  109. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/repository/sqlite/mapper.py +0 -0
  110. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/repository/sqlite/schema.py +0 -0
  111. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/runtime/__init__.py +0 -0
  112. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/runtime/python/__init__.py +0 -0
  113. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/runtime/python/adapter.py +0 -0
  114. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/runtime/python/factory.py +0 -0
  115. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/runtime/python/schema.py +0 -0
  116. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/serializer/__init__.py +0 -0
  117. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/serializer/adapter/__init__.py +0 -0
  118. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/serializer/adapter/binary_serializer.py +0 -0
  119. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/serializer/adapter/dictionary_serializer.py +0 -0
  120. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/serializer/adapter/json_serializer.py +0 -0
  121. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/serializer/port/__init__.py +0 -0
  122. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/telemetry/__init__.py +0 -0
  123. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/telemetry/adapter/__init__.py +0 -0
  124. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/telemetry/adapter/open_telemetry.py +0 -0
  125. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore/telemetry/port/__init__.py +0 -0
  126. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore.egg-info/SOURCES.txt +0 -0
  127. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore.egg-info/dependency_links.txt +0 -0
  128. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore.egg-info/requires.txt +0 -0
  129. {pycraftcore-0.2.2 → pycraftcore-0.2.3}/src/pycraftcore.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycraftcore
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Provides reusable technical infrastructure and adapter implementations for Python applications
5
5
  Author-email: Toufik Saouchi <toufik.saouchi@gmail.com>
6
6
  License-Expression: MIT
@@ -174,8 +174,12 @@ they load as.
174
174
  ```python
175
175
  from pathlib import Path
176
176
 
177
- from pycraftcore.application_configuration.adapter.load_application_configuration import LoadApplicationConfiguration
178
- from pycraftcore.application_configuration.adapter.omega_configuration_reader import OmegaConfigurationReader
177
+ from pycraftcore.application_configuration.adapter.load_application_configuration import (
178
+ LoadApplicationConfiguration,
179
+ )
180
+ from pycraftcore.application_configuration.adapter.omega_configuration_reader import (
181
+ OmegaConfigurationReader,
182
+ )
179
183
  from pycraftcore.application_configuration.enum.run_type_environment import RunTypeEnvironment
180
184
  from pycraftcore.logger.adapter.loguru_logger import LoguruLogger
181
185
 
@@ -184,8 +188,8 @@ loader = LoadApplicationConfiguration(reader, LoguruLogger())
184
188
 
185
189
  config = loader.load()
186
190
 
187
- connector = config.connector.api("<connector_tag>") # ApiConnector
188
- operation = config.operation.api("<operation_tag>") # ApiOperation
191
+ connector = config.connector.api("<connector_tag>") # ApiConnector
192
+ operation = config.operation.api("<operation_tag>") # ApiOperation
189
193
  ```
190
194
 
191
195
  `config.connector`/`config.operation` return the concrete connector/operation type for a given tag (`.api()`,
@@ -137,8 +137,12 @@ they load as.
137
137
  ```python
138
138
  from pathlib import Path
139
139
 
140
- from pycraftcore.application_configuration.adapter.load_application_configuration import LoadApplicationConfiguration
141
- from pycraftcore.application_configuration.adapter.omega_configuration_reader import OmegaConfigurationReader
140
+ from pycraftcore.application_configuration.adapter.load_application_configuration import (
141
+ LoadApplicationConfiguration,
142
+ )
143
+ from pycraftcore.application_configuration.adapter.omega_configuration_reader import (
144
+ OmegaConfigurationReader,
145
+ )
142
146
  from pycraftcore.application_configuration.enum.run_type_environment import RunTypeEnvironment
143
147
  from pycraftcore.logger.adapter.loguru_logger import LoguruLogger
144
148
 
@@ -147,8 +151,8 @@ loader = LoadApplicationConfiguration(reader, LoguruLogger())
147
151
 
148
152
  config = loader.load()
149
153
 
150
- connector = config.connector.api("<connector_tag>") # ApiConnector
151
- operation = config.operation.api("<operation_tag>") # ApiOperation
154
+ connector = config.connector.api("<connector_tag>") # ApiConnector
155
+ operation = config.operation.api("<operation_tag>") # ApiOperation
152
156
  ```
153
157
 
154
158
  `config.connector`/`config.operation` return the concrete connector/operation type for a given tag (`.api()`,
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pycraftcore"
7
- version = "0.2.2"
7
+ version = "0.2.3"
8
8
  authors = [
9
9
  { name = "Toufik Saouchi", email = "toufik.saouchi@gmail.com" },
10
10
  ]
@@ -71,8 +71,8 @@ ignore = [
71
71
  ]
72
72
 
73
73
  [tool.ty.src]
74
- include = ["src"]
75
- exclude = ["tests", ".venv"]
74
+ include = ["src", "tests/ducktype"]
75
+ exclude = [".venv"]
76
76
 
77
77
  [tool.setuptools.packages.find]
78
78
  where = ["src"]
@@ -27,7 +27,6 @@ from pycraftcore.application_configuration.model.operation import (
27
27
 
28
28
 
29
29
  def _kind_tag(value: Any) -> str:
30
- """Discriminator: read `type` off a raw dict (pre-coercion) or an already-built dataclass."""
31
30
  return value["type"] if isinstance(value, dict) else value.type.value
32
31
 
33
32
 
@@ -43,13 +43,6 @@ _OPERATION_CLASS_BY_TYPE: dict[OperationType, type[OperationTyping]] = {
43
43
 
44
44
  @dataclass(frozen=True, slots=True)
45
45
  class OperationRegistry:
46
- """Operations keyed by name, with per-kind typed lookups.
47
-
48
- Mirrors `ConnectorRegistry`: each operation declares its own `OperationType`, and a
49
- mismatch between that declared type and its concrete dataclass is rejected eagerly here
50
- instead of surfacing later as a wrong-typed lookup.
51
- """
52
-
53
46
  by_name: dict[str, OperationTyping] = field(default_factory=dict)
54
47
 
55
48
  def __post_init__(self) -> None:
@@ -1,11 +1,10 @@
1
- from typing import Protocol
1
+ from typing import Protocol, runtime_checkable
2
2
 
3
3
  from pycraftcore.application_configuration.model.configuration import (
4
4
  ApplicationConfiguration,
5
5
  )
6
6
 
7
7
 
8
+ @runtime_checkable
8
9
  class Configuration(Protocol):
9
10
  def load(self) -> ApplicationConfiguration | None: ...
10
-
11
- def reload(self) -> ApplicationConfiguration | None: ...
@@ -1,9 +1,10 @@
1
- from typing import Protocol
1
+ from typing import Protocol, runtime_checkable
2
2
 
3
3
  from pycraftcore.application_configuration.model.configuration import (
4
4
  ApplicationConfiguration,
5
5
  )
6
6
 
7
7
 
8
+ @runtime_checkable
8
9
  class ConfigurationReader(Protocol):
9
10
  def read(self) -> ApplicationConfiguration: ...
@@ -1,3 +1,5 @@
1
+ from typing import Any
2
+
1
3
  from pycraftcore.computation_engine.port.arithmetic_operation import (
2
4
  ArithmeticOperation,
3
5
  )
@@ -7,14 +9,14 @@ from pycraftcore.computation_engine.port.calculus_operation import (
7
9
 
8
10
 
9
11
  class ComputeEngine:
10
- def __init__(self, arithmetic: ArithmeticOperation, calculus: CalculusOperation):
12
+ def __init__(self, arithmetic: ArithmeticOperation[Any], calculus: CalculusOperation[Any]):
11
13
  self._arithmetic = arithmetic
12
14
  self._calculus = calculus
13
15
 
14
16
  @property
15
- def arithmetic(self) -> ArithmeticOperation:
17
+ def arithmetic(self) -> ArithmeticOperation[Any]:
16
18
  return self._arithmetic
17
19
 
18
20
  @property
19
- def calculus(self) -> CalculusOperation:
21
+ def calculus(self) -> CalculusOperation[Any]:
20
22
  return self._calculus
@@ -0,0 +1,15 @@
1
+ from collections.abc import Sequence
2
+ from typing import Any, Protocol, runtime_checkable
3
+
4
+ from pycraftcore.computation_engine.const_typing import Numeric
5
+
6
+
7
+ @runtime_checkable
8
+ class ArithmeticOperation[T](Protocol):
9
+ def to_array(self, sequence: Sequence[Any]) -> T: ...
10
+
11
+ def log_returns(self, sequence: Sequence[Numeric]) -> T: ...
12
+
13
+ def rolling_average(self, sequence: Sequence[Numeric], window: int) -> T: ...
14
+
15
+ def rolling_standard_deviation(self, sequence: Sequence[Numeric], window: int) -> T: ...
@@ -1,12 +1,13 @@
1
1
  from collections.abc import Sequence
2
- from typing import Protocol
2
+ from typing import Protocol, runtime_checkable
3
3
 
4
4
  from pycraftcore.computation_engine.const_typing import Kind, Numeric
5
5
 
6
6
 
7
- class CalculusOperation(Protocol):
7
+ @runtime_checkable
8
+ class CalculusOperation[T](Protocol):
8
9
  def integrate(self, sequence: Sequence[Numeric], dx: float) -> float: ...
9
10
 
10
11
  def interpolate(
11
12
  self, sequence: Sequence[Numeric], kind: Kind = "linear", num: int | None = None
12
- ) -> Sequence[Numeric]: ...
13
+ ) -> T: ...
@@ -1,4 +1,4 @@
1
- from typing import Protocol
1
+ from typing import Protocol, runtime_checkable
2
2
 
3
3
  from pycraftcore.computation_engine.port.arithmetic_operation import (
4
4
  ArithmeticOperation,
@@ -8,9 +8,10 @@ from pycraftcore.computation_engine.port.calculus_operation import (
8
8
  )
9
9
 
10
10
 
11
- class Engine(Protocol):
11
+ @runtime_checkable
12
+ class Engine[T](Protocol):
12
13
  @property
13
- def arithmetic(self) -> ArithmeticOperation: ...
14
+ def arithmetic(self) -> ArithmeticOperation[T]: ...
14
15
 
15
16
  @property
16
- def calculus(self) -> CalculusOperation: ...
17
+ def calculus(self) -> CalculusOperation[T]: ...
@@ -1,6 +1,6 @@
1
1
  import ssl
2
2
  from collections.abc import Mapping
3
- from typing import Any, Self
3
+ from typing import Any, NoReturn, Self
4
4
 
5
5
  import aiohttp
6
6
  import orjson
@@ -156,7 +156,7 @@ class AioHttpClientFactory:
156
156
  return False
157
157
 
158
158
  @property
159
- def resilient_client_instance(self) -> None:
159
+ def resilient_client_instance(self) -> NoReturn:
160
160
  raise NotImplementedError(
161
161
  "For aiohttp adapter compose the resilient client using the resilient implementation"
162
162
  )
@@ -1,6 +1,6 @@
1
- from collections.abc import Callable, Awaitable
1
+ from collections.abc import Awaitable, Callable
2
2
  from dataclasses import asdict
3
- from typing import Final, ParamSpec, TypeVar
3
+ from typing import Any, Final, ParamSpec, TypeVar
4
4
 
5
5
  from pycraftcore.http.enum.http_method import HttpMethod
6
6
  from pycraftcore.http.port.async_circuit_breaker import AsyncCircuitBreaker
@@ -13,6 +13,10 @@ R = TypeVar("R")
13
13
 
14
14
 
15
15
  class ResilientClient:
16
+
17
+ get: Callable[..., Awaitable[Any]]
18
+ post: Callable[..., Awaitable[Any]]
19
+
16
20
  def __init__(
17
21
  self,
18
22
  base_client: AsyncHttpClient,
@@ -1,5 +1,5 @@
1
1
  from collections.abc import Awaitable, Callable
2
- from typing import ParamSpec, Protocol, TypeVar
2
+ from typing import ParamSpec, Protocol, TypeVar, runtime_checkable
3
3
 
4
4
  from pycraftcore.http.configuration.circuite_breaker_configuration import (
5
5
  CircuitBreakerSettings,
@@ -9,6 +9,7 @@ P = ParamSpec("P")
9
9
  R = TypeVar("R")
10
10
 
11
11
 
12
+ @runtime_checkable
12
13
  class AsyncCircuitBreaker(Protocol):
13
14
  def _can_attempt(self) -> bool: ...
14
15
  def _on_success(self) -> None: ...
@@ -1,9 +1,8 @@
1
- from typing import Any, Protocol, TypeVar
1
+ from typing import Any, Protocol, runtime_checkable
2
2
 
3
- T = TypeVar("T")
4
3
 
5
-
6
- class AsyncHttpFactory(Protocol):
4
+ @runtime_checkable
5
+ class AsyncHttpFactory[T](Protocol):
7
6
  async def start(self) -> None: ...
8
7
  async def close(self) -> None: ...
9
8
  def create_client(self) -> AsyncHttpClient: ...
@@ -11,6 +10,7 @@ class AsyncHttpFactory(Protocol):
11
10
  def resilient_client_instance(self) -> T: ...
12
11
 
13
12
 
13
+ @runtime_checkable
14
14
  class AsyncHttpClient(Protocol):
15
15
  async def get(
16
16
  self,
@@ -0,0 +1,8 @@
1
+ from collections.abc import Awaitable
2
+ from typing import Any, Protocol, runtime_checkable
3
+
4
+
5
+ @runtime_checkable
6
+ class AsyncResilientHttpClient(Protocol):
7
+ def get(self, *args: Any, **kwargs: Any) -> Awaitable[Any]: ...
8
+ def post(self, *args: Any, **kwargs: Any) -> Awaitable[Any]: ...
@@ -1,5 +1,5 @@
1
1
  from collections.abc import Awaitable, Callable
2
- from typing import ParamSpec, Protocol, TypeVar
2
+ from typing import ParamSpec, Protocol, TypeVar, runtime_checkable
3
3
 
4
4
  from pycraftcore.http.configuration.retry_configuration import RetrySettings
5
5
 
@@ -7,6 +7,7 @@ P = ParamSpec("P")
7
7
  R = TypeVar("R")
8
8
 
9
9
 
10
+ @runtime_checkable
10
11
  class Retry(Protocol):
11
12
  @property
12
13
  def settings(self) -> RetrySettings: ...
@@ -1,6 +1,7 @@
1
- from typing import Protocol
1
+ from typing import Protocol, runtime_checkable
2
2
 
3
3
 
4
+ @runtime_checkable
4
5
  class Logger(Protocol):
5
6
  def info(self, message: str) -> None: ...
6
7
 
@@ -1,11 +1,13 @@
1
- from typing import Protocol, TypeVar
1
+ from typing import Protocol, TypeVar, runtime_checkable
2
2
 
3
3
  T = TypeVar("T")
4
4
 
5
5
 
6
+ @runtime_checkable
6
7
  class SqlFactory(Protocol):
7
8
  def __call__(self, expression: str, dialect: str) -> SqlHandler: ...
8
9
 
9
10
 
11
+ @runtime_checkable
10
12
  class SqlHandler(Protocol):
11
13
  def transpile(self, expressions: T | None = None) -> str: ...
@@ -1,8 +1,9 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import Any, Protocol
3
+ from typing import Any, Protocol, runtime_checkable
4
4
 
5
5
 
6
+ @runtime_checkable
6
7
  class AsyncRepository(Protocol):
7
8
  async def execute(
8
9
  self,
@@ -11,6 +12,7 @@ class AsyncRepository(Protocol):
11
12
  ) -> list[dict[str, Any]]: ...
12
13
 
13
14
 
15
+ @runtime_checkable
14
16
  class AsyncRepositoryFactory(Protocol):
15
17
  async def connection(self) -> Any: ...
16
18
  async def disconnect(self) -> None: ...
@@ -1,12 +1,14 @@
1
1
  from string import Template
2
- from typing import Protocol
2
+ from typing import Protocol, runtime_checkable
3
3
 
4
4
  from pycraftcore.runtime.python.schema import CodeStdout
5
5
 
6
6
 
7
+ @runtime_checkable
7
8
  class CodeFactory(Protocol):
8
9
  def __call__(self, code: str, code_template: Template | None = None) -> Code: ...
9
10
 
10
11
 
12
+ @runtime_checkable
11
13
  class Code(Protocol):
12
14
  async def execute(self) -> CodeStdout: ...
@@ -0,0 +1,12 @@
1
+ from typing import Protocol, TypeVar, runtime_checkable
2
+
3
+ T = TypeVar("T")
4
+
5
+
6
+ @runtime_checkable
7
+ class Serializer[W](Protocol):
8
+ @staticmethod
9
+ def serialize(inputs: T) -> W: ...
10
+
11
+ @staticmethod
12
+ def deserialize(inputs: W, cls: type[T]) -> T: ...
@@ -1,16 +1,18 @@
1
1
  from collections.abc import Awaitable, Callable
2
- from typing import Any, ParamSpec, Protocol, TypeVar
2
+ from typing import Any, ParamSpec, Protocol, TypeVar, runtime_checkable
3
3
 
4
4
  P = ParamSpec("P")
5
5
  R = TypeVar("R")
6
6
 
7
7
 
8
+ @runtime_checkable
8
9
  class TelemetryTracer(Protocol):
9
10
  def trace(
10
11
  self, span_name: str, static_attributes: dict[str, Any]
11
12
  ) -> Callable[[Callable[P, Awaitable[R]]], Callable[P, Awaitable[R]]]: ...
12
13
 
13
14
 
15
+ @runtime_checkable
14
16
  class TelemetryProvider(Protocol):
15
17
  def tracer(self, service_name: str) -> TelemetryTracer: ...
16
18
  def shutdown(self) -> None: ...
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycraftcore
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Provides reusable technical infrastructure and adapter implementations for Python applications
5
5
  Author-email: Toufik Saouchi <toufik.saouchi@gmail.com>
6
6
  License-Expression: MIT
@@ -174,8 +174,12 @@ they load as.
174
174
  ```python
175
175
  from pathlib import Path
176
176
 
177
- from pycraftcore.application_configuration.adapter.load_application_configuration import LoadApplicationConfiguration
178
- from pycraftcore.application_configuration.adapter.omega_configuration_reader import OmegaConfigurationReader
177
+ from pycraftcore.application_configuration.adapter.load_application_configuration import (
178
+ LoadApplicationConfiguration,
179
+ )
180
+ from pycraftcore.application_configuration.adapter.omega_configuration_reader import (
181
+ OmegaConfigurationReader,
182
+ )
179
183
  from pycraftcore.application_configuration.enum.run_type_environment import RunTypeEnvironment
180
184
  from pycraftcore.logger.adapter.loguru_logger import LoguruLogger
181
185
 
@@ -184,8 +188,8 @@ loader = LoadApplicationConfiguration(reader, LoguruLogger())
184
188
 
185
189
  config = loader.load()
186
190
 
187
- connector = config.connector.api("<connector_tag>") # ApiConnector
188
- operation = config.operation.api("<operation_tag>") # ApiOperation
191
+ connector = config.connector.api("<connector_tag>") # ApiConnector
192
+ operation = config.operation.api("<operation_tag>") # ApiOperation
189
193
  ```
190
194
 
191
195
  `config.connector`/`config.operation` return the concrete connector/operation type for a given tag (`.api()`,
@@ -1,16 +0,0 @@
1
- from collections.abc import Sequence
2
- from typing import Any, Protocol
3
-
4
- from pycraftcore.computation_engine.const_typing import Numeric
5
-
6
-
7
- class ArithmeticOperation(Protocol):
8
- def to_array(self, sequence: Sequence[Any]) -> Sequence[Any]: ...
9
-
10
- def log_returns(self, sequence: Sequence[Numeric]) -> Sequence[Numeric]: ...
11
-
12
- def rolling_average(self, sequence: Sequence[Numeric], window: int) -> Sequence[Numeric]: ...
13
-
14
- def rolling_standard_deviation(
15
- self, sequence: Sequence[Numeric], window: int
16
- ) -> Sequence[Numeric]: ...
@@ -1,6 +0,0 @@
1
- from typing import Protocol, Any
2
-
3
-
4
- class AsyncResilientHttpClient(Protocol):
5
- async def get(self, *args: Any, **kwargs: Any) -> Any: ...
6
- async def post(self, *args: Any, **kwargs: Any) -> Any: ...
@@ -1,11 +0,0 @@
1
- from typing import Protocol, TypeVar
2
-
3
- T = TypeVar("T")
4
-
5
-
6
- class Serializer(Protocol):
7
- @staticmethod
8
- def serialize(inputs: T) -> bytes: ...
9
-
10
- @staticmethod
11
- def deserialize(inputs: bytes, cls: type[T]) -> T: ...
File without changes
File without changes