fastapi 0.115.13__py3-none-any.whl → 0.116.0__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 fastapi might be problematic. Click here for more details.

fastapi/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
2
2
 
3
- __version__ = "0.115.13"
3
+ __version__ = "0.116.0"
4
4
 
5
5
  from starlette import status as status
6
6
 
@@ -816,6 +816,25 @@ def request_params_to_args(
816
816
  return values, errors
817
817
 
818
818
 
819
+ def is_union_of_base_models(field_type: Any) -> bool:
820
+ """Check if field type is a Union where all members are BaseModel subclasses."""
821
+ from fastapi.types import UnionType
822
+
823
+ origin = get_origin(field_type)
824
+
825
+ # Check if it's a Union type (covers both typing.Union and types.UnionType in Python 3.10+)
826
+ if origin is not Union and origin is not UnionType:
827
+ return False
828
+
829
+ union_args = get_args(field_type)
830
+
831
+ for arg in union_args:
832
+ if not lenient_issubclass(arg, BaseModel):
833
+ return False
834
+
835
+ return True
836
+
837
+
819
838
  def _should_embed_body_fields(fields: List[ModelField]) -> bool:
820
839
  if not fields:
821
840
  return False
@@ -829,10 +848,12 @@ def _should_embed_body_fields(fields: List[ModelField]) -> bool:
829
848
  # If it explicitly specifies it is embedded, it has to be embedded
830
849
  if getattr(first_field.field_info, "embed", None):
831
850
  return True
832
- # If it's a Form (or File) field, it has to be a BaseModel to be top level
851
+ # If it's a Form (or File) field, it has to be a BaseModel (or a union of BaseModels) to be top level
833
852
  # otherwise it has to be embedded, so that the key value pair can be extracted
834
- if isinstance(first_field.field_info, params.Form) and not lenient_issubclass(
835
- first_field.type_, BaseModel
853
+ if (
854
+ isinstance(first_field.field_info, params.Form)
855
+ and not lenient_issubclass(first_field.type_, BaseModel)
856
+ and not is_union_of_base_models(first_field.type_)
836
857
  ):
837
858
  return True
838
859
  return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastapi
3
- Version: 0.115.13
3
+ Version: 0.116.0
4
4
  Summary: FastAPI framework, high performance, easy to learn, fast to code, ready for production
5
5
  Author-Email: =?utf-8?q?Sebasti=C3=A1n_Ram=C3=ADrez?= <tiangolo@gmail.com>
6
6
  Classifier: Intended Audience :: Information Technology
@@ -42,14 +42,21 @@ Requires-Dist: starlette<0.47.0,>=0.40.0
42
42
  Requires-Dist: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4
43
43
  Requires-Dist: typing-extensions>=4.8.0
44
44
  Provides-Extra: standard
45
- Requires-Dist: fastapi-cli[standard]>=0.0.5; extra == "standard"
45
+ Requires-Dist: fastapi-cli[standard]>=0.0.8; extra == "standard"
46
46
  Requires-Dist: httpx>=0.23.0; extra == "standard"
47
47
  Requires-Dist: jinja2>=3.1.5; extra == "standard"
48
48
  Requires-Dist: python-multipart>=0.0.18; extra == "standard"
49
49
  Requires-Dist: email-validator>=2.0.0; extra == "standard"
50
50
  Requires-Dist: uvicorn[standard]>=0.12.0; extra == "standard"
51
+ Provides-Extra: standard-no-fastapi-cloud-cli
52
+ Requires-Dist: fastapi-cli[standard-no-fastapi-cloud-cli]>=0.0.8; extra == "standard-no-fastapi-cloud-cli"
53
+ Requires-Dist: httpx>=0.23.0; extra == "standard-no-fastapi-cloud-cli"
54
+ Requires-Dist: jinja2>=3.1.5; extra == "standard-no-fastapi-cloud-cli"
55
+ Requires-Dist: python-multipart>=0.0.18; extra == "standard-no-fastapi-cloud-cli"
56
+ Requires-Dist: email-validator>=2.0.0; extra == "standard-no-fastapi-cloud-cli"
57
+ Requires-Dist: uvicorn[standard]>=0.12.0; extra == "standard-no-fastapi-cloud-cli"
51
58
  Provides-Extra: all
52
- Requires-Dist: fastapi-cli[standard]>=0.0.5; extra == "all"
59
+ Requires-Dist: fastapi-cli[standard]>=0.0.8; extra == "all"
53
60
  Requires-Dist: httpx>=0.23.0; extra == "all"
54
61
  Requires-Dist: jinja2>=3.1.5; extra == "all"
55
62
  Requires-Dist: python-multipart>=0.0.18; extra == "all"
@@ -121,7 +128,7 @@ The key features are:
121
128
  <a href="https://www.coderabbit.ai/?utm_source=fastapi&utm_medium=badge&utm_campaign=fastapi" target="_blank" title="Cut Code Review Time & Bugs in Half with CodeRabbit"><img src="https://fastapi.tiangolo.com/img/sponsors/coderabbit.png"></a>
122
129
  <a href="https://subtotal.com/?utm_source=fastapi&utm_medium=sponsorship&utm_campaign=open-source" target="_blank" title="The Gold Standard in Retail Account Linking"><img src="https://fastapi.tiangolo.com/img/sponsors/subtotal.svg"></a>
123
130
  <a href="https://databento.com/" target="_blank" title="Pay as you go for market data"><img src="https://fastapi.tiangolo.com/img/sponsors/databento.svg"></a>
124
- <a href="https://speakeasy.com?utm_source=fastapi+repo&utm_medium=github+sponsorship" target="_blank" title="SDKs for your API | Speakeasy"><img src="https://fastapi.tiangolo.com/img/sponsors/speakeasy.png"></a>
131
+ <a href="https://speakeasy.com/editor?utm_source=fastapi+repo&utm_medium=github+sponsorship" target="_blank" title="SDKs for your API | Speakeasy"><img src="https://fastapi.tiangolo.com/img/sponsors/speakeasy.png"></a>
125
132
  <a href="https://www.svix.com/" target="_blank" title="Svix - Webhooks as a service"><img src="https://fastapi.tiangolo.com/img/sponsors/svix.svg"></a>
126
133
  <a href="https://www.stainlessapi.com/?utm_source=fastapi&utm_medium=referral" target="_blank" title="Stainless | Generate best-in-class SDKs"><img src="https://fastapi.tiangolo.com/img/sponsors/stainless.png"></a>
127
134
  <a href="https://www.permit.io/blog/implement-authorization-in-fastapi?utm_source=github&utm_medium=referral&utm_campaign=fastapi" target="_blank" title="Fine-Grained Authorization for FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/permit.png"></a>
@@ -535,15 +542,20 @@ Used by Starlette:
535
542
  * <a href="https://jinja.palletsprojects.com" target="_blank"><code>jinja2</code></a> - Required if you want to use the default template configuration.
536
543
  * <a href="https://github.com/Kludex/python-multipart" target="_blank"><code>python-multipart</code></a> - Required if you want to support form <abbr title="converting the string that comes from an HTTP request into Python data">"parsing"</abbr>, with `request.form()`.
537
544
 
538
- Used by FastAPI / Starlette:
545
+ Used by FastAPI:
539
546
 
540
547
  * <a href="https://www.uvicorn.org" target="_blank"><code>uvicorn</code></a> - for the server that loads and serves your application. This includes `uvicorn[standard]`, which includes some dependencies (e.g. `uvloop`) needed for high performance serving.
541
- * `fastapi-cli` - to provide the `fastapi` command.
548
+ * `fastapi-cli[standard]` - to provide the `fastapi` command.
549
+ * This includes `fastapi-cloud-cli`, which allows you to deploy your FastAPI application to <a href="https://fastapicloud.com" class="external-link" target="_blank">FastAPI Cloud</a>.
542
550
 
543
551
  ### Without `standard` Dependencies
544
552
 
545
553
  If you don't want to include the `standard` optional dependencies, you can install with `pip install fastapi` instead of `pip install "fastapi[standard]"`.
546
554
 
555
+ ### Without `fastapi-cloud-cli`
556
+
557
+ If you want to install FastAPI with the standard dependencies but without the `fastapi-cloud-cli`, you can install with `pip install "fastapi[standard-no-fastapi-cloud-cli]"`.
558
+
547
559
  ### Additional Optional Dependencies
548
560
 
549
561
  There are some additional dependencies you might want to install.
@@ -1,8 +1,8 @@
1
- fastapi-0.115.13.dist-info/METADATA,sha256=PvkM6vxD1dHOg7eAs7JPr8olyYKslTLsNCK1hpvIL8I,27173
2
- fastapi-0.115.13.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
- fastapi-0.115.13.dist-info/entry_points.txt,sha256=GCf-WbIZxyGT4MUmrPGj1cOHYZoGsNPHAvNkT6hnGeA,61
4
- fastapi-0.115.13.dist-info/licenses/LICENSE,sha256=Tsif_IFIW5f-xYSy1KlhAy7v_oNEU4lP2cEnSQbMdE4,1086
5
- fastapi/__init__.py,sha256=j0jm3ny0FgOG3Y0IGGiJ3N1q3mTPnHbo1IybrHXq7d0,1082
1
+ fastapi-0.116.0.dist-info/METADATA,sha256=QoT2LHcDkeacESwHNPkSz4CqHo3qeFHdTaBt4oBrNEM,28115
2
+ fastapi-0.116.0.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
+ fastapi-0.116.0.dist-info/entry_points.txt,sha256=GCf-WbIZxyGT4MUmrPGj1cOHYZoGsNPHAvNkT6hnGeA,61
4
+ fastapi-0.116.0.dist-info/licenses/LICENSE,sha256=Tsif_IFIW5f-xYSy1KlhAy7v_oNEU4lP2cEnSQbMdE4,1086
5
+ fastapi/__init__.py,sha256=Mu8AE9EjVCZl40l4LTF3QShw0pA558dDM2OpMXm_2hs,1081
6
6
  fastapi/__main__.py,sha256=bKePXLdO4SsVSM6r9SVoLickJDcR2c0cTOxZRKq26YQ,37
7
7
  fastapi/_compat.py,sha256=PwGTZd6d-u2o6YF9M8pQahuBtD_3q3Kpj7vU5-ngChc,24228
8
8
  fastapi/applications.py,sha256=rZTr0Ix-vdMwh6MQGCI_NC-Ir9lpfIGHHBY-JnNWZ_E,176550
@@ -12,7 +12,7 @@ fastapi/concurrency.py,sha256=MirfowoSpkMQZ8j_g0ZxaQKpV6eB3G-dB5TgcXCrgEA,1424
12
12
  fastapi/datastructures.py,sha256=b2PEz77XGq-u3Ur1Inwk0AGjOsQZO49yF9C7IPJ15cY,5766
13
13
  fastapi/dependencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  fastapi/dependencies/models.py,sha256=Pjl6vx-4nZ5Tta9kJa3-RfQKkXtCpS09-FhMgs9eWNs,1507
15
- fastapi/dependencies/utils.py,sha256=SwOOdQYOC0E4thJ-n1a0ohslWN9duyasNY_JBdWPTsY,35971
15
+ fastapi/dependencies/utils.py,sha256=wGN-BAb0NpG-89nA_OllS0F4wYwGfhHgb8IuT3MTqck,36619
16
16
  fastapi/encoders.py,sha256=LvwYmFeOz4tVwvgBoC5rvZnbr7hZr73KGrU8O7zSptU,11068
17
17
  fastapi/exception_handlers.py,sha256=MBrIOA-ugjJDivIi4rSsUJBdTsjuzN76q4yh0q1COKw,1332
18
18
  fastapi/exceptions.py,sha256=taNixuFEXb67lI1bnX1ubq8y8TseJ4yoPlWjyP0fTzk,4969
@@ -47,4 +47,4 @@ fastapi/testclient.py,sha256=nBvaAmX66YldReJNZXPOk1sfuo2Q6hs8bOvIaCep6LQ,66
47
47
  fastapi/types.py,sha256=nFb36sK3DSoqoyo7Miwy3meKK5UdFBgkAgLSzQlUVyI,383
48
48
  fastapi/utils.py,sha256=y8Bj5ttMaI9tS4D60OUgXqKnktBr99NdYUnHHV9LgoY,7948
49
49
  fastapi/websockets.py,sha256=419uncYObEKZG0YcrXscfQQYLSWoE10jqxVMetGdR98,222
50
- fastapi-0.115.13.dist-info/RECORD,,
50
+ fastapi-0.116.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: pdm-backend (2.4.4)
2
+ Generator: pdm-backend (2.4.5)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any