starmallow 0.7.0__tar.gz → 0.9.0__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.
- {starmallow-0.7.0 → starmallow-0.9.0}/.editorconfig +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/.pre-commit-config.yaml +14 -14
- starmallow-0.9.0/.python-version +1 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/PKG-INFO +17 -16
- {starmallow-0.7.0 → starmallow-0.9.0}/README.md +2 -2
- {starmallow-0.7.0 → starmallow-0.9.0}/examples/cache_server.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/examples/flask_server.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/examples/goals.ipynb +2 -2
- {starmallow-0.7.0 → starmallow-0.9.0}/examples/sample_server.py +21 -3
- {starmallow-0.7.0 → starmallow-0.9.0}/pyproject.toml +62 -20
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/__init__.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/applications.py +196 -232
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/background.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/concurrency.py +8 -7
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/dataclasses.py +11 -10
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/datastructures.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/decorators.py +31 -30
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/delimited_field.py +37 -15
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/docs.py +5 -5
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/endpoint.py +105 -79
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/endpoints.py +3 -2
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/exceptions.py +3 -3
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/ext/marshmallow/openapi.py +13 -16
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/fields.py +3 -3
- starmallow-0.9.0/starmallow/generics.py +34 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/middleware/asyncexitstack.py +1 -2
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/params.py +20 -21
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/request_resolver.py +62 -58
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/responses.py +5 -4
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/routing.py +231 -239
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/schema_generator.py +98 -52
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/security/api_key.py +11 -11
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/security/base.py +12 -4
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/security/http.py +31 -26
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/security/oauth2.py +48 -48
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/security/open_id_connect_url.py +7 -7
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/security/utils.py +2 -5
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/serializers.py +59 -63
- starmallow-0.9.0/starmallow/types.py +24 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/utils.py +114 -70
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/websockets.py +3 -6
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/basic_api.py +8 -8
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/api_key/test_api_key_cookie.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/api_key/test_api_key_cookie_description.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/api_key/test_api_key_cookie_optional.py +2 -4
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/api_key/test_api_key_header.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/api_key/test_api_key_header_description.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/api_key/test_api_key_header_optional.py +3 -5
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/api_key/test_api_key_query.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/api_key/test_api_key_query_description.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/api_key/test_api_key_query_optional.py +3 -5
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/http/test_http_base_optional.py +1 -3
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/http/test_http_basic.py +1 -2
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/http/test_http_bearer_optional.py +1 -3
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/http/test_http_digest_optional.py +1 -3
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/oauth2/test_oauth2.py +2 -2
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/oauth2/test_oauth2_authorization_code_bearer.py +1 -3
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/oauth2/test_oauth2_authorization_code_bearer_description.py +1 -3
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/oauth2/test_oauth2_optional.py +4 -6
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/oauth2/test_oauth2_optional_description.py +4 -6
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/oauth2/test_oauth2_password_bearer_optional.py +1 -3
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/oauth2/test_oauth2_password_bearer_optional_description.py +1 -3
- starmallow-0.9.0/tests/security/openid_connect/__init__.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/openid_connect/test_openid_connect.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/openid_connect/test_openid_connect_description.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/openid_connect/test_openid_connect_optional.py +3 -5
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_additional_properties.py +2 -4
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_additional_responses_custom_model_in_callback.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_additional_responses_custom_validationerror.py +3 -5
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_additional_responses_default_validationerror.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_additional_responses_response_class.py +2 -4
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_additional_responses_router.py +1 -1
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_annotated.py +9 -9
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_basic_api.py +1 -2
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_dataclass_fields.py +4 -5
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_delimited_params.py +2 -2
- starmallow-0.9.0/tests/test_generics.py +149 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_http_endpoints.py +2 -2
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_input.py +63 -16
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_middleware.py +2 -2
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_requests_orjson.py +33 -33
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_requests_ujson.py +33 -33
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_resolved_param_contextmanagers.py +1 -3
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_resolved_params.py +3 -3
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_responses.py +9 -9
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_responses_orjson.py +9 -9
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_responses_ujson.py +9 -9
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_ws_router.py +1 -1
- starmallow-0.9.0/tests/utils.py +51 -0
- starmallow-0.9.0/uv.lock +1473 -0
- starmallow-0.7.0/starmallow/types.py +0 -20
- starmallow-0.7.0/starmallow/union_field.py +0 -86
- starmallow-0.7.0/tests/utils.py +0 -47
- {starmallow-0.7.0 → starmallow-0.9.0}/.gitignore +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/Dockerfile +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/LICENSE.md +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/docker-compose.yml +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/docs/design_ideas.md +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/examples/__init__.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/examples/gunicorn.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/examples/recommended_server.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/constants.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/exception_handlers.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/ext/__init__.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/ext/marshmallow/__init__.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/middleware/__init__.py +0 -0
- /starmallow-0.7.0/tests/__init__.py → /starmallow-0.9.0/starmallow/py.typed +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/requests.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/starmallow/security/__init__.py +0 -0
- {starmallow-0.7.0/tests/security → starmallow-0.9.0/tests}/__init__.py +0 -0
- {starmallow-0.7.0/tests/security/api_key → starmallow-0.9.0/tests/security}/__init__.py +0 -0
- {starmallow-0.7.0/tests/security/http → starmallow-0.9.0/tests/security/api_key}/__init__.py +0 -0
- {starmallow-0.7.0/tests/security/oauth2 → starmallow-0.9.0/tests/security/http}/__init__.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/http/test_http_base.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/http/test_http_base_description.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/http/test_http_basic_realm.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/http/test_http_basic_realm_description.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/http/test_http_bearer.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/http/test_http_bearer_description.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/http/test_http_digest.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/security/http/test_http_digest_description.py +0 -0
- {starmallow-0.7.0/tests/security/openid_connect → starmallow-0.9.0/tests/security/oauth2}/__init__.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_additional_response_extra.py +0 -0
- {starmallow-0.7.0 → starmallow-0.9.0}/tests/test_additional_responses_bad.py +0 -0
@@ -1,42 +1,42 @@
|
|
1
1
|
default_language_version:
|
2
|
-
python: python3.
|
2
|
+
python: python3.10
|
3
3
|
exclude: '^.*.ipynb$'
|
4
|
+
minimum_pre_commit_version: '4'
|
4
5
|
repos:
|
5
6
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
6
|
-
rev:
|
7
|
+
rev: v5.0.0
|
7
8
|
hooks:
|
8
9
|
- id: check-added-large-files
|
10
|
+
exclude: ^uv.lock
|
9
11
|
- id: check-shebang-scripts-are-executable
|
10
|
-
- id: check-yaml
|
11
12
|
- id: mixed-line-ending
|
12
13
|
- id: end-of-file-fixer
|
13
14
|
- id: trailing-whitespace
|
14
15
|
|
15
16
|
- repo: https://github.com/asottile/pyupgrade
|
16
|
-
rev: v3.
|
17
|
+
rev: v3.19.1
|
17
18
|
hooks:
|
18
19
|
- id: pyupgrade
|
19
20
|
args:
|
20
|
-
- --
|
21
|
-
- --keep-runtime-typing
|
21
|
+
- --py310-plus
|
22
22
|
|
23
23
|
- repo: https://github.com/asottile/add-trailing-comma
|
24
|
-
rev:
|
24
|
+
rev: v3.1.0
|
25
25
|
hooks:
|
26
26
|
- id: add-trailing-comma
|
27
27
|
|
28
|
-
- repo: https://github.com/
|
29
|
-
rev:
|
30
|
-
hooks:
|
31
|
-
- id: isort
|
32
|
-
|
33
|
-
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
34
|
-
rev: v0.0.267
|
28
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
29
|
+
rev: v0.11.6
|
35
30
|
hooks:
|
36
31
|
- id: ruff
|
37
32
|
args:
|
38
33
|
- --fix
|
39
34
|
|
35
|
+
- repo: https://github.com/RobertCraigie/pyright-python
|
36
|
+
rev: v1.1.399
|
37
|
+
hooks:
|
38
|
+
- id: pyright
|
39
|
+
|
40
40
|
ci:
|
41
41
|
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
|
42
42
|
autoupdate_commit_msg: ⬆ [pre-commit.ci] pre-commit autoupdate
|
@@ -0,0 +1 @@
|
|
1
|
+
3.10
|
@@ -1,10 +1,11 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: starmallow
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.9.0
|
4
4
|
Summary: StarMallow framework
|
5
5
|
Project-URL: Homepage, https://github.com/mvanderlee/starmallow
|
6
6
|
Author-email: Michiel Vanderlee <jmt.vanderlee@gmail.com>
|
7
|
-
License: MIT
|
7
|
+
License-Expression: MIT
|
8
|
+
License-File: LICENSE.md
|
8
9
|
Classifier: Development Status :: 3 - Alpha
|
9
10
|
Classifier: Environment :: Web Environment
|
10
11
|
Classifier: Framework :: AsyncIO
|
@@ -17,6 +18,8 @@ Classifier: Programming Language :: Python
|
|
17
18
|
Classifier: Programming Language :: Python :: 3 :: Only
|
18
19
|
Classifier: Programming Language :: Python :: 3.10
|
19
20
|
Classifier: Programming Language :: Python :: 3.11
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
20
23
|
Classifier: Topic :: Internet
|
21
24
|
Classifier: Topic :: Internet :: WWW/HTTP
|
22
25
|
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
@@ -28,29 +31,27 @@ Classifier: Typing :: Typed
|
|
28
31
|
Requires-Python: >=3.10
|
29
32
|
Requires-Dist: apispec[marshmallow]<7,>=6
|
30
33
|
Requires-Dist: dpath<3,>=2.1.0
|
31
|
-
Requires-Dist: marshmallow-
|
32
|
-
Requires-Dist: marshmallow
|
33
|
-
Requires-Dist: python-multipart
|
34
|
+
Requires-Dist: marshmallow-dataclass2<9,>=8.8.1
|
35
|
+
Requires-Dist: marshmallow>=3.18.0
|
36
|
+
Requires-Dist: python-multipart>=0.0.20
|
34
37
|
Requires-Dist: pyyaml>=5.4.1
|
35
|
-
Requires-Dist: starlette
|
38
|
+
Requires-Dist: starlette>=0.46
|
36
39
|
Provides-Extra: all
|
37
40
|
Requires-Dist: orjson; extra == 'all'
|
38
41
|
Requires-Dist: ujson>=3.2.1; extra == 'all'
|
39
42
|
Requires-Dist: uvicorn[standard]>=0.12.0; extra == 'all'
|
40
43
|
Provides-Extra: dev
|
41
|
-
Requires-Dist:
|
42
|
-
Requires-Dist:
|
43
|
-
Requires-Dist:
|
44
|
-
Requires-Dist: uvicorn[standard]<0.22.0,>=0.17.0; extra == 'dev'
|
44
|
+
Requires-Dist: pre-commit>=4; extra == 'dev'
|
45
|
+
Requires-Dist: ruff==0.11.6; extra == 'dev'
|
46
|
+
Requires-Dist: uvicorn[standard]>=0.34; extra == 'dev'
|
45
47
|
Provides-Extra: publish
|
46
48
|
Requires-Dist: hatch>=1.7.0; extra == 'publish'
|
47
49
|
Provides-Extra: test
|
48
50
|
Requires-Dist: coverage[toml]<8.0,>=6.5.0; extra == 'test'
|
49
51
|
Requires-Dist: httpx>=0.22.0; extra == 'test'
|
50
|
-
Requires-Dist: isort<6.0.0,>=5.0.6; extra == 'test'
|
51
52
|
Requires-Dist: mypy<2,>=1.1.1; extra == 'test'
|
52
|
-
Requires-Dist: pytest
|
53
|
-
Requires-Dist: ruff==0.
|
53
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
54
|
+
Requires-Dist: ruff==0.11.6; extra == 'test'
|
54
55
|
Description-Content-Type: text/markdown
|
55
56
|
|
56
57
|
# StarMallow
|
@@ -68,7 +69,7 @@ Create a file `main.py` with:
|
|
68
69
|
|
69
70
|
```python
|
70
71
|
from typing import Annotated
|
71
|
-
from
|
72
|
+
from marshmallow_dataclass2 import dataclass
|
72
73
|
from starmallow import Body, Path, StarMallow
|
73
74
|
|
74
75
|
app = StarMallow()
|
@@ -131,7 +132,7 @@ INFO: Application startup complete.
|
|
131
132
|
You can also use class-based views. This can make it easier to organize your code and gives you an easy migration path if you use [flask-smorest](https://flask-smorest.readthedocs.io/)
|
132
133
|
|
133
134
|
```python
|
134
|
-
from
|
135
|
+
from marshmallow_dataclass2 import dataclass
|
135
136
|
from starmallow import StarMallow
|
136
137
|
from starmallow.decorators import route
|
137
138
|
from starmallow.endpoints import APIHTTPEndpoint
|
@@ -13,7 +13,7 @@ Create a file `main.py` with:
|
|
13
13
|
|
14
14
|
```python
|
15
15
|
from typing import Annotated
|
16
|
-
from
|
16
|
+
from marshmallow_dataclass2 import dataclass
|
17
17
|
from starmallow import Body, Path, StarMallow
|
18
18
|
|
19
19
|
app = StarMallow()
|
@@ -76,7 +76,7 @@ INFO: Application startup complete.
|
|
76
76
|
You can also use class-based views. This can make it easier to organize your code and gives you an easy migration path if you use [flask-smorest](https://flask-smorest.readthedocs.io/)
|
77
77
|
|
78
78
|
```python
|
79
|
-
from
|
79
|
+
from marshmallow_dataclass2 import dataclass
|
80
80
|
from starmallow import StarMallow
|
81
81
|
from starmallow.decorators import route
|
82
82
|
from starmallow.endpoints import APIHTTPEndpoint
|
@@ -5,7 +5,7 @@ import hashlib
|
|
5
5
|
import marshmallow.fields as mf
|
6
6
|
from brotli_asgi import BrotliMiddleware
|
7
7
|
from marshmallow.validate import Range
|
8
|
-
from
|
8
|
+
from marshmallow_dataclass2 import dataclass as ma_dataclass
|
9
9
|
from starlette.middleware import Middleware
|
10
10
|
from starlette_context import middleware, plugins
|
11
11
|
|
@@ -9,7 +9,7 @@ from flask import json as flask_json
|
|
9
9
|
from flask.views import MethodView
|
10
10
|
# from flask_compress import Compress
|
11
11
|
from flask_smorest import Api, Blueprint
|
12
|
-
from
|
12
|
+
from marshmallow_dataclass2 import dataclass as ma_dataclass
|
13
13
|
|
14
14
|
default_flask_config = {
|
15
15
|
'OPENAPI_VERSION': '3.0.3',
|
@@ -23,7 +23,7 @@
|
|
23
23
|
"outputs": [],
|
24
24
|
"source": [
|
25
25
|
"import marshmallow.fields as mf\n",
|
26
|
-
"from
|
26
|
+
"from marshmallow_dataclass2 import dataclass as ma_dataclass\n",
|
27
27
|
"from starmallow import APIRouter\n",
|
28
28
|
"from starmallow.params import (\n",
|
29
29
|
" Header, \n",
|
@@ -150,7 +150,7 @@
|
|
150
150
|
"from typing import Any, Callable, TypeVar, Generic, Optional, _SpecialForm\n",
|
151
151
|
"\n",
|
152
152
|
"import marshmallow.fields as mf\n",
|
153
|
-
"from
|
153
|
+
"from marshmallow_dataclass2 import dataclass as ma_dataclass\n",
|
154
154
|
"\n",
|
155
155
|
"@ma_dataclass\n",
|
156
156
|
"class CreateRequest:\n",
|
@@ -1,13 +1,15 @@
|
|
1
|
+
import asyncio
|
1
2
|
from dataclasses import asdict
|
2
|
-
from typing import Annotated
|
3
|
+
from typing import Annotated
|
3
4
|
|
4
5
|
import aiofiles.tempfile
|
5
6
|
import marshmallow.fields as mf
|
6
7
|
import orjson
|
7
8
|
from marshmallow.validate import Range
|
8
|
-
from
|
9
|
+
from marshmallow_dataclass2 import dataclass as ma_dataclass
|
9
10
|
from starlette.middleware import Middleware
|
10
11
|
from starlette.middleware.gzip import GZipMiddleware
|
12
|
+
from starlette.responses import StreamingResponse
|
11
13
|
from starlette_context import middleware, plugins
|
12
14
|
|
13
15
|
from starmallow.applications import StarMallow
|
@@ -70,7 +72,7 @@ async def test(
|
|
70
72
|
my_string: str = Body('foobar'),
|
71
73
|
email: str = Body(..., model=mf.Email()),
|
72
74
|
foobar: str = Header(...),
|
73
|
-
preference:
|
75
|
+
preference: str | None = Cookie(...),
|
74
76
|
) -> CreateResponse:
|
75
77
|
print(create_request)
|
76
78
|
print(limit)
|
@@ -139,3 +141,19 @@ async def put_tmp_file(create_request: CreateRequest) -> CreateResponse:
|
|
139
141
|
await f.write(orjson.dumps(create_request))
|
140
142
|
|
141
143
|
return asdict(create_request)
|
144
|
+
|
145
|
+
|
146
|
+
@app.get('/streaming_response')
|
147
|
+
async def streaming_response():
|
148
|
+
async def stream():
|
149
|
+
yield b'event: notification\n'
|
150
|
+
yield b'data: A long message to try and fill the buffer'
|
151
|
+
yield b'\n\n'
|
152
|
+
|
153
|
+
await asyncio.sleep(2)
|
154
|
+
|
155
|
+
yield b'event: notification\n'
|
156
|
+
yield b'data: all done'
|
157
|
+
yield b'\n\n'
|
158
|
+
|
159
|
+
return StreamingResponse(stream(), media_type="text/event-stream")
|
@@ -31,17 +31,19 @@ classifiers = [
|
|
31
31
|
"Programming Language :: Python :: 3 :: Only",
|
32
32
|
"Programming Language :: Python :: 3.10",
|
33
33
|
"Programming Language :: Python :: 3.11",
|
34
|
+
"Programming Language :: Python :: 3.12",
|
35
|
+
"Programming Language :: Python :: 3.13",
|
34
36
|
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
|
35
37
|
"Topic :: Internet :: WWW/HTTP",
|
36
38
|
]
|
37
39
|
dependencies = [
|
38
40
|
"apispec[marshmallow] >=6,<7",
|
39
41
|
"dpath >=2.1.0,<3",
|
40
|
-
"marshmallow >=3.18.0
|
41
|
-
"marshmallow-
|
42
|
-
"python-multipart >=0.0.
|
42
|
+
"marshmallow >=3.18.0",
|
43
|
+
"marshmallow-dataclass2 >=8.8.1,<9",
|
44
|
+
"python-multipart >=0.0.20",
|
43
45
|
"pyyaml >=5.4.1",
|
44
|
-
"starlette >=0.
|
46
|
+
"starlette >=0.46",
|
45
47
|
]
|
46
48
|
dynamic = ["version"]
|
47
49
|
|
@@ -58,16 +60,14 @@ all = [
|
|
58
60
|
test = [
|
59
61
|
"coverage[toml] >= 6.5.0,< 8.0",
|
60
62
|
"httpx >=0.22.0",
|
61
|
-
"isort >=5.0.6,<6.0.0",
|
62
63
|
"mypy>=1.1.1,<2",
|
63
|
-
"pytest >=
|
64
|
-
"ruff ==0.
|
64
|
+
"pytest >=8",
|
65
|
+
"ruff ==0.11.6",
|
65
66
|
]
|
66
67
|
dev = [
|
67
|
-
"
|
68
|
-
"
|
69
|
-
"
|
70
|
-
"pre-commit >=3.2.0,<4",
|
68
|
+
"ruff ==0.11.6",
|
69
|
+
"uvicorn[standard] >=0.34",
|
70
|
+
"pre-commit >=4",
|
71
71
|
]
|
72
72
|
publish = [
|
73
73
|
"hatch >= 1.7.0",
|
@@ -88,21 +88,63 @@ source = [
|
|
88
88
|
]
|
89
89
|
|
90
90
|
[tool.ruff]
|
91
|
+
exclude = [
|
92
|
+
"*.ipynb",
|
93
|
+
"examples/**/*.py",
|
94
|
+
]
|
91
95
|
select = [
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
96
|
+
"E", # pycodestyle errors
|
97
|
+
"W", # pycodestyle warnings
|
98
|
+
"F", # pyflakes
|
99
|
+
"I", # isort
|
100
|
+
"C", # flake8-comprehensions
|
101
|
+
"B", # flake8-bugbear
|
102
|
+
"A", # flake8-builtins
|
103
|
+
"N", # pep8-naming
|
104
|
+
"UP", # pyupgrade
|
105
|
+
"S", # flake8-bandit
|
106
|
+
"COM", # flake8-commas
|
107
|
+
"ISC", # flake8-implicit-str-concat
|
108
|
+
"INP", # flake8-no-pep420
|
109
|
+
"PIE", # flake8-pie
|
110
|
+
"SIM", # flake8-simplify
|
111
|
+
"RUF", # Ruff-specific rules
|
112
|
+
"T20", # flake8-print
|
113
|
+
"PT", # flake8-pytest-style
|
98
114
|
]
|
99
115
|
ignore = [
|
100
|
-
|
101
|
-
|
102
|
-
|
116
|
+
"B008", # do not perform function calls in argument defaults
|
117
|
+
"B028", # No explicit stacklevel argument found.
|
118
|
+
"C901", # too complex
|
119
|
+
|
120
|
+
"N818", # error-suffix-on-exception-name
|
121
|
+
"S101", # Use assert instead of if
|
103
122
|
]
|
104
123
|
line-length = 130 # Enforce 130. But ~100 is recommended.
|
105
124
|
|
125
|
+
[tool.ruff.lint.pycodestyle]
|
126
|
+
max-line-length = 150 # E501 reports lines that exceed the length of 150.
|
106
127
|
|
107
128
|
[tool.ruff.per-file-ignores]
|
108
129
|
"__init__.py" = ["F401"]
|
130
|
+
"starmallow/security/*.py" = ["N815"]
|
131
|
+
|
132
|
+
[tool.ruff.lint.flake8-bugbear]
|
133
|
+
# Allow default arguments like, e.g., `data: List[str] = fastapi.Query(None)`.
|
134
|
+
extend-immutable-calls = [
|
135
|
+
"starmallow.dataclasses.required_field",
|
136
|
+
"starmallow.dataclasses.optional_field",
|
137
|
+
"starmallow.dataclasses.dump_only_field",
|
138
|
+
]
|
139
|
+
|
140
|
+
[tool.pyright]
|
141
|
+
venvPath = "."
|
142
|
+
venv = ".venv"
|
143
|
+
|
144
|
+
exclude = [
|
145
|
+
"examples/**/*.py",
|
146
|
+
"tests/**/*.py",
|
147
|
+
]
|
148
|
+
|
149
|
+
pythonVersion = "3.10"
|
150
|
+
reportInvalidTypeForm = false
|