haiway 0.6.2__tar.gz → 0.6.4__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 (51) hide show
  1. {haiway-0.6.2/src/haiway.egg-info → haiway-0.6.4}/PKG-INFO +1 -1
  2. {haiway-0.6.2 → haiway-0.6.4}/pyproject.toml +1 -1
  3. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/__init__.py +3 -1
  4. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/state/__init__.py +4 -0
  5. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/state/attributes.py +15 -14
  6. haiway-0.6.4/src/haiway/state/path.py +524 -0
  7. haiway-0.6.4/src/haiway/state/requirement.py +229 -0
  8. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/state/structure.py +15 -0
  9. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/state/validation.py +9 -2
  10. {haiway-0.6.2 → haiway-0.6.4/src/haiway.egg-info}/PKG-INFO +1 -1
  11. {haiway-0.6.2 → haiway-0.6.4}/src/haiway.egg-info/SOURCES.txt +3 -0
  12. haiway-0.6.4/tests/test_attribute_path.py +250 -0
  13. {haiway-0.6.2 → haiway-0.6.4}/LICENSE +0 -0
  14. {haiway-0.6.2 → haiway-0.6.4}/README.md +0 -0
  15. {haiway-0.6.2 → haiway-0.6.4}/setup.cfg +0 -0
  16. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/context/__init__.py +0 -0
  17. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/context/access.py +0 -0
  18. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/context/disposables.py +0 -0
  19. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/context/metrics.py +0 -0
  20. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/context/state.py +0 -0
  21. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/context/tasks.py +0 -0
  22. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/context/types.py +0 -0
  23. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/helpers/__init__.py +0 -0
  24. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/helpers/asynchrony.py +0 -0
  25. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/helpers/caching.py +0 -0
  26. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/helpers/retries.py +0 -0
  27. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/helpers/throttling.py +0 -0
  28. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/helpers/timeouted.py +0 -0
  29. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/helpers/tracing.py +0 -0
  30. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/py.typed +0 -0
  31. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/types/__init__.py +0 -0
  32. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/types/frozen.py +0 -0
  33. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/types/missing.py +0 -0
  34. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/utils/__init__.py +0 -0
  35. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/utils/always.py +0 -0
  36. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/utils/env.py +0 -0
  37. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/utils/immutable.py +0 -0
  38. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/utils/logs.py +0 -0
  39. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/utils/mimic.py +0 -0
  40. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/utils/noop.py +0 -0
  41. {haiway-0.6.2 → haiway-0.6.4}/src/haiway/utils/queue.py +0 -0
  42. {haiway-0.6.2 → haiway-0.6.4}/src/haiway.egg-info/dependency_links.txt +0 -0
  43. {haiway-0.6.2 → haiway-0.6.4}/src/haiway.egg-info/requires.txt +0 -0
  44. {haiway-0.6.2 → haiway-0.6.4}/src/haiway.egg-info/top_level.txt +0 -0
  45. {haiway-0.6.2 → haiway-0.6.4}/tests/test_async_queue.py +0 -0
  46. {haiway-0.6.2 → haiway-0.6.4}/tests/test_auto_retry.py +0 -0
  47. {haiway-0.6.2 → haiway-0.6.4}/tests/test_cache.py +0 -0
  48. {haiway-0.6.2 → haiway-0.6.4}/tests/test_context.py +0 -0
  49. {haiway-0.6.2 → haiway-0.6.4}/tests/test_state.py +0 -0
  50. {haiway-0.6.2 → haiway-0.6.4}/tests/test_streaming.py +0 -0
  51. {haiway-0.6.2 → haiway-0.6.4}/tests/test_timeout.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: haiway
3
- Version: 0.6.2
3
+ Version: 0.6.4
4
4
  Summary: Framework for dependency injection and state management within structured concurrency model.
5
5
  Maintainer-email: Kacper Kaliński <kacper.kalinski@miquido.com>
6
6
  License: MIT License
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "haiway"
7
7
  description = "Framework for dependency injection and state management within structured concurrency model."
8
- version = "0.6.2"
8
+ version = "0.6.4"
9
9
  readme = "README.md"
10
10
  maintainers = [
11
11
  { name = "Kacper Kaliński", email = "kacper.kalinski@miquido.com" },
@@ -17,7 +17,7 @@ from haiway.helpers import (
17
17
  traced,
18
18
  wrap_async,
19
19
  )
20
- from haiway.state import State
20
+ from haiway.state import AttributePath, AttributeRequirement, State
21
21
  from haiway.types import (
22
22
  MISSING,
23
23
  Missing,
@@ -46,6 +46,8 @@ __all__ = [
46
46
  "MISSING",
47
47
  "ArgumentsTrace",
48
48
  "AsyncQueue",
49
+ "AttributePath",
50
+ "AttributeRequirement",
49
51
  "Disposable",
50
52
  "Disposables",
51
53
  "Missing",
@@ -1,8 +1,12 @@
1
1
  from haiway.state.attributes import AttributeAnnotation, attribute_annotations
2
+ from haiway.state.path import AttributePath
3
+ from haiway.state.requirement import AttributeRequirement
2
4
  from haiway.state.structure import State
3
5
 
4
6
  __all__ = [
5
7
  "AttributeAnnotation",
8
+ "AttributePath",
9
+ "AttributeRequirement",
6
10
  "State",
7
11
  "attribute_annotations",
8
12
  ]
@@ -19,6 +19,7 @@ from typing import (
19
19
  __all__ = [
20
20
  "AttributeAnnotation",
21
21
  "attribute_annotations",
22
+ "resolve_attribute_annotation",
22
23
  ]
23
24
 
24
25
 
@@ -68,7 +69,7 @@ def attribute_annotations(
68
69
  if ((get_origin(annotation) or annotation) is ClassVar) or key.startswith("_"):
69
70
  continue
70
71
 
71
- attributes[key] = _resolve_attribute_annotation(
72
+ attributes[key] = resolve_attribute_annotation(
72
73
  annotation,
73
74
  self_annotation=self_annotation,
74
75
  type_parameters=type_parameters,
@@ -80,7 +81,7 @@ def attribute_annotations(
80
81
  return attributes
81
82
 
82
83
 
83
- def _resolve_attribute_annotation( # noqa: C901, PLR0911, PLR0912, PLR0913
84
+ def resolve_attribute_annotation( # noqa: C901, PLR0911, PLR0912, PLR0913
84
85
  annotation: Any,
85
86
  /,
86
87
  self_annotation: AttributeAnnotation | None,
@@ -100,7 +101,7 @@ def _resolve_attribute_annotation( # noqa: C901, PLR0911, PLR0912, PLR0913
100
101
 
101
102
  # forward reference through string
102
103
  case str() as forward_ref:
103
- return _resolve_attribute_annotation(
104
+ return resolve_attribute_annotation(
104
105
  ForwardRef(forward_ref, module=module)._evaluate(
105
106
  globalns=None,
106
107
  localns=localns,
@@ -115,7 +116,7 @@ def _resolve_attribute_annotation( # noqa: C901, PLR0911, PLR0912, PLR0913
115
116
 
116
117
  # forward reference directly
117
118
  case typing.ForwardRef() as reference:
118
- return _resolve_attribute_annotation(
119
+ return resolve_attribute_annotation(
119
120
  reference._evaluate(
120
121
  globalns=None,
121
122
  localns=localns,
@@ -137,7 +138,7 @@ def _resolve_attribute_annotation( # noqa: C901, PLR0911, PLR0912, PLR0913
137
138
  origin=TypeAliasType,
138
139
  arguments=[],
139
140
  )
140
- resolved: AttributeAnnotation = _resolve_attribute_annotation(
141
+ resolved: AttributeAnnotation = resolve_attribute_annotation(
141
142
  alias.__value__,
142
143
  self_annotation=None,
143
144
  type_parameters=type_parameters,
@@ -169,7 +170,7 @@ def _resolve_attribute_annotation( # noqa: C901, PLR0911, PLR0912, PLR0913
169
170
  return AttributeAnnotation(
170
171
  origin=parametrized,
171
172
  arguments=[
172
- _resolve_attribute_annotation(
173
+ resolve_attribute_annotation(
173
174
  argument,
174
175
  self_annotation=self_annotation,
175
176
  type_parameters=type_parameters,
@@ -193,7 +194,7 @@ def _resolve_attribute_annotation( # noqa: C901, PLR0911, PLR0912, PLR0913
193
194
  return AttributeAnnotation(
194
195
  origin=origin,
195
196
  arguments=[
196
- _resolve_attribute_annotation(
197
+ resolve_attribute_annotation(
197
198
  argument,
198
199
  self_annotation=self_annotation,
199
200
  type_parameters=type_parameters,
@@ -211,7 +212,7 @@ def _resolve_attribute_annotation( # noqa: C901, PLR0911, PLR0912, PLR0913
211
212
  origin=TypeAliasType,
212
213
  arguments=[],
213
214
  )
214
- resolved: AttributeAnnotation = _resolve_attribute_annotation(
215
+ resolved: AttributeAnnotation = resolve_attribute_annotation(
215
216
  alias.__value__,
216
217
  self_annotation=None,
217
218
  type_parameters=type_parameters,
@@ -225,7 +226,7 @@ def _resolve_attribute_annotation( # noqa: C901, PLR0911, PLR0912, PLR0913
225
226
 
226
227
  # type parameter
227
228
  case typing.TypeVar():
228
- return _resolve_attribute_annotation(
229
+ return resolve_attribute_annotation(
229
230
  # try to resolve it from current parameters if able
230
231
  type_parameters.get(
231
232
  annotation.__name__,
@@ -270,7 +271,7 @@ def _resolve_attribute_annotation( # noqa: C901, PLR0911, PLR0912, PLR0913
270
271
  arguments=[
271
272
  recursion_guard.get(
272
273
  argument,
273
- _resolve_attribute_annotation(
274
+ resolve_attribute_annotation(
274
275
  argument,
275
276
  self_annotation=self_annotation,
276
277
  type_parameters=type_parameters,
@@ -287,7 +288,7 @@ def _resolve_attribute_annotation( # noqa: C901, PLR0911, PLR0912, PLR0913
287
288
  return AttributeAnnotation(
288
289
  origin=typing.Callable,
289
290
  arguments=[
290
- _resolve_attribute_annotation(
291
+ resolve_attribute_annotation(
291
292
  argument,
292
293
  self_annotation=self_annotation,
293
294
  type_parameters=type_parameters,
@@ -314,7 +315,7 @@ def _resolve_attribute_annotation( # noqa: C901, PLR0911, PLR0912, PLR0913
314
315
 
315
316
  # unwrap from irrelevant type wrappers
316
317
  case typing.Annotated | typing.Final | typing.Required | typing.NotRequired:
317
- return _resolve_attribute_annotation(
318
+ return resolve_attribute_annotation(
318
319
  get_args(annotation)[0],
319
320
  self_annotation=self_annotation,
320
321
  type_parameters=type_parameters,
@@ -327,7 +328,7 @@ def _resolve_attribute_annotation( # noqa: C901, PLR0911, PLR0912, PLR0913
327
328
  return AttributeAnnotation(
328
329
  origin=UnionType, # pyright: ignore[reportArgumentType]
329
330
  arguments=[
330
- _resolve_attribute_annotation(
331
+ resolve_attribute_annotation(
331
332
  get_args(annotation)[0],
332
333
  self_annotation=self_annotation,
333
334
  type_parameters=type_parameters,
@@ -352,7 +353,7 @@ def _resolve_attribute_annotation( # noqa: C901, PLR0911, PLR0912, PLR0913
352
353
  return AttributeAnnotation(
353
354
  origin=other,
354
355
  arguments=[
355
- _resolve_attribute_annotation(
356
+ resolve_attribute_annotation(
356
357
  argument,
357
358
  self_annotation=self_annotation,
358
359
  type_parameters=type_parameters,