faststream_fastapi 1.1.0__tar.gz → 1.2.1__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 (28) hide show
  1. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/PKG-INFO +1 -1
  2. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/pyproject.toml +13 -12
  3. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/fastapi_compat.py +1 -1
  4. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/get_dependant.py +22 -6
  5. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/asyncapi_config.py +3 -3
  6. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/LICENSE +0 -0
  7. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/README.md +0 -0
  8. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/__about__.py +0 -0
  9. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/__init__.py +0 -0
  10. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/__init__.py +0 -0
  11. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/asyncapi_router.py +0 -0
  12. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/background_middleware.py +0 -0
  13. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/config.py +0 -0
  14. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/fs_re_exports/__init__.py +0 -0
  15. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/fs_re_exports/_compat.py +0 -0
  16. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/fs_re_exports/application.py +0 -0
  17. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/fs_re_exports/broker.py +0 -0
  18. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/fs_re_exports/constants.py +0 -0
  19. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/fs_re_exports/context.py +0 -0
  20. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/fs_re_exports/di.py +0 -0
  21. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/fs_re_exports/logger.py +0 -0
  22. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/logger.py +0 -0
  23. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/replace_context.py +0 -0
  24. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/_internal/wrap_callable_to_fastapi_compatible.py +0 -0
  25. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/context.py +0 -0
  26. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/faststream_api.py +0 -0
  27. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/py.typed +0 -0
  28. {faststream_fastapi-1.1.0 → faststream_fastapi-1.2.1}/src/faststream_fastapi/stream_message.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: faststream_fastapi
3
- Version: 1.1.0
3
+ Version: 1.2.1
4
4
  Summary: FastAPI integration for FastStream
5
5
  Keywords: rabbitmq,kafka,nats,redis,mqtt,asyncapi,framework,message brokers,fastapi
6
6
  Author: Ivan Kirpichnikov
@@ -13,7 +13,7 @@ license = "MIT"
13
13
  license-files = ["LICENSE"]
14
14
 
15
15
  requires-python = ">=3.10"
16
- version = "1.1.0"
16
+ version = "1.2.1"
17
17
 
18
18
  keywords = [
19
19
  "rabbitmq",
@@ -63,33 +63,34 @@ dependencies = [
63
63
 
64
64
  [dependency-groups]
65
65
  linters = [
66
- "ruff==0.15.20",
66
+ "ruff==0.16.0",
67
67
  "typos==1.48.0",
68
68
  "codespell==2.4.3",
69
69
  ]
70
70
  static_analysis = [
71
- "mypy==2.1.0",
71
+ "mypy==2.3.0",
72
72
  "bandit==1.9.4",
73
- "semgrep==1.169.0",
74
- "zizmor==1.27.0",
73
+ "semgrep==1.171.0",
74
+ "zizmor==1.28.0",
75
75
  ]
76
76
  docs = [
77
- "zensical==0.0.50",
77
+ "zensical==0.0.51",
78
78
  "mkdocstrings[python]==1.0.6",
79
79
  ]
80
80
 
81
81
  testing = [
82
- "pytest==9.0.3",
83
- "pytest-asyncio==1.3.0",
84
- "pytest-xdist>=3.8.0",
82
+ "pytest==9.1.1",
83
+ "pytest-asyncio==1.4.0",
84
+ "pytest-xdist==3.8.0",
85
85
  "pytest-timeout==2.4.0",
86
- "pytest-cov>=6.2.1",
87
- "covdefaults>=2.3.0",
86
+ "pytest-cov==7.1.0",
87
+ "covdefaults==2.3.0",
88
88
  { include-group = "testing-dependencies" },
89
89
  ]
90
90
  testing-dependencies = [
91
91
  "httpx2==2.5.0",
92
- "asgi-lifespan==2.1.0",
92
+ "asgi_lifespan==2.1.0",
93
+ "zmqtt==0.0.5",
93
94
  "faststream[rabbit,kafka,confluent,nats,redis,mqtt]>=0.7.0",
94
95
  ]
95
96
 
@@ -82,7 +82,7 @@ else:
82
82
  errors: list[Any],
83
83
  body: dict[str, Any],
84
84
  ) -> Never:
85
- raise RequestValidationError(errors, ROUTER_VALIDATION_ERROR_MODEL) # type: ignore[misc]
85
+ raise RequestValidationError(errors, ROUTER_VALIDATION_ERROR_MODEL) # type: ignore[call-arg]
86
86
 
87
87
 
88
88
  if FASTAPI_v102_3:
@@ -1,5 +1,6 @@
1
1
  import inspect
2
2
  from collections.abc import Callable, Iterable
3
+ from dataclasses import fields
3
4
  from typing import Annotated, Any, Final, cast, get_args, get_origin
4
5
 
5
6
  from fast_depends.library.serializer import OptionItem
@@ -16,10 +17,25 @@ from pydantic import Field, create_model
16
17
  from faststream_fastapi._internal.fs_re_exports._compat import PYDANTIC_V2, PydanticUndefined
17
18
 
18
19
 
20
+ class _FastStreamDependant(Dependant):
21
+ """FastAPI dependant extended with fields required by FastStream."""
22
+
23
+ model: type[Any]
24
+ custom_fields: dict[str, Any]
25
+ flat_params: list[OptionItem]
26
+
27
+
28
+ def _extend_fastapi_dependant(dependant: Dependant) -> _FastStreamDependant:
29
+ field_values = {
30
+ field.name: getattr(dependant, field.name) for field in fields(dependant) if field.init
31
+ }
32
+ return _FastStreamDependant(**field_values)
33
+
34
+
19
35
  def get_fastapi_dependant(
20
36
  orig_call: Callable[..., Any],
21
37
  dependencies: Iterable[Depends],
22
- ) -> Dependant:
38
+ ) -> _FastStreamDependant:
23
39
  dependent = get_fastapi_native_dependant(orig_call=orig_call, dependencies=dependencies)
24
40
  return _patch_fastapi_dependent(dependent)
25
41
 
@@ -42,7 +58,8 @@ def get_fastapi_native_dependant(
42
58
  return dependent
43
59
 
44
60
 
45
- def _patch_fastapi_dependent(dependant: Dependant) -> Dependant:
61
+ def _patch_fastapi_dependent(dependant: Dependant) -> _FastStreamDependant:
62
+ dependant = _extend_fastapi_dependant(dependant)
46
63
  params = dependant.query_params + dependant.body_params
47
64
 
48
65
  for d in dependant.dependencies:
@@ -118,12 +135,11 @@ def _patch_fastapi_dependent(dependant: Dependant) -> Dependant:
118
135
  f,
119
136
  )
120
137
 
121
- dependant.model = create_model( # type: ignore[attr-defined]
138
+ dependant.model = create_model(
122
139
  getattr(call, "__name__", type(call).__name__),
123
140
  )
124
-
125
- dependant.custom_fields = {} # type: ignore[attr-defined]
126
- dependant.flat_params = [ # type: ignore[attr-defined]
141
+ dependant.custom_fields = {}
142
+ dependant.flat_params = [
127
143
  OptionItem(field_name=name, field_type=type_, default_value=default)
128
144
  for name, (type_, default) in params_unique.items()
129
145
  ]
@@ -24,9 +24,9 @@ class AsyncAPIConfig:
24
24
  tags: Sequence[Tag | TagDict | dict[str, Any]] | None = None,
25
25
  unique_id: str | None = None,
26
26
  include_in_schema: bool = False,
27
- asyncapi_json_path: str | None | _Empty = _EMPTY,
28
- asyncapi_yaml_path: str | None | _Empty = _EMPTY,
29
- try_it_out_path: str | None | _Empty = _EMPTY,
27
+ asyncapi_json_path: str | _Empty | None = _EMPTY,
28
+ asyncapi_yaml_path: str | _Empty | None = _EMPTY,
29
+ try_it_out_path: str | _Empty | None = _EMPTY,
30
30
  sidebar: bool = True,
31
31
  info: bool = True,
32
32
  servers: bool = True,