msgspec-fastapi 0.0.3__tar.gz → 0.0.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.
- {msgspec_fastapi-0.0.3 → msgspec_fastapi-0.0.4}/.github/workflows/ci.yml +16 -0
- {msgspec_fastapi-0.0.3 → msgspec_fastapi-0.0.4}/.gitignore +2 -0
- msgspec_fastapi-0.0.4/.pre-commit-config.yaml +7 -0
- {msgspec_fastapi-0.0.3 → msgspec_fastapi-0.0.4}/PKG-INFO +10 -1
- {msgspec_fastapi-0.0.3 → msgspec_fastapi-0.0.4}/README.md +9 -0
- {msgspec_fastapi-0.0.3 → msgspec_fastapi-0.0.4}/pyproject.toml +14 -1
- msgspec_fastapi-0.0.4/src/msgspec_fastapi/py.typed +0 -0
- {msgspec_fastapi-0.0.3 → msgspec_fastapi-0.0.4}/src/msgspec_fastapi/responses.py +3 -0
- {msgspec_fastapi-0.0.3 → msgspec_fastapi-0.0.4}/src/msgspec_fastapi/router.py +203 -85
- {msgspec_fastapi-0.0.3 → msgspec_fastapi-0.0.4}/src/msgspec_fastapi/validation.py +85 -37
- {msgspec_fastapi-0.0.3 → msgspec_fastapi-0.0.4}/tests/test_router.py +201 -110
- {msgspec_fastapi-0.0.3 → msgspec_fastapi-0.0.4}/.github/workflows/publish.yml +0 -0
- {msgspec_fastapi-0.0.3 → msgspec_fastapi-0.0.4}/LICENSE +0 -0
- {msgspec_fastapi-0.0.3 → msgspec_fastapi-0.0.4}/src/msgspec_fastapi/__init__.py +0 -0
|
@@ -14,6 +14,22 @@ concurrency:
|
|
|
14
14
|
cancel-in-progress: true
|
|
15
15
|
|
|
16
16
|
jobs:
|
|
17
|
+
lint:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
21
|
+
with:
|
|
22
|
+
persist-credentials: false
|
|
23
|
+
- uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
|
|
24
|
+
with:
|
|
25
|
+
enable-cache: false
|
|
26
|
+
- name: Install lint tools
|
|
27
|
+
run: uv sync --python 3.11 --only-group lint
|
|
28
|
+
- name: Lint
|
|
29
|
+
run: uv run --no-sync ruff check --output-format=github .
|
|
30
|
+
- name: Check formatting
|
|
31
|
+
run: uv run --no-sync ruff format --check .
|
|
32
|
+
|
|
17
33
|
test:
|
|
18
34
|
name: Python ${{ matrix.python }}, ${{ matrix.bounds }} dependency bounds
|
|
19
35
|
runs-on: ubuntu-latest
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: msgspec-fastapi
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Experimental FastAPI router that decodes request bodies and encodes responses with msgspec
|
|
5
5
|
Project-URL: Source, https://github.com/Siyet/msgspec-fastapi
|
|
6
6
|
Project-URL: Issues, https://github.com/Siyet/msgspec-fastapi/issues
|
|
@@ -181,5 +181,14 @@ Things to keep in mind:
|
|
|
181
181
|
## Development
|
|
182
182
|
|
|
183
183
|
```sh
|
|
184
|
+
uv sync --group test --group lint
|
|
184
185
|
uv run --group test pytest
|
|
186
|
+
uv run --group lint ruff check .
|
|
187
|
+
uv run --group lint ruff format --check .
|
|
188
|
+
uv run --group lint pre-commit install
|
|
189
|
+
uv run --group lint pre-commit run --all-files
|
|
185
190
|
```
|
|
191
|
+
|
|
192
|
+
Ruff checks imports, annotations and common Python errors, and formats the code.
|
|
193
|
+
CI runs the same Ruff version as the pre-commit hooks. Test endpoints that exercise the absence
|
|
194
|
+
of a response annotation intentionally omit it.
|
|
@@ -164,5 +164,14 @@ Things to keep in mind:
|
|
|
164
164
|
## Development
|
|
165
165
|
|
|
166
166
|
```sh
|
|
167
|
+
uv sync --group test --group lint
|
|
167
168
|
uv run --group test pytest
|
|
169
|
+
uv run --group lint ruff check .
|
|
170
|
+
uv run --group lint ruff format --check .
|
|
171
|
+
uv run --group lint pre-commit install
|
|
172
|
+
uv run --group lint pre-commit run --all-files
|
|
168
173
|
```
|
|
174
|
+
|
|
175
|
+
Ruff checks imports, annotations and common Python errors, and formats the code.
|
|
176
|
+
CI runs the same Ruff version as the pre-commit hooks. Test endpoints that exercise the absence
|
|
177
|
+
of a response annotation intentionally omit it.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "msgspec-fastapi"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.4"
|
|
8
8
|
description = "Experimental FastAPI router that decodes request bodies and encodes responses with msgspec"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "BSD-3-Clause"
|
|
@@ -27,9 +27,22 @@ Issues = "https://github.com/Siyet/msgspec-fastapi/issues"
|
|
|
27
27
|
|
|
28
28
|
[dependency-groups]
|
|
29
29
|
test = ["pytest", "httpx", "httpx2", "python-multipart"]
|
|
30
|
+
lint = ["ruff==0.17.0", "pre-commit>=4.5,<5"]
|
|
30
31
|
|
|
31
32
|
[tool.hatch.build.targets.wheel]
|
|
32
33
|
packages = ["src/msgspec_fastapi"]
|
|
33
34
|
|
|
34
35
|
[tool.pytest.ini_options]
|
|
35
36
|
testpaths = ["tests"]
|
|
37
|
+
|
|
38
|
+
[tool.ruff]
|
|
39
|
+
target-version = "py311"
|
|
40
|
+
line-length = 100
|
|
41
|
+
|
|
42
|
+
[tool.ruff.lint]
|
|
43
|
+
select = ["E4", "E7", "E9", "F", "I", "ANN"]
|
|
44
|
+
# Runtime type expressions, JSON values and forwarded FastAPI options are dynamic.
|
|
45
|
+
ignore = ["ANN401"]
|
|
46
|
+
|
|
47
|
+
[tool.ruff.format]
|
|
48
|
+
quote-style = "single"
|
|
File without changes
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
from typing import Any
|
|
2
|
+
|
|
2
3
|
import msgspec
|
|
3
4
|
from starlette.responses import JSONResponse
|
|
4
5
|
|
|
5
6
|
_JSON_ENCODER = msgspec.json.Encoder()
|
|
6
7
|
|
|
8
|
+
|
|
7
9
|
class MsgspecJSONResponse(JSONResponse):
|
|
8
10
|
"""Encode JSON with msgspec; use MsgspecRouter for output validation."""
|
|
11
|
+
|
|
9
12
|
def render(self, content: Any) -> bytes:
|
|
10
13
|
return _JSON_ENCODER.encode(content)
|