clear-skies 2.0.6__py3-none-any.whl → 2.0.8__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 clear-skies might be problematic. Click here for more details.

Files changed (149) hide show
  1. {clear_skies-2.0.6.dist-info → clear_skies-2.0.8.dist-info}/METADATA +1 -1
  2. clear_skies-2.0.8.dist-info/RECORD +252 -0
  3. clearskies/__init__.py +2 -2
  4. clearskies/authentication/authentication.py +1 -3
  5. clearskies/authentication/authorization.py +12 -5
  6. clearskies/authentication/authorization_pass_through.py +5 -3
  7. clearskies/authentication/jwks.py +25 -23
  8. clearskies/authentication/secret_bearer.py +15 -17
  9. clearskies/autodoc/schema/schema.py +1 -1
  10. clearskies/backends/api_backend.py +50 -56
  11. clearskies/backends/backend.py +14 -14
  12. clearskies/backends/cursor_backend.py +17 -23
  13. clearskies/backends/memory_backend.py +27 -30
  14. clearskies/backends/secrets_backend.py +13 -18
  15. clearskies/column.py +44 -56
  16. clearskies/columns/audit.py +14 -13
  17. clearskies/columns/belongs_to_id.py +10 -15
  18. clearskies/columns/belongs_to_model.py +6 -9
  19. clearskies/columns/belongs_to_self.py +13 -9
  20. clearskies/columns/boolean.py +13 -16
  21. clearskies/columns/category_tree.py +9 -11
  22. clearskies/columns/category_tree_children.py +2 -3
  23. clearskies/columns/category_tree_descendants.py +1 -1
  24. clearskies/columns/created.py +8 -11
  25. clearskies/columns/created_by_authorization_data.py +7 -9
  26. clearskies/columns/created_by_header.py +12 -8
  27. clearskies/columns/created_by_ip.py +6 -8
  28. clearskies/columns/created_by_routing_data.py +12 -7
  29. clearskies/columns/created_by_user_agent.py +6 -9
  30. clearskies/columns/date.py +12 -14
  31. clearskies/columns/datetime.py +19 -17
  32. clearskies/columns/email.py +3 -1
  33. clearskies/columns/float.py +10 -14
  34. clearskies/columns/has_many.py +8 -10
  35. clearskies/columns/has_many_self.py +13 -7
  36. clearskies/columns/has_one.py +2 -0
  37. clearskies/columns/integer.py +9 -11
  38. clearskies/columns/json.py +10 -12
  39. clearskies/columns/many_to_many_ids.py +14 -16
  40. clearskies/columns/many_to_many_ids_with_data.py +16 -16
  41. clearskies/columns/many_to_many_models.py +5 -7
  42. clearskies/columns/many_to_many_pivots.py +3 -5
  43. clearskies/columns/phone.py +12 -9
  44. clearskies/columns/select.py +12 -9
  45. clearskies/columns/string.py +1 -1
  46. clearskies/columns/timestamp.py +15 -15
  47. clearskies/columns/updated.py +8 -10
  48. clearskies/columns/uuid.py +7 -10
  49. clearskies/configs/any.py +2 -0
  50. clearskies/configs/any_dict.py +2 -0
  51. clearskies/configs/any_dict_or_callable.py +2 -0
  52. clearskies/configs/boolean.py +2 -0
  53. clearskies/configs/boolean_or_callable.py +2 -0
  54. clearskies/configs/callable_config.py +2 -0
  55. clearskies/configs/config.py +2 -0
  56. clearskies/configs/datetime.py +2 -0
  57. clearskies/configs/datetime_or_callable.py +2 -0
  58. clearskies/configs/float.py +2 -0
  59. clearskies/configs/float_or_callable.py +2 -0
  60. clearskies/configs/integer.py +2 -0
  61. clearskies/configs/integer_or_callable.py +2 -0
  62. clearskies/configs/list_any_dict.py +2 -0
  63. clearskies/configs/list_any_dict_or_callable.py +2 -0
  64. clearskies/configs/model_column.py +2 -0
  65. clearskies/configs/model_columns.py +2 -0
  66. clearskies/configs/model_destination_name.py +2 -1
  67. clearskies/configs/model_to_id_column.py +2 -0
  68. clearskies/configs/readable_model_column.py +2 -0
  69. clearskies/configs/readable_model_columns.py +2 -0
  70. clearskies/configs/searchable_model_columns.py +2 -0
  71. clearskies/configs/select.py +2 -0
  72. clearskies/configs/select_list.py +2 -0
  73. clearskies/configs/string.py +2 -0
  74. clearskies/configs/string_dict.py +2 -0
  75. clearskies/configs/string_list.py +2 -0
  76. clearskies/configs/string_list_or_callable.py +2 -0
  77. clearskies/configs/timedelta.py +2 -0
  78. clearskies/configs/timezone.py +2 -0
  79. clearskies/configs/url.py +2 -0
  80. clearskies/configs/writeable_model_column.py +2 -0
  81. clearskies/configs/writeable_model_columns.py +2 -0
  82. clearskies/configurable.py +2 -0
  83. clearskies/contexts/cli.py +9 -1
  84. clearskies/contexts/context.py +13 -14
  85. clearskies/contexts/wsgi.py +12 -10
  86. clearskies/contexts/wsgi_ref.py +12 -6
  87. clearskies/decorators.py +1 -1
  88. clearskies/decorators.pyi +10 -0
  89. clearskies/di/__init__.py +2 -1
  90. clearskies/di/di.py +7 -6
  91. clearskies/di/inject/by_class.py +2 -0
  92. clearskies/di/inject/by_name.py +2 -0
  93. clearskies/di/inject/di.py +2 -0
  94. clearskies/di/inject/environment.py +1 -1
  95. clearskies/di/inject/now.py +2 -0
  96. clearskies/di/inject/requests.py +2 -0
  97. clearskies/di/inject/secrets.py +2 -2
  98. clearskies/di/inject/utcnow.py +2 -0
  99. clearskies/di/inject/uuid.py +2 -2
  100. clearskies/end.py +45 -7
  101. clearskies/endpoint.py +43 -59
  102. clearskies/endpoint_group.py +15 -18
  103. clearskies/endpoints/advanced_search.py +19 -26
  104. clearskies/endpoints/callable.py +10 -16
  105. clearskies/endpoints/create.py +6 -10
  106. clearskies/endpoints/delete.py +5 -11
  107. clearskies/endpoints/get.py +11 -15
  108. clearskies/endpoints/health_check.py +9 -11
  109. clearskies/endpoints/list.py +29 -36
  110. clearskies/endpoints/restful_api.py +43 -53
  111. clearskies/endpoints/schema.py +14 -18
  112. clearskies/endpoints/simple_search.py +5 -12
  113. clearskies/endpoints/update.py +6 -11
  114. clearskies/environment.py +2 -0
  115. clearskies/input_outputs/cli.py +2 -0
  116. clearskies/input_outputs/headers.py +2 -0
  117. clearskies/input_outputs/input_output.py +15 -15
  118. clearskies/input_outputs/programmatic.py +2 -2
  119. clearskies/input_outputs/wsgi.py +2 -2
  120. clearskies/model.py +120 -25
  121. clearskies/query/query.py +1 -4
  122. clearskies/secrets/__init__.py +2 -1
  123. clearskies/secrets/akeyless.py +12 -10
  124. clearskies/secrets/secrets.py +7 -2
  125. clearskies/security_header.py +4 -2
  126. clearskies/security_headers/cache_control.py +15 -14
  127. clearskies/security_headers/cors.py +10 -9
  128. clearskies/security_headers/csp.py +25 -24
  129. clearskies/security_headers/hsts.py +6 -5
  130. clearskies/typing.py +1 -1
  131. clearskies/validator.py +5 -6
  132. clearskies/validators/after_column.py +6 -7
  133. clearskies/validators/before_column.py +2 -0
  134. clearskies/validators/in_the_future.py +5 -8
  135. clearskies/validators/in_the_future_at_least.py +2 -0
  136. clearskies/validators/in_the_future_at_most.py +2 -0
  137. clearskies/validators/in_the_past.py +5 -8
  138. clearskies/validators/in_the_past_at_least.py +2 -0
  139. clearskies/validators/in_the_past_at_most.py +2 -0
  140. clearskies/validators/maximum_length.py +4 -5
  141. clearskies/validators/maximum_value.py +4 -4
  142. clearskies/validators/minimum_length.py +4 -4
  143. clearskies/validators/minimum_value.py +4 -4
  144. clearskies/validators/required.py +2 -4
  145. clearskies/validators/timedelta.py +8 -9
  146. clearskies/validators/unique.py +2 -3
  147. clear_skies-2.0.6.dist-info/RECORD +0 -251
  148. {clear_skies-2.0.6.dist-info → clear_skies-2.0.8.dist-info}/WHEEL +0 -0
  149. {clear_skies-2.0.6.dist-info → clear_skies-2.0.8.dist-info}/licenses/LICENSE +0 -0
@@ -2,14 +2,11 @@ from __future__ import annotations
2
2
 
3
3
  from typing import TYPE_CHECKING, Any
4
4
 
5
- import clearskies.decorators
6
- import clearskies.di
7
- import clearskies.typing
8
- from clearskies import configs
5
+ from clearskies import configs, decorators, di
9
6
  from clearskies.columns.string import String
10
7
 
11
8
  if TYPE_CHECKING:
12
- from clearskies import Model
9
+ from clearskies import Model, typing
13
10
 
14
11
 
15
12
  class Uuid(String):
@@ -63,17 +60,17 @@ class Uuid(String):
63
60
  is_writeable = configs.Boolean(default=False)
64
61
  _descriptor_config_map = None
65
62
 
66
- uuid = clearskies.di.inject.Uuid()
63
+ uuid = di.inject.Uuid()
67
64
 
68
- @clearskies.decorators.parameters_to_properties
65
+ @decorators.parameters_to_properties
69
66
  def __init__(
70
67
  self,
71
68
  is_readable: bool = True,
72
69
  is_searchable: bool = True,
73
70
  is_temporary: bool = False,
74
- on_change_pre_save: clearskies.typing.action | list[clearskies.typing.action] = [],
75
- on_change_post_save: clearskies.typing.action | list[clearskies.typing.action] = [],
76
- on_change_save_finished: clearskies.typing.action | list[clearskies.typing.action] = [],
71
+ on_change_pre_save: typing.action | list[typing.action] = [],
72
+ on_change_post_save: typing.action | list[typing.action] = [],
73
+ on_change_save_finished: typing.action | list[typing.action] = [],
77
74
  ):
78
75
  pass
79
76
 
clearskies/configs/any.py CHANGED
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Any as AnyType
2
4
 
3
5
  from clearskies.configs import config
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Any
2
4
 
3
5
  from clearskies.configs import config
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Any, Callable
2
4
 
3
5
  from clearskies.configs import config
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import config
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Callable
2
4
 
3
5
  from clearskies.configs import config
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Callable as CallableType
2
4
 
3
5
  from clearskies.configs import config
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Any
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import datetime
2
4
 
3
5
  from clearskies.configs import config
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import datetime
2
4
  from typing import Callable
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import config
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Callable
2
4
 
3
5
  from clearskies.configs import config
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import config
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Callable
2
4
 
3
5
  from clearskies.configs import config
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Any
2
4
 
3
5
  from clearskies.configs import config
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Any, Callable
2
4
 
3
5
  from clearskies.configs import config
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import select
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import select_list
2
4
 
3
5
 
@@ -1,5 +1,6 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs.string import String
2
- from clearskies.functional import string
3
4
 
4
5
 
5
6
  class ModelDestinationName(String):
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import model_column
2
4
  from clearskies.functional import string
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import model_column
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import model_columns
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import model_columns
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import string
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import config
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import config
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import config
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import config
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Callable
2
4
 
3
5
  from clearskies.configs import config
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import datetime
2
4
 
3
5
  from clearskies.configs import config
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import datetime
2
4
 
3
5
  from clearskies.configs import config
clearskies/configs/url.py CHANGED
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import string
2
4
  from clearskies.functional import routing
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import model_column
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from clearskies.configs import model_columns
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Any
2
4
 
3
5
  from clearskies.configs import config
@@ -4,7 +4,7 @@ from clearskies.input_outputs import Cli as CliInputOutput
4
4
 
5
5
  class Cli(Context):
6
6
  """
7
- Run an application via a CLI command
7
+ Run an application via a CLI command.
8
8
 
9
9
  This context converts a clearskies application into a CLI command. Here's a simple example:
10
10
 
@@ -12,9 +12,11 @@ class Cli(Context):
12
12
  #!/usr/bin/env python
13
13
  import clearskies
14
14
 
15
+
15
16
  def my_function():
16
17
  return "Hello World!"
17
18
 
19
+
18
20
  cli = clearskies.contexts.Cli(my_function)
19
21
  cli()
20
22
  ```
@@ -32,9 +34,11 @@ class Cli(Context):
32
34
  #!/usr/bin/env python
33
35
  import clearskies
34
36
 
37
+
35
38
  def my_function(name):
36
39
  return f"Hello {name}!"
37
40
 
41
+
38
42
  cli = clearskies.contexts.Cli(
39
43
  clearskies.endpoints.Callable(
40
44
  my_function,
@@ -59,9 +63,11 @@ class Cli(Context):
59
63
  #!/usr/bin/env python
60
64
  import clearskies
61
65
 
66
+
62
67
  def my_function(name):
63
68
  return f"Hello {name}!"
64
69
 
70
+
65
71
  cli = clearskies.contexts.Cli(
66
72
  clearskies.endpoints.Callable(
67
73
  my_function,
@@ -87,9 +93,11 @@ class Cli(Context):
87
93
  #!/usr/bin/env python
88
94
  import clearskies
89
95
 
96
+
90
97
  def my_function(request_data):
91
98
  return request_data
92
99
 
100
+
93
101
  cli = clearskies.contexts.Cli(
94
102
  clearskies.endpoints.Callable(
95
103
  my_function,
@@ -4,20 +4,19 @@ import datetime
4
4
  from types import ModuleType
5
5
  from typing import TYPE_CHECKING, Any, Callable
6
6
 
7
- import clearskies.endpoint
8
- import clearskies.endpoint_group
7
+ from clearskies import exceptions
9
8
  from clearskies.di import Di
10
9
  from clearskies.di.additional_config import AdditionalConfig
11
10
  from clearskies.input_outputs import Programmatic
12
11
 
13
12
  if TYPE_CHECKING:
13
+ from clearskies.endpoint import Endpoint
14
+ from clearskies.endpoint_group import EndpointGroup
14
15
  from clearskies.input_outputs import InputOutput
15
16
 
16
17
 
17
18
  class Context:
18
- """
19
- Context: a flexible way to connect applications to hosting strategies.
20
- """
19
+ """Context: a flexible way to connect applications to hosting strategies."""
21
20
 
22
21
  di: Di = None # type: ignore
23
22
 
@@ -26,13 +25,13 @@ class Context:
26
25
 
27
26
  This can be a callable, an endpoint, or an endpoint group. If passed a callable, the callable can request any
28
27
  standard or defined dependencies and should return the desired response. It can also raise any exception from
29
- clearskies.exceptions.
28
+ exceptions.
30
29
  """
31
- application: Callable | clearskies.endpoint.Endpoint | clearskies.endpoint_group.EndpointGroup = None # type: ignore
30
+ application: Callable | Endpoint | EndpointGroup = None # type: ignore
32
31
 
33
32
  def __init__(
34
33
  self,
35
- application: Callable | clearskies.endpoint.Endpoint | clearskies.endpoint_group.EndpointGroup,
34
+ application: Callable | Endpoint | EndpointGroup,
36
35
  classes: type | list[type] = [],
37
36
  modules: ModuleType | list[ModuleType] = [],
38
37
  bindings: dict[str, Any] = {},
@@ -63,17 +62,17 @@ class Context:
63
62
  return input_output.respond(
64
63
  self.di.call_function(self.application, **input_output.get_context_for_callables())
65
64
  )
66
- except clearskies.exceptions.ClientError as e:
65
+ except exceptions.ClientError as e:
67
66
  return input_output.respond(str(e), 400)
68
- except clearskies.exceptions.Authentication as e:
67
+ except exceptions.Authentication as e:
69
68
  return input_output.respond(str(e), 401)
70
- except clearskies.exceptions.Authorization as e:
69
+ except exceptions.Authorization as e:
71
70
  return input_output.respond(str(e), 403)
72
- except clearskies.exceptions.NotFound as e:
71
+ except exceptions.NotFound as e:
73
72
  return input_output.respond(str(e), 404)
74
- except clearskies.exceptions.MovedPermanently as e:
73
+ except exceptions.MovedPermanently as e:
75
74
  return input_output.respond(str(e), 302)
76
- except clearskies.exceptions.MovedTemporarily as e:
75
+ except exceptions.MovedTemporarily as e:
77
76
  return input_output.respond(str(e), 307)
78
77
 
79
78
  def __call__(
@@ -1,14 +1,11 @@
1
- import datetime
2
- from types import ModuleType
3
- from typing import Any, Callable
4
- from wsgiref.simple_server import make_server
5
- from wsgiref.util import setup_testing_defaults
6
-
7
- import clearskies.endpoint
8
- import clearskies.endpoint_group
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
9
5
  from clearskies.contexts.context import Context
10
- from clearskies.di import AdditionalConfig
11
- from clearskies.input_outputs import Wsgi as WsgiInputOutput
6
+
7
+ if TYPE_CHECKING:
8
+ from clearskies.input_outputs import Wsgi as WsgiInputOutput
12
9
 
13
10
 
14
11
  class Wsgi(Context):
@@ -24,11 +21,14 @@ class Wsgi(Context):
24
21
  ```
25
22
  import clearskies
26
23
 
24
+
27
25
  def hello_world():
28
26
  return "Hello World!"
29
27
 
28
+
30
29
  wsgi = clearskies.contexts.Wsgi(hello_world)
31
30
 
31
+
32
32
  def application(environment, start_response):
33
33
  return wsgi(environment, start_response)
34
34
  ```
@@ -52,9 +52,11 @@ class Wsgi(Context):
52
52
  ```
53
53
  import clearskies
54
54
 
55
+
55
56
  def hello_world():
56
57
  return "Hello World!"
57
58
 
59
+
58
60
  def application(environment, start_response):
59
61
  wsgi = clearskies.contexts.Wsgi(hello_world)
60
62
  return wsgi(environment, start_response)
@@ -1,14 +1,18 @@
1
+ from __future__ import annotations
2
+
1
3
  import datetime
2
4
  from types import ModuleType
3
- from typing import Any, Callable
5
+ from typing import TYPE_CHECKING, Any, Callable
4
6
  from wsgiref.simple_server import make_server
5
7
  from wsgiref.util import setup_testing_defaults
6
8
 
7
- import clearskies.endpoint
8
- import clearskies.endpoint_group
9
9
  from clearskies.contexts.context import Context
10
- from clearskies.di import AdditionalConfig
11
- from clearskies.input_outputs import Wsgi as WsgiInputOutput
10
+
11
+ if TYPE_CHECKING:
12
+ from clearskies.di import AdditionalConfig
13
+ from clearskies.endpoint import Endpoint
14
+ from clearskies.endpoint_group import EndpointGroup
15
+ from clearskies.input_outputs import Wsgi as WsgiInputOutput
12
16
 
13
17
 
14
18
  class WsgiRef(Context):
@@ -26,9 +30,11 @@ class WsgiRef(Context):
26
30
  #!/usr/bin/env python
27
31
  import clearskies
28
32
 
33
+
29
34
  def hello_world(name):
30
35
  return f"Hello {name}!"
31
36
 
37
+
32
38
  wsgi = clearskies.contexts.WsgiRef(
33
39
  clearskies.endpoints.Callable(
34
40
  hello_world,
@@ -49,7 +55,7 @@ class WsgiRef(Context):
49
55
 
50
56
  def __init__(
51
57
  self,
52
- application: Callable | clearskies.endpoint.Endpoint | clearskies.endpoint_group.EndpointGroup,
58
+ application: Callable | Endpoint | EndpointGroup,
53
59
  port: int = 8080,
54
60
  classes: type | list[type] = [],
55
61
  modules: ModuleType | list[ModuleType] = [],
clearskies/decorators.py CHANGED
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import inspect
4
4
 
5
- import wrapt # type: ignore
5
+ import wrapt
6
6
 
7
7
 
8
8
  @wrapt.decorator
@@ -0,0 +1,10 @@
1
+ # decorators.pyi
2
+ from typing import Any, Callable, TypeVar
3
+
4
+ # A TypeVar is used to say "whatever kind of function comes in,
5
+ # the same kind of function goes out."
6
+ _F = TypeVar("_F", bound=Callable[..., Any])
7
+
8
+ # This is the type signature for your decorator.
9
+ # It tells Pylance that it preserves the signature of the function it wraps.
10
+ def parameters_to_properties(wrapped: _F) -> _F: ...
clearskies/di/__init__.py CHANGED
@@ -9,6 +9,7 @@ __all__ = [
9
9
  "AdditionalConfig",
10
10
  "AdditionalConfigAutoImport",
11
11
  "Di",
12
+ "Injectable",
12
13
  "InjectableProperties",
13
- "injectInjectable",
14
+ "inject",
14
15
  ]
clearskies/di/di.py CHANGED
@@ -11,7 +11,6 @@ from requests.adapters import HTTPAdapter
11
11
  from requests.packages.urllib3.util.retry import Retry # type: ignore
12
12
 
13
13
  import clearskies.input_outputs.input_output
14
- import clearskies.secrets
15
14
  from clearskies.di.additional_config import AdditionalConfig
16
15
  from clearskies.di.additional_config_auto_import import AdditionalConfigAutoImport
17
16
  from clearskies.environment import Environment
@@ -350,9 +349,9 @@ class Di:
350
349
  import my_module
351
350
 
352
351
  di = Di()
353
- di.add_modules([
354
- my_module
355
- ]) # also equivalent: di.add_modules(my_module), or Di(modules=[my_module])
352
+ di.add_modules(
353
+ [my_module]
354
+ ) # also equivalent: di.add_modules(my_module), or Di(modules=[my_module])
356
355
 
357
356
 
358
357
  def my_function(my_class):
@@ -956,6 +955,8 @@ class Di:
956
955
  return uuid
957
956
 
958
957
  def provide_secrets(self):
958
+ import clearskies.secrets
959
+
959
960
  return clearskies.secrets.Secrets()
960
961
 
961
962
  def provide_memory_backend_default_data(self):
@@ -964,8 +965,8 @@ class Di:
964
965
  def provide_global_table_prefix(self):
965
966
  return ""
966
967
 
967
- def provide_akeyless(self):
968
- import akeyless # type: ignore
968
+ def provide_akeyles_sdk(self):
969
+ import akeyless # type: ignore[import-untyped]
969
970
 
970
971
  return akeyless
971
972
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Any
2
4
 
3
5
  from clearskies.di.injectable import Injectable
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Any
2
4
 
3
5
  from clearskies.di.injectable import Injectable
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from typing import Any
2
4
 
3
5
  from clearskies.di.injectable import Injectable
@@ -1,4 +1,4 @@
1
- import requests
1
+ from __future__ import annotations
2
2
 
3
3
  from clearskies.di.injectable import Injectable
4
4
  from clearskies.environment import Environment as EnvironmentDependency
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import datetime
2
4
 
3
5
  from clearskies.di.injectable import Injectable
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import requests
2
4
 
3
5
  from clearskies.di.injectable import Injectable
@@ -1,7 +1,7 @@
1
- import datetime
1
+ from __future__ import annotations
2
2
 
3
3
  from clearskies.di.injectable import Injectable
4
- from clearskies.secrets import Secrets as SecretsHelper
4
+ from clearskies.secrets.secrets import Secrets as SecretsHelper
5
5
 
6
6
 
7
7
  class Secrets(Injectable):
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import datetime
2
4
 
3
5
  from clearskies.di.injectable import Injectable
@@ -1,6 +1,6 @@
1
- import datetime
1
+ from __future__ import annotations
2
+
2
3
  import types
3
- import uuid
4
4
 
5
5
  from clearskies.di.injectable import Injectable
6
6