mirror of
https://github.com/d3vyce/fastapi-toolsets.git
synced 2026-04-16 06:36:26 +02:00
Compare commits
2 Commits
feat/add-s
...
51d3917421
| Author | SHA1 | Date | |
|---|---|---|---|
|
51d3917421
|
|||
|
f67163de05
|
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@@ -6,9 +6,6 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
@@ -96,7 +93,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
if: matrix.python-version == '3.14'
|
if: matrix.python-version == '3.14'
|
||||||
uses: codecov/codecov-action@v6
|
uses: codecov/codecov-action@v5
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
report_type: coverage
|
report_type: coverage
|
||||||
@@ -105,7 +102,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload test results to Codecov
|
- name: Upload test results to Codecov
|
||||||
if: matrix.python-version == '3.14'
|
if: matrix.python-version == '3.14'
|
||||||
uses: codecov/codecov-action@v6
|
uses: codecov/codecov-action@v5
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
report_type: test_results
|
report_type: test_results
|
||||||
|
|||||||
21
.github/workflows/docs.yml
vendored
21
.github/workflows/docs.yml
vendored
@@ -34,17 +34,26 @@ jobs:
|
|||||||
MAJOR=$(echo "$VERSION" | cut -d. -f1)
|
MAJOR=$(echo "$VERSION" | cut -d. -f1)
|
||||||
DEPLOY_VERSION="v$(echo "$VERSION" | cut -d. -f1-2)"
|
DEPLOY_VERSION="v$(echo "$VERSION" | cut -d. -f1-2)"
|
||||||
|
|
||||||
# On new major: keep only the latest feature version of the previous major
|
# On new major: consolidate previous major's feature versions into vX
|
||||||
PREV_MAJOR=$((MAJOR - 1))
|
PREV_MAJOR=$((MAJOR - 1))
|
||||||
OLD_FEATURE_VERSIONS=$(uv run mike list 2>/dev/null | grep -oE "^v${PREV_MAJOR}\.[0-9]+" || true)
|
OLD_FEATURE_VERSIONS=$(uv run mike list 2>/dev/null | grep -oE "^v${PREV_MAJOR}\.[0-9]+" || true)
|
||||||
|
|
||||||
if [ -n "$OLD_FEATURE_VERSIONS" ]; then
|
if [ -n "$OLD_FEATURE_VERSIONS" ]; then
|
||||||
LATEST_PREV=$(echo "$OLD_FEATURE_VERSIONS" | sort -t. -k2 -n | tail -1)
|
LATEST_PREV_TAG=$(git tag -l "v${PREV_MAJOR}.*" | sort -V | tail -1)
|
||||||
echo "$OLD_FEATURE_VERSIONS" | while read -r OLD_V; do
|
|
||||||
if [ "$OLD_V" != "$LATEST_PREV" ]; then
|
if [ -n "$LATEST_PREV_TAG" ]; then
|
||||||
echo "Deleting $OLD_V"
|
git checkout "$LATEST_PREV_TAG" -- docs/ src/ zensical.toml
|
||||||
uv run mike delete "$OLD_V"
|
if ! grep -q '\[project\.extra\.version\]' zensical.toml; then
|
||||||
|
printf '\n[project.extra.version]\nprovider = "mike"\ndefault = "stable"\nalias = true\n' >> zensical.toml
|
||||||
fi
|
fi
|
||||||
|
uv run mike deploy "v${PREV_MAJOR}"
|
||||||
|
git checkout HEAD -- docs/ src/ zensical.toml
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Delete old feature versions
|
||||||
|
echo "$OLD_FEATURE_VERSIONS" | while read -r OLD_V; do
|
||||||
|
echo "Deleting $OLD_V"
|
||||||
|
uv run mike delete "$OLD_V"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
# Authentication
|
|
||||||
@@ -43,16 +43,16 @@ Declare `searchable_fields`, `facet_fields`, and `order_fields` once on [`CrudFa
|
|||||||
|
|
||||||
## Routes
|
## Routes
|
||||||
|
|
||||||
```python title="routes.py:1:16"
|
```python title="routes.py:1:17"
|
||||||
--8<-- "docs_src/examples/pagination_search/routes.py:1:16"
|
--8<-- "docs_src/examples/pagination_search/routes.py:1:17"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Offset pagination
|
### Offset pagination
|
||||||
|
|
||||||
Best for admin panels or any UI that needs a total item count and numbered pages.
|
Best for admin panels or any UI that needs a total item count and numbered pages.
|
||||||
|
|
||||||
```python title="routes.py:19:37"
|
```python title="routes.py:20:40"
|
||||||
--8<-- "docs_src/examples/pagination_search/routes.py:19:37"
|
--8<-- "docs_src/examples/pagination_search/routes.py:20:40"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Example request**
|
**Example request**
|
||||||
@@ -92,8 +92,8 @@ To skip the `COUNT(*)` query for better performance on large tables, pass `inclu
|
|||||||
|
|
||||||
Best for feeds, infinite scroll, or any high-throughput API where offset performance degrades.
|
Best for feeds, infinite scroll, or any high-throughput API where offset performance degrades.
|
||||||
|
|
||||||
```python title="routes.py:40:58"
|
```python title="routes.py:43:63"
|
||||||
--8<-- "docs_src/examples/pagination_search/routes.py:40:58"
|
--8<-- "docs_src/examples/pagination_search/routes.py:43:63"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Example request**
|
**Example request**
|
||||||
@@ -132,8 +132,8 @@ Pass `next_cursor` as the `cursor` query parameter on the next request to advanc
|
|||||||
|
|
||||||
[`paginate()`](../module/crud.md#unified-paginate--both-strategies-on-one-endpoint) lets a single endpoint support both strategies via a `pagination_type` query parameter. The `pagination_type` field in the response acts as a discriminator for frontend tooling.
|
[`paginate()`](../module/crud.md#unified-paginate--both-strategies-on-one-endpoint) lets a single endpoint support both strategies via a `pagination_type` query parameter. The `pagination_type` field in the response acts as a discriminator for frontend tooling.
|
||||||
|
|
||||||
```python title="routes.py:61:79"
|
```python title="routes.py:66:90"
|
||||||
--8<-- "docs_src/examples/pagination_search/routes.py:61:79"
|
--8<-- "docs_src/examples/pagination_search/routes.py:66:90"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Offset request** (default)
|
**Offset request** (default)
|
||||||
|
|||||||
@@ -28,69 +28,6 @@ In `v2`, relationship facet fields used only the terminal column key (e.g. `"nam
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### `*_params` dependencies consolidated into per-paginate methods
|
|
||||||
|
|
||||||
The six individual dependency methods (`offset_params`, `cursor_params`, `paginate_params`, `filter_params`, `search_params`, `order_params`) have been **removed** and replaced by three consolidated methods that bundle pagination, search, filter, and order into a single `Depends()` call.
|
|
||||||
|
|
||||||
| Removed | Replacement |
|
|
||||||
|---|---|
|
|
||||||
| `offset_params()` + `filter_params()` + `search_params()` + `order_params()` | `offset_paginate_params()` |
|
|
||||||
| `cursor_params()` + `filter_params()` + `search_params()` + `order_params()` | `cursor_paginate_params()` |
|
|
||||||
| `paginate_params()` + `filter_params()` + `search_params()` + `order_params()` | `paginate_params()` |
|
|
||||||
|
|
||||||
Each new method accepts `search`, `filter`, and `order` boolean toggles (all `True` by default) to disable features you don't need.
|
|
||||||
|
|
||||||
=== "Before (`v2`)"
|
|
||||||
|
|
||||||
```python
|
|
||||||
from fastapi_toolsets.crud import OrderByClause
|
|
||||||
|
|
||||||
@router.get("/offset")
|
|
||||||
async def list_articles_offset(
|
|
||||||
session: SessionDep,
|
|
||||||
params: Annotated[dict, Depends(ArticleCrud.offset_params(default_page_size=20))],
|
|
||||||
filter_by: Annotated[dict, Depends(ArticleCrud.filter_params())],
|
|
||||||
order_by: Annotated[OrderByClause | None, Depends(ArticleCrud.order_params(default_field=Article.created_at))],
|
|
||||||
search: str | None = None,
|
|
||||||
) -> OffsetPaginatedResponse[ArticleRead]:
|
|
||||||
return await ArticleCrud.offset_paginate(
|
|
||||||
session=session,
|
|
||||||
**params,
|
|
||||||
search=search,
|
|
||||||
filter_by=filter_by or None,
|
|
||||||
order_by=order_by,
|
|
||||||
schema=ArticleRead,
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
=== "Now (`v3`)"
|
|
||||||
|
|
||||||
```python
|
|
||||||
@router.get("/offset")
|
|
||||||
async def list_articles_offset(
|
|
||||||
session: SessionDep,
|
|
||||||
params: Annotated[
|
|
||||||
dict,
|
|
||||||
Depends(
|
|
||||||
ArticleCrud.offset_paginate_params(
|
|
||||||
default_page_size=20,
|
|
||||||
default_order_field=Article.created_at,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
],
|
|
||||||
) -> OffsetPaginatedResponse[ArticleRead]:
|
|
||||||
return await ArticleCrud.offset_paginate(session=session, **params, schema=ArticleRead)
|
|
||||||
```
|
|
||||||
|
|
||||||
The same pattern applies to `cursor_paginate_params()` and `paginate_params()`. To disable a feature, pass the toggle:
|
|
||||||
|
|
||||||
```python
|
|
||||||
# No search or ordering, only pagination + filtering
|
|
||||||
ArticleCrud.offset_paginate_params(search=False, order=False)
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Models
|
## Models
|
||||||
|
|
||||||
The lifecycle event system has been rewritten. Callbacks are now registered with a module-level [`listens_for`](../reference/models.md#fastapi_toolsets.models.listens_for) decorator and dispatched by [`EventSession`](../reference/models.md#fastapi_toolsets.models.EventSession), replacing the mixin-based approach from `v2`.
|
The lifecycle event system has been rewritten. Callbacks are now registered with a module-level [`listens_for`](../reference/models.md#fastapi_toolsets.models.listens_for) decorator and dispatched by [`EventSession`](../reference/models.md#fastapi_toolsets.models.EventSession), replacing the mixin-based approach from `v2`.
|
||||||
|
|||||||
@@ -159,15 +159,18 @@ Three pagination methods are available. All return a typed response whose `pagi
|
|||||||
### Offset pagination
|
### Offset pagination
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from typing import Annotated
|
|
||||||
from fastapi import Depends
|
|
||||||
|
|
||||||
@router.get("")
|
@router.get("")
|
||||||
async def get_users(
|
async def get_users(
|
||||||
session: SessionDep,
|
session: SessionDep,
|
||||||
params: Annotated[dict, Depends(UserCrud.offset_paginate_params())],
|
items_per_page: int = 50,
|
||||||
|
page: int = 1,
|
||||||
) -> OffsetPaginatedResponse[UserRead]:
|
) -> OffsetPaginatedResponse[UserRead]:
|
||||||
return await UserCrud.offset_paginate(session=session, **params, schema=UserRead)
|
return await UserCrud.offset_paginate(
|
||||||
|
session=session,
|
||||||
|
items_per_page=items_per_page,
|
||||||
|
page=page,
|
||||||
|
schema=UserRead,
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
The [`offset_paginate`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.offset_paginate) method returns an [`OffsetPaginatedResponse`](../reference/schemas.md#fastapi_toolsets.schemas.OffsetPaginatedResponse):
|
The [`offset_paginate`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.offset_paginate) method returns an [`OffsetPaginatedResponse`](../reference/schemas.md#fastapi_toolsets.schemas.OffsetPaginatedResponse):
|
||||||
@@ -191,13 +194,32 @@ The [`offset_paginate`](../reference/crud.md#fastapi_toolsets.crud.factory.Async
|
|||||||
|
|
||||||
!!! info "Added in `v2.4.1`"
|
!!! info "Added in `v2.4.1`"
|
||||||
|
|
||||||
By default `offset_paginate` runs two queries: one for the page items and one `COUNT(*)` for `total_count`. On large tables the `COUNT` can be expensive. Pass `include_total=False` to `offset_paginate_params()` to skip it:
|
By default `offset_paginate` runs two queries: one for the page items and one `COUNT(*)` for `total_count`. On large tables the `COUNT` can be expensive. Pass `include_total=False` to skip it:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
result = await UserCrud.offset_paginate(
|
||||||
|
session=session,
|
||||||
|
page=page,
|
||||||
|
items_per_page=items_per_page,
|
||||||
|
include_total=False,
|
||||||
|
schema=UserRead,
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Pagination params dependency
|
||||||
|
|
||||||
|
!!! info "Added in `v2.4.1`"
|
||||||
|
|
||||||
|
Use [`offset_params()`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.offset_params) to generate a FastAPI dependency that injects `page` and `items_per_page` from query parameters with configurable defaults and a `max_page_size` cap:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from typing import Annotated
|
||||||
|
from fastapi import Depends
|
||||||
|
|
||||||
@router.get("")
|
@router.get("")
|
||||||
async def get_users(
|
async def list_users(
|
||||||
session: SessionDep,
|
session: SessionDep,
|
||||||
params: Annotated[dict, Depends(UserCrud.offset_paginate_params(include_total=False))],
|
params: Annotated[dict, Depends(UserCrud.offset_params(default_page_size=20, max_page_size=100))],
|
||||||
) -> OffsetPaginatedResponse[UserRead]:
|
) -> OffsetPaginatedResponse[UserRead]:
|
||||||
return await UserCrud.offset_paginate(session=session, **params, schema=UserRead)
|
return await UserCrud.offset_paginate(session=session, **params, schema=UserRead)
|
||||||
```
|
```
|
||||||
@@ -208,9 +230,15 @@ async def get_users(
|
|||||||
@router.get("")
|
@router.get("")
|
||||||
async def list_users(
|
async def list_users(
|
||||||
session: SessionDep,
|
session: SessionDep,
|
||||||
params: Annotated[dict, Depends(UserCrud.cursor_paginate_params())],
|
cursor: str | None = None,
|
||||||
|
items_per_page: int = 20,
|
||||||
) -> CursorPaginatedResponse[UserRead]:
|
) -> CursorPaginatedResponse[UserRead]:
|
||||||
return await UserCrud.cursor_paginate(session=session, **params, schema=UserRead)
|
return await UserCrud.cursor_paginate(
|
||||||
|
session=session,
|
||||||
|
cursor=cursor,
|
||||||
|
items_per_page=items_per_page,
|
||||||
|
schema=UserRead,
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
The [`cursor_paginate`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.cursor_paginate) method returns a [`CursorPaginatedResponse`](../reference/schemas.md#fastapi_toolsets.schemas.CursorPaginatedResponse):
|
The [`cursor_paginate`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.cursor_paginate) method returns a [`CursorPaginatedResponse`](../reference/schemas.md#fastapi_toolsets.schemas.CursorPaginatedResponse):
|
||||||
@@ -263,6 +291,24 @@ PostCrud = CrudFactory(model=Post, cursor_column=Post.id)
|
|||||||
PostCrud = CrudFactory(model=Post, cursor_column=Post.created_at)
|
PostCrud = CrudFactory(model=Post, cursor_column=Post.created_at)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Pagination params dependency
|
||||||
|
|
||||||
|
!!! info "Added in `v2.4.1`"
|
||||||
|
|
||||||
|
Use [`cursor_params()`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.cursor_params) to inject `cursor` and `items_per_page` from query parameters with a `max_page_size` cap:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from typing import Annotated
|
||||||
|
from fastapi import Depends
|
||||||
|
|
||||||
|
@router.get("")
|
||||||
|
async def list_users(
|
||||||
|
session: SessionDep,
|
||||||
|
params: Annotated[dict, Depends(UserCrud.cursor_params(default_page_size=20, max_page_size=100))],
|
||||||
|
) -> CursorPaginatedResponse[UserRead]:
|
||||||
|
return await UserCrud.cursor_paginate(session=session, **params, schema=UserRead)
|
||||||
|
```
|
||||||
|
|
||||||
### Unified endpoint (both strategies)
|
### Unified endpoint (both strategies)
|
||||||
|
|
||||||
!!! info "Added in `v2.3.0`"
|
!!! info "Added in `v2.3.0`"
|
||||||
@@ -270,14 +316,25 @@ PostCrud = CrudFactory(model=Post, cursor_column=Post.created_at)
|
|||||||
[`paginate()`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.paginate) dispatches to `offset_paginate` or `cursor_paginate` based on a `pagination_type` query parameter, letting you expose **one endpoint** that supports both strategies. The `pagination_type` field in the response tells clients which strategy was used, enabling frontend discriminated-union typing.
|
[`paginate()`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.paginate) dispatches to `offset_paginate` or `cursor_paginate` based on a `pagination_type` query parameter, letting you expose **one endpoint** that supports both strategies. The `pagination_type` field in the response tells clients which strategy was used, enabling frontend discriminated-union typing.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
from fastapi_toolsets.crud import PaginationType
|
||||||
from fastapi_toolsets.schemas import PaginatedResponse
|
from fastapi_toolsets.schemas import PaginatedResponse
|
||||||
|
|
||||||
@router.get("")
|
@router.get("")
|
||||||
async def list_users(
|
async def list_users(
|
||||||
session: SessionDep,
|
session: SessionDep,
|
||||||
params: Annotated[dict, Depends(UserCrud.paginate_params())],
|
pagination_type: PaginationType = PaginationType.OFFSET,
|
||||||
|
page: int = Query(1, ge=1, description="Current page (offset only)"),
|
||||||
|
cursor: str | None = Query(None, description="Cursor token (cursor only)"),
|
||||||
|
items_per_page: int = Query(20, ge=1, le=100),
|
||||||
) -> PaginatedResponse[UserRead]:
|
) -> PaginatedResponse[UserRead]:
|
||||||
return await UserCrud.paginate(session, **params, schema=UserRead)
|
return await UserCrud.paginate(
|
||||||
|
session,
|
||||||
|
pagination_type=pagination_type,
|
||||||
|
page=page,
|
||||||
|
cursor=cursor,
|
||||||
|
items_per_page=items_per_page,
|
||||||
|
schema=UserRead,
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -285,6 +342,25 @@ GET /users?pagination_type=offset&page=2&items_per_page=10
|
|||||||
GET /users?pagination_type=cursor&cursor=eyJ2YWx1ZSI6...&items_per_page=10
|
GET /users?pagination_type=cursor&cursor=eyJ2YWx1ZSI6...&items_per_page=10
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Pagination params dependency
|
||||||
|
|
||||||
|
!!! info "Added in `v2.4.1`"
|
||||||
|
|
||||||
|
Use [`paginate_params()`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.paginate_params) to inject all parameters at once with configurable defaults and a `max_page_size` cap:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from typing import Annotated
|
||||||
|
from fastapi import Depends
|
||||||
|
from fastapi_toolsets.schemas import PaginatedResponse
|
||||||
|
|
||||||
|
@router.get("")
|
||||||
|
async def list_users(
|
||||||
|
session: SessionDep,
|
||||||
|
params: Annotated[dict, Depends(UserCrud.paginate_params(default_page_size=20, max_page_size=100))],
|
||||||
|
) -> PaginatedResponse[UserRead]:
|
||||||
|
return await UserCrud.paginate(session, **params, schema=UserRead)
|
||||||
|
```
|
||||||
|
|
||||||
## Search
|
## Search
|
||||||
|
|
||||||
Two search strategies are available, both compatible with [`offset_paginate`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.offset_paginate) and [`cursor_paginate`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.cursor_paginate).
|
Two search strategies are available, both compatible with [`offset_paginate`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.offset_paginate) and [`cursor_paginate`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.cursor_paginate).
|
||||||
@@ -324,63 +400,49 @@ result = await UserCrud.offset_paginate(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Or via the dependency to narrow which fields are exposed as query parameters:
|
|
||||||
|
|
||||||
```python
|
|
||||||
params = UserCrud.offset_paginate_params(search_fields=[Post.title])
|
|
||||||
```
|
|
||||||
|
|
||||||
This allows searching with both [`offset_paginate`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.offset_paginate) and [`cursor_paginate`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.cursor_paginate):
|
This allows searching with both [`offset_paginate`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.offset_paginate) and [`cursor_paginate`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.cursor_paginate):
|
||||||
|
|
||||||
```python
|
```python
|
||||||
@router.get("")
|
@router.get("")
|
||||||
async def get_users(
|
async def get_users(
|
||||||
session: SessionDep,
|
session: SessionDep,
|
||||||
params: Annotated[dict, Depends(UserCrud.offset_paginate_params())],
|
items_per_page: int = 50,
|
||||||
|
page: int = 1,
|
||||||
|
search: str | None = None,
|
||||||
) -> OffsetPaginatedResponse[UserRead]:
|
) -> OffsetPaginatedResponse[UserRead]:
|
||||||
return await UserCrud.offset_paginate(session=session, **params, schema=UserRead)
|
return await UserCrud.offset_paginate(
|
||||||
|
session=session,
|
||||||
|
items_per_page=items_per_page,
|
||||||
|
page=page,
|
||||||
|
search=search,
|
||||||
|
schema=UserRead,
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
@router.get("")
|
@router.get("")
|
||||||
async def get_users(
|
async def get_users(
|
||||||
session: SessionDep,
|
session: SessionDep,
|
||||||
params: Annotated[dict, Depends(UserCrud.cursor_paginate_params())],
|
cursor: str | None = None,
|
||||||
|
items_per_page: int = 50,
|
||||||
|
search: str | None = None,
|
||||||
) -> CursorPaginatedResponse[UserRead]:
|
) -> CursorPaginatedResponse[UserRead]:
|
||||||
return await UserCrud.cursor_paginate(session=session, **params, schema=UserRead)
|
return await UserCrud.cursor_paginate(
|
||||||
|
session=session,
|
||||||
|
items_per_page=items_per_page,
|
||||||
|
cursor=cursor,
|
||||||
|
search=search,
|
||||||
|
schema=UserRead,
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
The dependency adds two query parameters to the endpoint:
|
|
||||||
|
|
||||||
| Parameter | Type |
|
|
||||||
| --------------- | ------------- |
|
|
||||||
| `search` | `str \| null` |
|
|
||||||
| `search_column` | `str \| null` |
|
|
||||||
|
|
||||||
```
|
|
||||||
GET /posts?search=hello → search all configured columns
|
|
||||||
GET /posts?search=hello&search_column=title → search only Post.title
|
|
||||||
```
|
|
||||||
|
|
||||||
The available search column keys are returned in the `search_columns` field of [`PaginatedResponse`](../reference/schemas.md#fastapi_toolsets.schemas.PaginatedResponse). Use them to populate a column picker in the UI, or to validate `search_column` values on the client side:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"status": "SUCCESS",
|
|
||||||
"data": ["..."],
|
|
||||||
"pagination": { "..." },
|
|
||||||
"search_columns": ["content", "author__username", "title"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
!!! info "Key format uses `__` as a separator for relationship chains."
|
|
||||||
A direct column `Post.title` produces `"title"`. A relationship tuple `(Post.author, User.username)` produces `"author__username"`. An unknown `search_column` value raises [`InvalidSearchColumnError`](../reference/exceptions.md#fastapi_toolsets.exceptions.exceptions.InvalidSearchColumnError) (HTTP 422).
|
|
||||||
|
|
||||||
### Faceted search
|
### Faceted search
|
||||||
|
|
||||||
!!! info "Added in `v1.2`"
|
!!! info "Added in `v1.2`"
|
||||||
|
|
||||||
Declare `facet_fields` on the CRUD class to return distinct column values alongside paginated results. This is useful for populating filter dropdowns or building faceted search UIs. Relationship traversal is supported via tuples, using the same syntax as `searchable_fields`:
|
Declare `facet_fields` on the CRUD class to return distinct column values alongside paginated results. This is useful for populating filter dropdowns or building faceted search UIs.
|
||||||
|
|
||||||
|
Facet fields use the same syntax as `searchable_fields` — direct columns or relationship tuples:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
UserCrud = CrudFactory(
|
UserCrud = CrudFactory(
|
||||||
@@ -402,47 +464,7 @@ result = await UserCrud.offset_paginate(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Or via the dependency to narrow which fields are exposed as query parameters:
|
The distinct values are returned in the `filter_attributes` field of [`PaginatedResponse`](../reference/schemas.md#fastapi_toolsets.schemas.PaginatedResponse):
|
||||||
|
|
||||||
```python
|
|
||||||
params = UserCrud.offset_paginate_params(facet_fields=[User.country])
|
|
||||||
```
|
|
||||||
|
|
||||||
Facet filtering is built into the consolidated params dependencies. When `filter=True` (the default), each facet field is exposed as a query parameter and values are collected into `filter_by` automatically:
|
|
||||||
|
|
||||||
```python
|
|
||||||
from typing import Annotated
|
|
||||||
|
|
||||||
from fastapi import Depends
|
|
||||||
|
|
||||||
@router.get("", response_model_exclude_none=True)
|
|
||||||
async def list_users(
|
|
||||||
session: SessionDep,
|
|
||||||
params: Annotated[dict, Depends(UserCrud.offset_paginate_params())],
|
|
||||||
) -> OffsetPaginatedResponse[UserRead]:
|
|
||||||
return await UserCrud.offset_paginate(session=session, **params, schema=UserRead)
|
|
||||||
```
|
|
||||||
|
|
||||||
```python
|
|
||||||
@router.get("", response_model_exclude_none=True)
|
|
||||||
async def list_users(
|
|
||||||
session: SessionDep,
|
|
||||||
params: Annotated[dict, Depends(UserCrud.cursor_paginate_params())],
|
|
||||||
) -> CursorPaginatedResponse[UserRead]:
|
|
||||||
return await UserCrud.cursor_paginate(session=session, **params, schema=UserRead)
|
|
||||||
```
|
|
||||||
|
|
||||||
Both single-value and multi-value query parameters work:
|
|
||||||
|
|
||||||
```
|
|
||||||
GET /users?status=active → filter_by={"status": ["active"]}
|
|
||||||
GET /users?status=active&country=FR → filter_by={"status": ["active"], "country": ["FR"]}
|
|
||||||
GET /users?role__name=admin&role__name=editor → filter_by={"role__name": ["admin", "editor"]} (IN clause)
|
|
||||||
```
|
|
||||||
|
|
||||||
`filter_by` and `filters` can be combined — both are applied with AND logic.
|
|
||||||
|
|
||||||
The distinct values for each facet field are returned in the `filter_attributes` field of [`PaginatedResponse`](../reference/schemas.md#fastapi_toolsets.schemas.PaginatedResponse). Use them to populate filter dropdowns in the UI, or to validate `filter_by` keys on the client side:
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@@ -457,14 +479,52 @@ The distinct values for each facet field are returned in the `filter_attributes`
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! info "Key format uses `__` as a separator for relationship chains."
|
Use `filter_by` to pass the client's chosen filter values directly — no need to build SQLAlchemy conditions by hand. Any unknown key raises [`InvalidFacetFilterError`](../reference/exceptions.md#fastapi_toolsets.exceptions.exceptions.InvalidFacetFilterError).
|
||||||
A direct column `User.status` produces `"status"`. A relationship tuple `(User.role, Role.name)` produces `"role__name"`. A deeper chain `(User.role, Role.permission, Permission.name)` produces `"role__permission__name"`. An unknown `filter_by` key raises [`InvalidFacetFilterError`](../reference/exceptions.md#fastapi_toolsets.exceptions.exceptions.InvalidFacetFilterError) (HTTP 422).
|
|
||||||
|
!!! info "The keys in `filter_by` are the same keys the client received in `filter_attributes`."
|
||||||
|
Keys use `__` as a separator for the full relationship chain. A direct column `User.status` produces `"status"`. A relationship tuple `(User.role, Role.name)` produces `"role__name"`. A deeper chain `(User.role, Role.permission, Permission.name)` produces `"role__permission__name"`.
|
||||||
|
|
||||||
|
`filter_by` and `filters` can be combined — both are applied with AND logic.
|
||||||
|
|
||||||
|
Use [`filter_params()`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.filter_params) to generate a dict with the facet filter values from the query parameters:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from typing import Annotated
|
||||||
|
|
||||||
|
from fastapi import Depends
|
||||||
|
|
||||||
|
UserCrud = CrudFactory(
|
||||||
|
model=User,
|
||||||
|
facet_fields=[User.status, User.country, (User.role, Role.name)],
|
||||||
|
)
|
||||||
|
|
||||||
|
@router.get("", response_model_exclude_none=True)
|
||||||
|
async def list_users(
|
||||||
|
session: SessionDep,
|
||||||
|
page: int = 1,
|
||||||
|
filter_by: Annotated[dict[str, list[str]], Depends(UserCrud.filter_params())],
|
||||||
|
) -> OffsetPaginatedResponse[UserRead]:
|
||||||
|
return await UserCrud.offset_paginate(
|
||||||
|
session=session,
|
||||||
|
page=page,
|
||||||
|
filter_by=filter_by,
|
||||||
|
schema=UserRead,
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
Both single-value and multi-value query parameters work:
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /users?status=active → filter_by={"status": ["active"]}
|
||||||
|
GET /users?status=active&country=FR → filter_by={"status": ["active"], "country": ["FR"]}
|
||||||
|
GET /users?role__name=admin&role__name=editor → filter_by={"role__name": ["admin", "editor"]} (IN clause)
|
||||||
|
```
|
||||||
|
|
||||||
## Sorting
|
## Sorting
|
||||||
|
|
||||||
!!! info "Added in `v1.3`"
|
!!! info "Added in `v1.3`"
|
||||||
|
|
||||||
Declare `order_fields` on the CRUD class. Relationship traversal is supported via tuples, using the same syntax as `searchable_fields` and `facet_fields`:
|
Declare `order_fields` on the CRUD class to expose client-driven column ordering via `order_by` and `order` query parameters.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
UserCrud = CrudFactory(
|
UserCrud = CrudFactory(
|
||||||
@@ -472,80 +532,46 @@ UserCrud = CrudFactory(
|
|||||||
order_fields=[
|
order_fields=[
|
||||||
User.name,
|
User.name,
|
||||||
User.created_at,
|
User.created_at,
|
||||||
(User.role, Role.name), # sort by a related model column
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
You can override `order_fields` per call:
|
Call [`order_params()`](../reference/crud.md#fastapi_toolsets.crud.factory.AsyncCrud.order_params) to generate a FastAPI dependency that maps the query parameters to an [`OrderByClause`](../reference/crud.md#fastapi_toolsets.crud.factory.OrderByClause) expression:
|
||||||
|
|
||||||
```python
|
|
||||||
result = await UserCrud.offset_paginate(
|
|
||||||
session=session,
|
|
||||||
order_fields=[User.name],
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
Or via the dependency to narrow which fields are exposed as query parameters:
|
|
||||||
|
|
||||||
```python
|
|
||||||
params = UserCrud.offset_paginate_params(order_fields=[User.name])
|
|
||||||
```
|
|
||||||
|
|
||||||
Sorting is built into the consolidated params dependencies. When `order=True` (the default), `order_by` and `order` query parameters are exposed and resolved into an `OrderByClause` automatically:
|
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
|
||||||
from fastapi import Depends
|
from fastapi import Depends
|
||||||
|
from fastapi_toolsets.crud import OrderByClause
|
||||||
|
|
||||||
@router.get("")
|
@router.get("")
|
||||||
async def list_users(
|
async def list_users(
|
||||||
session: SessionDep,
|
session: SessionDep,
|
||||||
params: Annotated[dict, Depends(UserCrud.offset_paginate_params())],
|
order_by: Annotated[OrderByClause | None, Depends(UserCrud.order_params())],
|
||||||
) -> OffsetPaginatedResponse[UserRead]:
|
) -> OffsetPaginatedResponse[UserRead]:
|
||||||
return await UserCrud.offset_paginate(session=session, **params, schema=UserRead)
|
return await UserCrud.offset_paginate(session=session, order_by=order_by, schema=UserRead)
|
||||||
```
|
|
||||||
|
|
||||||
```python
|
|
||||||
@router.get("")
|
|
||||||
async def list_users(
|
|
||||||
session: SessionDep,
|
|
||||||
params: Annotated[dict, Depends(UserCrud.cursor_paginate_params())],
|
|
||||||
) -> CursorPaginatedResponse[UserRead]:
|
|
||||||
return await UserCrud.cursor_paginate(session=session, **params, schema=UserRead)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The dependency adds two query parameters to the endpoint:
|
The dependency adds two query parameters to the endpoint:
|
||||||
|
|
||||||
| Parameter | Type |
|
| Parameter | Type |
|
||||||
| ---------- | --------------- |
|
| ---------- | --------------- |
|
||||||
| `order_by` | `str \| null` |
|
| `order_by` | `str | null` |
|
||||||
| `order` | `asc` or `desc` |
|
| `order` | `asc` or `desc` |
|
||||||
|
|
||||||
```
|
```
|
||||||
GET /users?order_by=name&order=asc → ORDER BY users.name ASC
|
GET /users?order_by=name&order=asc → ORDER BY users.name ASC
|
||||||
GET /users?order_by=role__name&order=desc → LEFT JOIN roles ON ... ORDER BY roles.name DESC
|
GET /users?order_by=name&order=desc → ORDER BY users.name DESC
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! info "Relationship tuples are joined automatically."
|
An unknown `order_by` value raises [`InvalidOrderFieldError`](../reference/exceptions.md#fastapi_toolsets.exceptions.exceptions.InvalidOrderFieldError) (HTTP 422).
|
||||||
When a relation field is selected, the related table is LEFT OUTER JOINed automatically. An unknown `order_by` value raises [`InvalidOrderFieldError`](../reference/exceptions.md#fastapi_toolsets.exceptions.exceptions.InvalidOrderFieldError) (HTTP 422).
|
|
||||||
|
|
||||||
|
You can also pass `order_fields` directly to `order_params()` to override the class-level defaults without modifying them:
|
||||||
|
|
||||||
The available sort keys are returned in the `order_columns` field of [`PaginatedResponse`](../reference/schemas.md#fastapi_toolsets.schemas.PaginatedResponse). Use them to populate a sort picker in the UI, or to validate `order_by` values on the client side:
|
```python
|
||||||
|
UserOrderParams = UserCrud.order_params(order_fields=[User.name])
|
||||||
```json
|
|
||||||
{
|
|
||||||
"status": "SUCCESS",
|
|
||||||
"data": ["..."],
|
|
||||||
"pagination": { "..." },
|
|
||||||
"order_columns": ["created_at", "name", "role__name"]
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! info "Key format uses `__` as a separator for relationship chains."
|
|
||||||
A direct column `User.name` produces `"name"`. A relationship tuple `(User.role, Role.name)` produces `"role__name"`.
|
|
||||||
|
|
||||||
## Relationship loading
|
## Relationship loading
|
||||||
|
|
||||||
!!! info "Added in `v1.1`"
|
!!! info "Added in `v1.1`"
|
||||||
@@ -630,11 +656,12 @@ async def get_user(session: SessionDep, uuid: UUID) -> Response[UserRead]:
|
|||||||
)
|
)
|
||||||
|
|
||||||
@router.get("")
|
@router.get("")
|
||||||
async def list_users(
|
async def list_users(session: SessionDep, page: int = 1) -> OffsetPaginatedResponse[UserRead]:
|
||||||
session: SessionDep,
|
return await crud.UserCrud.offset_paginate(
|
||||||
params: Annotated[dict, Depends(crud.UserCrud.offset_paginate_params())],
|
session=session,
|
||||||
) -> OffsetPaginatedResponse[UserRead]:
|
page=page,
|
||||||
return await crud.UserCrud.offset_paginate(session=session, **params, schema=UserRead)
|
schema=UserRead,
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
The schema must have `from_attributes=True` (or inherit from [`PydanticBase`](../reference/schemas.md#fastapi_toolsets.schemas.PydanticBase)) so it can be built from SQLAlchemy model instances.
|
The schema must have `from_attributes=True` (or inherit from [`PydanticBase`](../reference/schemas.md#fastapi_toolsets.schemas.PydanticBase)) so it can be built from SQLAlchemy model instances.
|
||||||
|
|||||||
@@ -1,267 +0,0 @@
|
|||||||
# Security
|
|
||||||
|
|
||||||
Composable authentication helpers for FastAPI that use `Security()` for OpenAPI documentation and accept user-provided validator functions with full type flexibility.
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
The `security` module provides four auth source classes and a `MultiAuth` factory. Each class wraps a FastAPI security scheme for OpenAPI and accepts a validator function called as:
|
|
||||||
|
|
||||||
```python
|
|
||||||
await validator(credential, **kwargs)
|
|
||||||
```
|
|
||||||
|
|
||||||
where `kwargs` are the extra keyword arguments provided at instantiation (roles, permissions, enums, etc.). The validator returns the authenticated identity (e.g. a `User` model) which becomes the route dependency value.
|
|
||||||
|
|
||||||
```python
|
|
||||||
from fastapi import Security
|
|
||||||
from fastapi_toolsets.security import BearerTokenAuth
|
|
||||||
|
|
||||||
async def verify_token(token: str, *, role: str) -> User:
|
|
||||||
user = await db.get_by_token(token)
|
|
||||||
if not user or user.role != role:
|
|
||||||
raise UnauthorizedError()
|
|
||||||
return user
|
|
||||||
|
|
||||||
bearer_admin = BearerTokenAuth(verify_token, role="admin")
|
|
||||||
|
|
||||||
@app.get("/admin")
|
|
||||||
async def admin_route(user: User = Security(bearer_admin)):
|
|
||||||
return user
|
|
||||||
```
|
|
||||||
|
|
||||||
## Auth sources
|
|
||||||
|
|
||||||
### [`BearerTokenAuth`](../reference/security.md#fastapi_toolsets.security.BearerTokenAuth)
|
|
||||||
|
|
||||||
Reads the `Authorization: Bearer <token>` header. Wraps `HTTPBearer` for OpenAPI.
|
|
||||||
|
|
||||||
```python
|
|
||||||
from fastapi_toolsets.security import BearerTokenAuth
|
|
||||||
|
|
||||||
bearer = BearerTokenAuth(validator=verify_token)
|
|
||||||
|
|
||||||
@app.get("/me")
|
|
||||||
async def me(user: User = Security(bearer)):
|
|
||||||
return user
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Token prefix
|
|
||||||
|
|
||||||
The optional `prefix` parameter restricts a `BearerTokenAuth` instance to tokens
|
|
||||||
that start with a given string. The prefix is **kept** in the value passed to the
|
|
||||||
validator — store and compare tokens with their prefix included.
|
|
||||||
|
|
||||||
This lets you deploy multiple `BearerTokenAuth` instances in the same application
|
|
||||||
and disambiguate them efficiently in `MultiAuth`:
|
|
||||||
|
|
||||||
```python
|
|
||||||
user_bearer = BearerTokenAuth(verify_user, prefix="user_") # matches "Bearer user_..."
|
|
||||||
org_bearer = BearerTokenAuth(verify_org, prefix="org_") # matches "Bearer org_..."
|
|
||||||
```
|
|
||||||
|
|
||||||
Use [`generate_token()`](#token-generation) to create correctly-prefixed tokens.
|
|
||||||
|
|
||||||
#### Token generation
|
|
||||||
|
|
||||||
`BearerTokenAuth.generate_token()` produces a secure random token ready to store
|
|
||||||
in your database and return to the client. If a prefix is configured it is
|
|
||||||
prepended automatically:
|
|
||||||
|
|
||||||
```python
|
|
||||||
bearer = BearerTokenAuth(verify_token, prefix="user_")
|
|
||||||
|
|
||||||
token = bearer.generate_token() # e.g. "user_Xk3mN..."
|
|
||||||
await db.store_token(user_id, token)
|
|
||||||
return {"access_token": token, "token_type": "bearer"}
|
|
||||||
```
|
|
||||||
|
|
||||||
The client sends `Authorization: Bearer user_Xk3mN...` and the validator receives
|
|
||||||
the full token (prefix included) to compare against the stored value.
|
|
||||||
|
|
||||||
### [`CookieAuth`](../reference/security.md#fastapi_toolsets.security.CookieAuth)
|
|
||||||
|
|
||||||
Reads a named cookie. Wraps `APIKeyCookie` for OpenAPI.
|
|
||||||
|
|
||||||
```python
|
|
||||||
from fastapi_toolsets.security import CookieAuth
|
|
||||||
|
|
||||||
cookie_auth = CookieAuth("session", validator=verify_session)
|
|
||||||
|
|
||||||
@app.get("/me")
|
|
||||||
async def me(user: User = Security(cookie_auth)):
|
|
||||||
return user
|
|
||||||
```
|
|
||||||
|
|
||||||
### [`OAuth2Auth`](../reference/security.md#fastapi_toolsets.security.OAuth2Auth)
|
|
||||||
|
|
||||||
Reads the `Authorization: Bearer <token>` header and registers the token endpoint
|
|
||||||
in OpenAPI via `OAuth2PasswordBearer`.
|
|
||||||
|
|
||||||
```python
|
|
||||||
from fastapi_toolsets.security import OAuth2Auth
|
|
||||||
|
|
||||||
oauth2_auth = OAuth2Auth(token_url="/token", validator=verify_token)
|
|
||||||
|
|
||||||
@app.get("/me")
|
|
||||||
async def me(user: User = Security(oauth2_auth)):
|
|
||||||
return user
|
|
||||||
```
|
|
||||||
|
|
||||||
### [`OpenIDAuth`](../reference/security.md#fastapi_toolsets.security.OpenIDAuth)
|
|
||||||
|
|
||||||
Reads the `Authorization: Bearer <token>` header and registers the OpenID Connect
|
|
||||||
discovery URL in OpenAPI via `OpenIdConnect`. Token validation is fully delegated
|
|
||||||
to your validator — use any OIDC / JWT library (`authlib`, `python-jose`, `PyJWT`).
|
|
||||||
|
|
||||||
```python
|
|
||||||
from fastapi_toolsets.security import OpenIDAuth
|
|
||||||
|
|
||||||
async def verify_google_token(token: str, *, audience: str) -> User:
|
|
||||||
payload = jwt.decode(token, google_public_keys, algorithms=["RS256"],
|
|
||||||
audience=audience)
|
|
||||||
return User(email=payload["email"], name=payload["name"])
|
|
||||||
|
|
||||||
google_auth = OpenIDAuth(
|
|
||||||
"https://accounts.google.com/.well-known/openid-configuration",
|
|
||||||
verify_google_token,
|
|
||||||
audience="my-client-id",
|
|
||||||
)
|
|
||||||
|
|
||||||
@app.get("/me")
|
|
||||||
async def me(user: User = Security(google_auth)):
|
|
||||||
return user
|
|
||||||
```
|
|
||||||
|
|
||||||
The discovery URL is used **only for OpenAPI documentation** — no requests are made
|
|
||||||
to it by this class. You are responsible for fetching and caching the provider's
|
|
||||||
public keys in your validator.
|
|
||||||
|
|
||||||
Multiple providers work naturally with `MultiAuth`:
|
|
||||||
|
|
||||||
```python
|
|
||||||
multi = MultiAuth(google_auth, github_auth)
|
|
||||||
|
|
||||||
@app.get("/data")
|
|
||||||
async def data(user: User = Security(multi)):
|
|
||||||
return user
|
|
||||||
```
|
|
||||||
|
|
||||||
## Typed validator kwargs
|
|
||||||
|
|
||||||
All auth classes forward extra instantiation keyword arguments to the validator.
|
|
||||||
Arguments can be any type — enums, strings, integers, etc. The validator returns
|
|
||||||
the authenticated identity, which FastAPI injects directly into the route handler.
|
|
||||||
|
|
||||||
```python
|
|
||||||
async def verify_token(token: str, *, role: Role, permission: str) -> User:
|
|
||||||
user = await decode_token(token)
|
|
||||||
if user.role != role or permission not in user.permissions:
|
|
||||||
raise UnauthorizedError()
|
|
||||||
return user
|
|
||||||
|
|
||||||
bearer = BearerTokenAuth(verify_token, role=Role.ADMIN, permission="billing:read")
|
|
||||||
```
|
|
||||||
|
|
||||||
Each auth instance is self-contained — create a separate instance per distinct
|
|
||||||
requirement instead of passing requirements through `Security(scopes=[...])`.
|
|
||||||
|
|
||||||
### Using `.require()` inline
|
|
||||||
|
|
||||||
If declaring a new top-level variable per role feels verbose, use `.require()` to
|
|
||||||
create a configured clone directly in the route decorator. The original instance
|
|
||||||
is not mutated:
|
|
||||||
|
|
||||||
```python
|
|
||||||
bearer = BearerTokenAuth(verify_token)
|
|
||||||
|
|
||||||
@app.get("/admin/stats")
|
|
||||||
async def admin_stats(user: User = Security(bearer.require(role=Role.ADMIN))):
|
|
||||||
return {"message": f"Hello admin {user.name}"}
|
|
||||||
|
|
||||||
@app.get("/profile")
|
|
||||||
async def profile(user: User = Security(bearer.require(role=Role.USER))):
|
|
||||||
return {"id": user.id, "name": user.name}
|
|
||||||
```
|
|
||||||
|
|
||||||
`.require()` kwargs are merged over existing ones — new values win on conflict.
|
|
||||||
The `prefix` (for `BearerTokenAuth`) and cookie name (for `CookieAuth`) are
|
|
||||||
always preserved.
|
|
||||||
|
|
||||||
`.require()` instances work transparently inside `MultiAuth`:
|
|
||||||
|
|
||||||
```python
|
|
||||||
multi = MultiAuth(
|
|
||||||
user_bearer.require(role=Role.USER),
|
|
||||||
org_bearer.require(role=Role.ADMIN),
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
## MultiAuth
|
|
||||||
|
|
||||||
[`MultiAuth`](../reference/security.md#fastapi_toolsets.security.MultiAuth) combines
|
|
||||||
multiple auth sources into a single callable. Sources are tried in order; the
|
|
||||||
first one that finds a credential wins.
|
|
||||||
|
|
||||||
```python
|
|
||||||
from fastapi_toolsets.security import MultiAuth
|
|
||||||
|
|
||||||
multi = MultiAuth(user_bearer, org_bearer, cookie_auth)
|
|
||||||
|
|
||||||
@app.get("/data")
|
|
||||||
async def data_route(user = Security(multi)):
|
|
||||||
return user
|
|
||||||
```
|
|
||||||
|
|
||||||
### Using `.require()` on MultiAuth
|
|
||||||
|
|
||||||
`MultiAuth` also supports `.require()`, which propagates the kwargs to every
|
|
||||||
source that implements it. Sources that do not (e.g. custom `AuthSource`
|
|
||||||
subclasses) are passed through unchanged:
|
|
||||||
|
|
||||||
```python
|
|
||||||
multi = MultiAuth(bearer, cookie)
|
|
||||||
|
|
||||||
@app.get("/admin")
|
|
||||||
async def admin(user: User = Security(multi.require(role=Role.ADMIN))):
|
|
||||||
return user
|
|
||||||
```
|
|
||||||
|
|
||||||
This is equivalent to calling `.require()` on each source individually:
|
|
||||||
|
|
||||||
```python
|
|
||||||
# These two are identical
|
|
||||||
multi.require(role=Role.ADMIN)
|
|
||||||
|
|
||||||
MultiAuth(
|
|
||||||
bearer.require(role=Role.ADMIN),
|
|
||||||
cookie.require(role=Role.ADMIN),
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Prefix-based dispatch
|
|
||||||
|
|
||||||
Because `extract()` is pure string matching (no I/O), prefix-based source
|
|
||||||
selection is essentially free. Only the matching source's validator (which may
|
|
||||||
involve DB or network I/O) is ever called:
|
|
||||||
|
|
||||||
```python
|
|
||||||
user_bearer = BearerTokenAuth(verify_user, prefix="user_")
|
|
||||||
org_bearer = BearerTokenAuth(verify_org, prefix="org_")
|
|
||||||
|
|
||||||
multi = MultiAuth(user_bearer, org_bearer)
|
|
||||||
|
|
||||||
# "Bearer user_alice" → only verify_user runs, receives "user_alice"
|
|
||||||
# "Bearer org_acme" → only verify_org runs, receives "org_acme"
|
|
||||||
```
|
|
||||||
|
|
||||||
Tokens are stored and compared **with their prefix** — use `generate_token()` on
|
|
||||||
each source to issue correctly-prefixed tokens:
|
|
||||||
|
|
||||||
```python
|
|
||||||
user_token = user_bearer.generate_token() # "user_..."
|
|
||||||
org_token = org_bearer.generate_token() # "org_..."
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
[:material-api: API Reference](../reference/security.md)
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# `security`
|
|
||||||
|
|
||||||
Here's the reference for the authentication helpers provided by the `security` module.
|
|
||||||
|
|
||||||
You can import them directly from `fastapi_toolsets.security`:
|
|
||||||
|
|
||||||
```python
|
|
||||||
from fastapi_toolsets.security import (
|
|
||||||
AuthSource,
|
|
||||||
BearerTokenAuth,
|
|
||||||
CookieAuth,
|
|
||||||
OAuth2Auth,
|
|
||||||
OpenIDAuth,
|
|
||||||
MultiAuth,
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
## ::: fastapi_toolsets.security.AuthSource
|
|
||||||
|
|
||||||
## ::: fastapi_toolsets.security.BearerTokenAuth
|
|
||||||
|
|
||||||
## ::: fastapi_toolsets.security.CookieAuth
|
|
||||||
|
|
||||||
## ::: fastapi_toolsets.security.OAuth2Auth
|
|
||||||
|
|
||||||
## ::: fastapi_toolsets.security.OpenIDAuth
|
|
||||||
|
|
||||||
## ::: fastapi_toolsets.security.MultiAuth
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
from fastapi import FastAPI
|
|
||||||
|
|
||||||
from fastapi_toolsets.exceptions import init_exceptions_handlers
|
|
||||||
|
|
||||||
from .routes import router
|
|
||||||
|
|
||||||
app = FastAPI()
|
|
||||||
init_exceptions_handlers(app=app)
|
|
||||||
app.include_router(router=router)
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
from fastapi_toolsets.crud import CrudFactory
|
|
||||||
|
|
||||||
from .models import OAuthAccount, OAuthProvider, Team, User, UserToken
|
|
||||||
|
|
||||||
TeamCrud = CrudFactory(model=Team)
|
|
||||||
UserCrud = CrudFactory(model=User)
|
|
||||||
UserTokenCrud = CrudFactory(model=UserToken)
|
|
||||||
OAuthProviderCrud = CrudFactory(model=OAuthProvider)
|
|
||||||
OAuthAccountCrud = CrudFactory(model=OAuthAccount)
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
from fastapi import Depends
|
|
||||||
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
|
|
||||||
|
|
||||||
from fastapi_toolsets.db import create_db_context, create_db_dependency
|
|
||||||
|
|
||||||
DATABASE_URL = "postgresql+asyncpg://postgres:postgres@localhost:5432/postgres"
|
|
||||||
|
|
||||||
engine = create_async_engine(url=DATABASE_URL, future=True)
|
|
||||||
async_session_maker = async_sessionmaker(bind=engine, expire_on_commit=False)
|
|
||||||
|
|
||||||
get_db = create_db_dependency(session_maker=async_session_maker)
|
|
||||||
get_db_context = create_db_context(session_maker=async_session_maker)
|
|
||||||
|
|
||||||
|
|
||||||
SessionDep = Depends(get_db)
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
import enum
|
|
||||||
from datetime import datetime
|
|
||||||
from uuid import UUID
|
|
||||||
|
|
||||||
from sqlalchemy import (
|
|
||||||
Boolean,
|
|
||||||
DateTime,
|
|
||||||
Enum,
|
|
||||||
ForeignKey,
|
|
||||||
Integer,
|
|
||||||
String,
|
|
||||||
UniqueConstraint,
|
|
||||||
)
|
|
||||||
from sqlalchemy.dialects.postgresql import UUID as PG_UUID
|
|
||||||
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship
|
|
||||||
|
|
||||||
from fastapi_toolsets.models import TimestampMixin, UUIDMixin
|
|
||||||
|
|
||||||
|
|
||||||
class Base(DeclarativeBase, UUIDMixin):
|
|
||||||
type_annotation_map = {
|
|
||||||
str: String(),
|
|
||||||
int: Integer(),
|
|
||||||
UUID: PG_UUID(as_uuid=True),
|
|
||||||
datetime: DateTime(timezone=True),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class UserRole(enum.Enum):
|
|
||||||
admin = "admin"
|
|
||||||
moderator = "moderator"
|
|
||||||
user = "user"
|
|
||||||
|
|
||||||
|
|
||||||
class Team(Base, TimestampMixin):
|
|
||||||
__tablename__ = "teams"
|
|
||||||
|
|
||||||
name: Mapped[str] = mapped_column(String, unique=True, index=True)
|
|
||||||
users: Mapped[list["User"]] = relationship(back_populates="team")
|
|
||||||
|
|
||||||
|
|
||||||
class User(Base, TimestampMixin):
|
|
||||||
__tablename__ = "users"
|
|
||||||
|
|
||||||
username: Mapped[str] = mapped_column(String, unique=True, index=True)
|
|
||||||
email: Mapped[str | None] = mapped_column(
|
|
||||||
String, unique=True, index=True, nullable=True
|
|
||||||
)
|
|
||||||
hashed_password: Mapped[str | None] = mapped_column(String, nullable=True)
|
|
||||||
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
||||||
role: Mapped[UserRole] = mapped_column(Enum(UserRole), default=UserRole.user)
|
|
||||||
|
|
||||||
team_id: Mapped[UUID | None] = mapped_column(ForeignKey("teams.id"), nullable=True)
|
|
||||||
team: Mapped["Team | None"] = relationship(back_populates="users")
|
|
||||||
oauth_accounts: Mapped[list["OAuthAccount"]] = relationship(back_populates="user")
|
|
||||||
tokens: Mapped[list["UserToken"]] = relationship(back_populates="user")
|
|
||||||
|
|
||||||
|
|
||||||
class UserToken(Base, TimestampMixin):
|
|
||||||
"""API tokens for a user (multiple allowed)."""
|
|
||||||
|
|
||||||
__tablename__ = "user_tokens"
|
|
||||||
|
|
||||||
user_id: Mapped[UUID] = mapped_column(ForeignKey("users.id"))
|
|
||||||
# Store hashed token value
|
|
||||||
token_hash: Mapped[str] = mapped_column(String, unique=True, index=True)
|
|
||||||
name: Mapped[str | None] = mapped_column(String, nullable=True)
|
|
||||||
expires_at: Mapped[datetime | None] = mapped_column(
|
|
||||||
DateTime(timezone=True), nullable=True
|
|
||||||
)
|
|
||||||
|
|
||||||
user: Mapped["User"] = relationship(back_populates="tokens")
|
|
||||||
|
|
||||||
|
|
||||||
class OAuthProvider(Base, TimestampMixin):
|
|
||||||
"""Configurable OAuth2 / OpenID Connect provider."""
|
|
||||||
|
|
||||||
__tablename__ = "oauth_providers"
|
|
||||||
|
|
||||||
slug: Mapped[str] = mapped_column(String, unique=True, index=True)
|
|
||||||
name: Mapped[str] = mapped_column(String)
|
|
||||||
client_id: Mapped[str] = mapped_column(String)
|
|
||||||
client_secret: Mapped[str] = mapped_column(String)
|
|
||||||
discovery_url: Mapped[str] = mapped_column(String, nullable=False)
|
|
||||||
scopes: Mapped[str] = mapped_column(String, default="openid email profile")
|
|
||||||
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
||||||
|
|
||||||
accounts: Mapped[list["OAuthAccount"]] = relationship(back_populates="provider")
|
|
||||||
|
|
||||||
|
|
||||||
class OAuthAccount(Base, TimestampMixin):
|
|
||||||
"""OAuth2 / OpenID Connect account linked to a user."""
|
|
||||||
|
|
||||||
__tablename__ = "oauth_accounts"
|
|
||||||
__table_args__ = (
|
|
||||||
UniqueConstraint("provider_id", "subject", name="uq_oauth_provider_subject"),
|
|
||||||
)
|
|
||||||
|
|
||||||
user_id: Mapped[UUID] = mapped_column(ForeignKey("users.id"))
|
|
||||||
provider_id: Mapped[UUID] = mapped_column(ForeignKey("oauth_providers.id"))
|
|
||||||
# OAuth `sub` / OpenID subject identifier
|
|
||||||
subject: Mapped[str] = mapped_column(String)
|
|
||||||
|
|
||||||
user: Mapped["User"] = relationship(back_populates="oauth_accounts")
|
|
||||||
provider: Mapped["OAuthProvider"] = relationship(back_populates="accounts")
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
from typing import Annotated
|
|
||||||
from uuid import UUID
|
|
||||||
|
|
||||||
import bcrypt
|
|
||||||
from fastapi import APIRouter, Form, HTTPException, Response, Security
|
|
||||||
|
|
||||||
from fastapi_toolsets.dependencies import PathDependency
|
|
||||||
|
|
||||||
from .crud import UserCrud, UserTokenCrud
|
|
||||||
from .db import SessionDep
|
|
||||||
from .models import OAuthProvider, User, UserToken
|
|
||||||
from .schemas import (
|
|
||||||
ApiTokenCreateRequest,
|
|
||||||
ApiTokenResponse,
|
|
||||||
RegisterRequest,
|
|
||||||
UserCreate,
|
|
||||||
UserResponse,
|
|
||||||
)
|
|
||||||
from .security import auth, cookie_auth, create_api_token
|
|
||||||
|
|
||||||
ProviderDep = PathDependency(
|
|
||||||
model=OAuthProvider,
|
|
||||||
field=OAuthProvider.slug,
|
|
||||||
session_dep=SessionDep,
|
|
||||||
param_name="slug",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def hash_password(password: str) -> str:
|
|
||||||
return bcrypt.hashpw(password.encode(), bcrypt.gensalt()).decode()
|
|
||||||
|
|
||||||
|
|
||||||
def verify_password(plain: str, hashed: str) -> bool:
|
|
||||||
return bcrypt.checkpw(plain.encode(), hashed.encode())
|
|
||||||
|
|
||||||
|
|
||||||
router = APIRouter(prefix="/auth")
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/register", response_model=UserResponse, status_code=201)
|
|
||||||
async def register(body: RegisterRequest, session: SessionDep):
|
|
||||||
existing = await UserCrud.first(
|
|
||||||
session=session, filters=[User.username == body.username]
|
|
||||||
)
|
|
||||||
if existing:
|
|
||||||
raise HTTPException(status_code=409, detail="Username already taken")
|
|
||||||
|
|
||||||
user = await UserCrud.create(
|
|
||||||
session=session,
|
|
||||||
obj=UserCreate(
|
|
||||||
username=body.username,
|
|
||||||
email=body.email,
|
|
||||||
hashed_password=hash_password(body.password),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
return user
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/token", status_code=204)
|
|
||||||
async def login(
|
|
||||||
session: SessionDep,
|
|
||||||
response: Response,
|
|
||||||
username: Annotated[str, Form()],
|
|
||||||
password: Annotated[str, Form()],
|
|
||||||
):
|
|
||||||
user = await UserCrud.first(session=session, filters=[User.username == username])
|
|
||||||
|
|
||||||
if (
|
|
||||||
not user
|
|
||||||
or not user.hashed_password
|
|
||||||
or not verify_password(password, user.hashed_password)
|
|
||||||
):
|
|
||||||
raise HTTPException(status_code=401, detail="Invalid credentials")
|
|
||||||
|
|
||||||
if not user.is_active:
|
|
||||||
raise HTTPException(status_code=403, detail="Account disabled")
|
|
||||||
|
|
||||||
cookie_auth.set_cookie(response, str(user.id))
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/logout", status_code=204)
|
|
||||||
async def logout(response: Response):
|
|
||||||
cookie_auth.delete_cookie(response)
|
|
||||||
|
|
||||||
|
|
||||||
@router.get("/me", response_model=UserResponse)
|
|
||||||
async def me(user: User = Security(auth)):
|
|
||||||
return user
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/tokens", response_model=ApiTokenResponse, status_code=201)
|
|
||||||
async def create_token(
|
|
||||||
body: ApiTokenCreateRequest,
|
|
||||||
user: User = Security(auth),
|
|
||||||
):
|
|
||||||
raw, token_row = await create_api_token(
|
|
||||||
user.id, name=body.name, expires_at=body.expires_at
|
|
||||||
)
|
|
||||||
return ApiTokenResponse(
|
|
||||||
id=token_row.id,
|
|
||||||
name=token_row.name,
|
|
||||||
expires_at=token_row.expires_at,
|
|
||||||
created_at=token_row.created_at,
|
|
||||||
token=raw,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/tokens/{token_id}", status_code=204)
|
|
||||||
async def revoke_token(
|
|
||||||
session: SessionDep,
|
|
||||||
token_id: UUID,
|
|
||||||
user: User = Security(auth),
|
|
||||||
):
|
|
||||||
if not await UserTokenCrud.first(
|
|
||||||
session=session,
|
|
||||||
filters=[UserToken.id == token_id, UserToken.user_id == user.id],
|
|
||||||
):
|
|
||||||
raise HTTPException(status_code=404, detail="Token not found")
|
|
||||||
await UserTokenCrud.delete(
|
|
||||||
session=session,
|
|
||||||
filters=[UserToken.id == token_id, UserToken.user_id == user.id],
|
|
||||||
)
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
from datetime import datetime
|
|
||||||
from uuid import UUID
|
|
||||||
|
|
||||||
from pydantic import EmailStr
|
|
||||||
|
|
||||||
from fastapi_toolsets.schemas import PydanticBase
|
|
||||||
|
|
||||||
|
|
||||||
class RegisterRequest(PydanticBase):
|
|
||||||
username: str
|
|
||||||
password: str
|
|
||||||
email: EmailStr | None = None
|
|
||||||
|
|
||||||
|
|
||||||
class UserResponse(PydanticBase):
|
|
||||||
id: UUID
|
|
||||||
username: str
|
|
||||||
email: str | None
|
|
||||||
role: str
|
|
||||||
is_active: bool
|
|
||||||
|
|
||||||
model_config = {"from_attributes": True}
|
|
||||||
|
|
||||||
|
|
||||||
class ApiTokenCreateRequest(PydanticBase):
|
|
||||||
name: str | None = None
|
|
||||||
expires_at: datetime | None = None
|
|
||||||
|
|
||||||
|
|
||||||
class ApiTokenResponse(PydanticBase):
|
|
||||||
id: UUID
|
|
||||||
name: str | None
|
|
||||||
expires_at: datetime | None
|
|
||||||
created_at: datetime
|
|
||||||
# Only populated on creation
|
|
||||||
token: str | None = None
|
|
||||||
|
|
||||||
model_config = {"from_attributes": True}
|
|
||||||
|
|
||||||
|
|
||||||
class OAuthProviderResponse(PydanticBase):
|
|
||||||
slug: str
|
|
||||||
name: str
|
|
||||||
|
|
||||||
model_config = {"from_attributes": True}
|
|
||||||
|
|
||||||
|
|
||||||
class UserCreate(PydanticBase):
|
|
||||||
username: str
|
|
||||||
email: str | None = None
|
|
||||||
hashed_password: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
class UserTokenCreate(PydanticBase):
|
|
||||||
user_id: UUID
|
|
||||||
token_hash: str
|
|
||||||
name: str | None = None
|
|
||||||
expires_at: datetime | None = None
|
|
||||||
|
|
||||||
|
|
||||||
class OAuthAccountCreate(PydanticBase):
|
|
||||||
user_id: UUID
|
|
||||||
provider_id: UUID
|
|
||||||
subject: str
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
import hashlib
|
|
||||||
from datetime import datetime, timezone
|
|
||||||
from uuid import UUID
|
|
||||||
|
|
||||||
from fastapi import HTTPException
|
|
||||||
from sqlalchemy.orm import selectinload
|
|
||||||
|
|
||||||
from fastapi_toolsets.exceptions import UnauthorizedError
|
|
||||||
from fastapi_toolsets.security import (
|
|
||||||
APIKeyHeaderAuth,
|
|
||||||
BearerTokenAuth,
|
|
||||||
CookieAuth,
|
|
||||||
MultiAuth,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .crud import UserCrud, UserTokenCrud
|
|
||||||
from .db import get_db_context
|
|
||||||
from .models import User, UserRole, UserToken
|
|
||||||
from .schemas import UserTokenCreate
|
|
||||||
|
|
||||||
SESSION_COOKIE = "session"
|
|
||||||
SECRET_KEY = "123456789"
|
|
||||||
|
|
||||||
|
|
||||||
def _hash_token(token: str) -> str:
|
|
||||||
return hashlib.sha256(token.encode()).hexdigest()
|
|
||||||
|
|
||||||
|
|
||||||
async def _verify_token(token: str, role: UserRole | None = None) -> User:
|
|
||||||
async with get_db_context() as db:
|
|
||||||
user_token = await UserTokenCrud.first(
|
|
||||||
session=db,
|
|
||||||
filters=[UserToken.token_hash == _hash_token(token)],
|
|
||||||
load_options=[selectinload(UserToken.user)],
|
|
||||||
)
|
|
||||||
|
|
||||||
if user_token is None or not user_token.user.is_active:
|
|
||||||
raise UnauthorizedError()
|
|
||||||
|
|
||||||
if user_token.expires_at and user_token.expires_at < datetime.now(timezone.utc):
|
|
||||||
raise UnauthorizedError()
|
|
||||||
|
|
||||||
user = user_token.user
|
|
||||||
|
|
||||||
if role is not None and user.role != role:
|
|
||||||
raise HTTPException(status_code=403, detail="Insufficient permissions")
|
|
||||||
|
|
||||||
return user
|
|
||||||
|
|
||||||
|
|
||||||
async def _verify_cookie(user_id: str, role: UserRole | None = None) -> User:
|
|
||||||
async with get_db_context() as db:
|
|
||||||
user = await UserCrud.first(
|
|
||||||
session=db,
|
|
||||||
filters=[User.id == UUID(user_id)],
|
|
||||||
)
|
|
||||||
|
|
||||||
if not user or not user.is_active:
|
|
||||||
raise UnauthorizedError()
|
|
||||||
|
|
||||||
if role is not None and user.role != role:
|
|
||||||
raise HTTPException(status_code=403, detail="Insufficient permissions")
|
|
||||||
|
|
||||||
return user
|
|
||||||
|
|
||||||
|
|
||||||
bearer_auth = BearerTokenAuth(
|
|
||||||
validator=_verify_token,
|
|
||||||
prefix="ctf_",
|
|
||||||
)
|
|
||||||
header_auth = APIKeyHeaderAuth(
|
|
||||||
name="X-API-Key",
|
|
||||||
validator=_verify_token,
|
|
||||||
)
|
|
||||||
cookie_auth = CookieAuth(
|
|
||||||
name=SESSION_COOKIE,
|
|
||||||
validator=_verify_cookie,
|
|
||||||
secret_key=SECRET_KEY,
|
|
||||||
)
|
|
||||||
auth = MultiAuth(bearer_auth, header_auth, cookie_auth)
|
|
||||||
|
|
||||||
|
|
||||||
async def create_api_token(
|
|
||||||
user_id: UUID,
|
|
||||||
*,
|
|
||||||
name: str | None = None,
|
|
||||||
expires_at: datetime | None = None,
|
|
||||||
) -> tuple[str, UserToken]:
|
|
||||||
raw = bearer_auth.generate_token()
|
|
||||||
async with get_db_context() as db:
|
|
||||||
token_row = await UserTokenCrud.create(
|
|
||||||
session=db,
|
|
||||||
obj=UserTokenCreate(
|
|
||||||
user_id=user_id,
|
|
||||||
token_hash=_hash_token(raw),
|
|
||||||
name=name,
|
|
||||||
expires_at=expires_at,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
return raw, token_row
|
|
||||||
@@ -2,6 +2,7 @@ from typing import Annotated
|
|||||||
|
|
||||||
from fastapi import APIRouter, Depends
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
|
from fastapi_toolsets.crud import OrderByClause
|
||||||
from fastapi_toolsets.schemas import (
|
from fastapi_toolsets.schemas import (
|
||||||
CursorPaginatedResponse,
|
CursorPaginatedResponse,
|
||||||
OffsetPaginatedResponse,
|
OffsetPaginatedResponse,
|
||||||
@@ -21,18 +22,21 @@ async def list_articles_offset(
|
|||||||
session: SessionDep,
|
session: SessionDep,
|
||||||
params: Annotated[
|
params: Annotated[
|
||||||
dict,
|
dict,
|
||||||
Depends(
|
Depends(ArticleCrud.offset_params(default_page_size=20, max_page_size=100)),
|
||||||
ArticleCrud.offset_paginate_params(
|
|
||||||
default_page_size=20,
|
|
||||||
max_page_size=100,
|
|
||||||
default_order_field=Article.created_at,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
|
filter_by: Annotated[dict[str, list[str]], Depends(ArticleCrud.filter_params())],
|
||||||
|
order_by: Annotated[
|
||||||
|
OrderByClause | None,
|
||||||
|
Depends(ArticleCrud.order_params(default_field=Article.created_at)),
|
||||||
|
],
|
||||||
|
search: str | None = None,
|
||||||
) -> OffsetPaginatedResponse[ArticleRead]:
|
) -> OffsetPaginatedResponse[ArticleRead]:
|
||||||
return await ArticleCrud.offset_paginate(
|
return await ArticleCrud.offset_paginate(
|
||||||
session=session,
|
session=session,
|
||||||
**params,
|
**params,
|
||||||
|
search=search,
|
||||||
|
filter_by=filter_by or None,
|
||||||
|
order_by=order_by,
|
||||||
schema=ArticleRead,
|
schema=ArticleRead,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -42,18 +46,21 @@ async def list_articles_cursor(
|
|||||||
session: SessionDep,
|
session: SessionDep,
|
||||||
params: Annotated[
|
params: Annotated[
|
||||||
dict,
|
dict,
|
||||||
Depends(
|
Depends(ArticleCrud.cursor_params(default_page_size=20, max_page_size=100)),
|
||||||
ArticleCrud.cursor_paginate_params(
|
|
||||||
default_page_size=20,
|
|
||||||
max_page_size=100,
|
|
||||||
default_order_field=Article.created_at,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
|
filter_by: Annotated[dict[str, list[str]], Depends(ArticleCrud.filter_params())],
|
||||||
|
order_by: Annotated[
|
||||||
|
OrderByClause | None,
|
||||||
|
Depends(ArticleCrud.order_params(default_field=Article.created_at)),
|
||||||
|
],
|
||||||
|
search: str | None = None,
|
||||||
) -> CursorPaginatedResponse[ArticleRead]:
|
) -> CursorPaginatedResponse[ArticleRead]:
|
||||||
return await ArticleCrud.cursor_paginate(
|
return await ArticleCrud.cursor_paginate(
|
||||||
session=session,
|
session=session,
|
||||||
**params,
|
**params,
|
||||||
|
search=search,
|
||||||
|
filter_by=filter_by or None,
|
||||||
|
order_by=order_by,
|
||||||
schema=ArticleRead,
|
schema=ArticleRead,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -63,17 +70,20 @@ async def list_articles(
|
|||||||
session: SessionDep,
|
session: SessionDep,
|
||||||
params: Annotated[
|
params: Annotated[
|
||||||
dict,
|
dict,
|
||||||
Depends(
|
Depends(ArticleCrud.paginate_params(default_page_size=20, max_page_size=100)),
|
||||||
ArticleCrud.paginate_params(
|
|
||||||
default_page_size=20,
|
|
||||||
max_page_size=100,
|
|
||||||
default_order_field=Article.created_at,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
|
filter_by: Annotated[dict[str, list[str]], Depends(ArticleCrud.filter_params())],
|
||||||
|
order_by: Annotated[
|
||||||
|
OrderByClause | None,
|
||||||
|
Depends(ArticleCrud.order_params(default_field=Article.created_at)),
|
||||||
|
],
|
||||||
|
search: str | None = None,
|
||||||
) -> PaginatedResponse[ArticleRead]:
|
) -> PaginatedResponse[ArticleRead]:
|
||||||
return await ArticleCrud.paginate(
|
return await ArticleCrud.paginate(
|
||||||
session,
|
session,
|
||||||
**params,
|
**params,
|
||||||
|
search=search,
|
||||||
|
filter_by=filter_by or None,
|
||||||
|
order_by=order_by,
|
||||||
schema=ArticleRead,
|
schema=ArticleRead,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "fastapi-toolsets"
|
name = "fastapi-toolsets"
|
||||||
version = "3.0.3"
|
version = "2.4.3"
|
||||||
description = "Production-ready utilities for FastAPI applications"
|
description = "Production-ready utilities for FastAPI applications"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@@ -66,7 +66,6 @@ manager = "fastapi_toolsets.cli.app:cli"
|
|||||||
dev = [
|
dev = [
|
||||||
{include-group = "tests"},
|
{include-group = "tests"},
|
||||||
{include-group = "docs"},
|
{include-group = "docs"},
|
||||||
{include-group = "docs-src"},
|
|
||||||
"fastapi-toolsets[all]",
|
"fastapi-toolsets[all]",
|
||||||
"prek>=0.3.8",
|
"prek>=0.3.8",
|
||||||
"ruff>=0.1.0",
|
"ruff>=0.1.0",
|
||||||
@@ -85,9 +84,6 @@ docs = [
|
|||||||
"mkdocstrings-python>=2.0.2",
|
"mkdocstrings-python>=2.0.2",
|
||||||
"zensical>=0.0.30",
|
"zensical>=0.0.30",
|
||||||
]
|
]
|
||||||
docs-src = [
|
|
||||||
"bcrypt>=4.0.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["uv_build>=0.10,<0.12.0"]
|
requires = ["uv_build>=0.10,<0.12.0"]
|
||||||
|
|||||||
@@ -21,4 +21,4 @@ Example usage:
|
|||||||
return Response(data={"user": user.username}, message="Success")
|
return Response(data={"user": user.username}, message="Success")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = "3.0.3"
|
__version__ = "2.4.3"
|
||||||
|
|||||||
@@ -1,38 +1,28 @@
|
|||||||
"""Generic async CRUD operations for SQLAlchemy models."""
|
"""Generic async CRUD operations for SQLAlchemy models."""
|
||||||
|
|
||||||
from ..exceptions import (
|
from ..exceptions import InvalidFacetFilterError, NoSearchableFieldsError
|
||||||
InvalidFacetFilterError,
|
|
||||||
InvalidSearchColumnError,
|
|
||||||
NoSearchableFieldsError,
|
|
||||||
UnsupportedFacetTypeError,
|
|
||||||
)
|
|
||||||
from ..schemas import PaginationType
|
from ..schemas import PaginationType
|
||||||
from ..types import (
|
from ..types import (
|
||||||
FacetFieldType,
|
FacetFieldType,
|
||||||
JoinType,
|
JoinType,
|
||||||
M2MFieldType,
|
M2MFieldType,
|
||||||
OrderByClause,
|
OrderByClause,
|
||||||
OrderFieldType,
|
|
||||||
SearchFieldType,
|
SearchFieldType,
|
||||||
)
|
)
|
||||||
from .factory import AsyncCrud, CrudFactory, lateral_load
|
from .factory import AsyncCrud, CrudFactory
|
||||||
from .search import SearchConfig, get_searchable_fields
|
from .search import SearchConfig, get_searchable_fields
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"AsyncCrud",
|
"AsyncCrud",
|
||||||
"CrudFactory",
|
"CrudFactory",
|
||||||
"lateral_load",
|
|
||||||
"FacetFieldType",
|
"FacetFieldType",
|
||||||
"get_searchable_fields",
|
"get_searchable_fields",
|
||||||
"InvalidFacetFilterError",
|
"InvalidFacetFilterError",
|
||||||
"InvalidSearchColumnError",
|
|
||||||
"JoinType",
|
"JoinType",
|
||||||
"M2MFieldType",
|
"M2MFieldType",
|
||||||
"NoSearchableFieldsError",
|
"NoSearchableFieldsError",
|
||||||
"OrderByClause",
|
"OrderByClause",
|
||||||
"OrderFieldType",
|
|
||||||
"PaginationType",
|
"PaginationType",
|
||||||
"SearchConfig",
|
"SearchConfig",
|
||||||
"SearchFieldType",
|
"SearchFieldType",
|
||||||
"UnsupportedFacetTypeError",
|
|
||||||
]
|
]
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -6,28 +6,12 @@ from collections.abc import Sequence
|
|||||||
from dataclasses import dataclass, replace
|
from dataclasses import dataclass, replace
|
||||||
from typing import TYPE_CHECKING, Any, Literal
|
from typing import TYPE_CHECKING, Any, Literal
|
||||||
|
|
||||||
from sqlalchemy import String, and_, func, or_, select
|
from sqlalchemy import String, and_, or_, select
|
||||||
from sqlalchemy.ext.asyncio import AsyncSession
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
from sqlalchemy.orm import DeclarativeBase
|
from sqlalchemy.orm import DeclarativeBase
|
||||||
from sqlalchemy.orm.attributes import InstrumentedAttribute
|
from sqlalchemy.orm.attributes import InstrumentedAttribute
|
||||||
from sqlalchemy.types import (
|
|
||||||
ARRAY,
|
|
||||||
Boolean,
|
|
||||||
Date,
|
|
||||||
DateTime,
|
|
||||||
Enum,
|
|
||||||
Integer,
|
|
||||||
Numeric,
|
|
||||||
Time,
|
|
||||||
Uuid,
|
|
||||||
)
|
|
||||||
|
|
||||||
from ..exceptions import (
|
from ..exceptions import InvalidFacetFilterError, NoSearchableFieldsError
|
||||||
InvalidFacetFilterError,
|
|
||||||
InvalidSearchColumnError,
|
|
||||||
NoSearchableFieldsError,
|
|
||||||
UnsupportedFacetTypeError,
|
|
||||||
)
|
|
||||||
from ..types import FacetFieldType, SearchFieldType
|
from ..types import FacetFieldType, SearchFieldType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -97,7 +81,6 @@ def build_search_filters(
|
|||||||
search: str | SearchConfig,
|
search: str | SearchConfig,
|
||||||
search_fields: Sequence[SearchFieldType] | None = None,
|
search_fields: Sequence[SearchFieldType] | None = None,
|
||||||
default_fields: Sequence[SearchFieldType] | None = None,
|
default_fields: Sequence[SearchFieldType] | None = None,
|
||||||
search_column: str | None = None,
|
|
||||||
) -> tuple[list["ColumnElement[bool]"], list[InstrumentedAttribute[Any]]]:
|
) -> tuple[list["ColumnElement[bool]"], list[InstrumentedAttribute[Any]]]:
|
||||||
"""Build SQLAlchemy filter conditions for search.
|
"""Build SQLAlchemy filter conditions for search.
|
||||||
|
|
||||||
@@ -106,8 +89,6 @@ def build_search_filters(
|
|||||||
search: Search string or SearchConfig
|
search: Search string or SearchConfig
|
||||||
search_fields: Fields specified per-call (takes priority)
|
search_fields: Fields specified per-call (takes priority)
|
||||||
default_fields: Default fields (from ClassVar)
|
default_fields: Default fields (from ClassVar)
|
||||||
search_column: Optional key to narrow search to a single field.
|
|
||||||
Must match one of the resolved search field keys.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Tuple of (filter_conditions, joins_needed)
|
Tuple of (filter_conditions, joins_needed)
|
||||||
@@ -134,14 +115,6 @@ def build_search_filters(
|
|||||||
if not fields:
|
if not fields:
|
||||||
raise NoSearchableFieldsError(model)
|
raise NoSearchableFieldsError(model)
|
||||||
|
|
||||||
# Narrow to a single column when search_column is specified
|
|
||||||
if search_column is not None:
|
|
||||||
keys = search_field_keys(fields)
|
|
||||||
index = {k: f for k, f in zip(keys, fields)}
|
|
||||||
if search_column not in index:
|
|
||||||
raise InvalidSearchColumnError(search_column, sorted(index))
|
|
||||||
fields = [index[search_column]]
|
|
||||||
|
|
||||||
query = config.query.strip()
|
query = config.query.strip()
|
||||||
filters: list[ColumnElement[bool]] = []
|
filters: list[ColumnElement[bool]] = []
|
||||||
joins: list[InstrumentedAttribute[Any]] = []
|
joins: list[InstrumentedAttribute[Any]] = []
|
||||||
@@ -176,11 +149,6 @@ def build_search_filters(
|
|||||||
return filters, joins
|
return filters, joins
|
||||||
|
|
||||||
|
|
||||||
def search_field_keys(fields: Sequence[SearchFieldType]) -> list[str]:
|
|
||||||
"""Return a human-readable key for each search field."""
|
|
||||||
return facet_keys(fields)
|
|
||||||
|
|
||||||
|
|
||||||
def facet_keys(facet_fields: Sequence[FacetFieldType]) -> list[str]:
|
def facet_keys(facet_fields: Sequence[FacetFieldType]) -> list[str]:
|
||||||
"""Return a key for each facet field.
|
"""Return a key for each facet field.
|
||||||
|
|
||||||
@@ -233,47 +201,23 @@ async def build_facets(
|
|||||||
rels = ()
|
rels = ()
|
||||||
column = field
|
column = field
|
||||||
|
|
||||||
col_type = column.property.columns[0].type
|
q = select(column).select_from(model).distinct()
|
||||||
is_array = isinstance(col_type, ARRAY)
|
|
||||||
|
|
||||||
if is_array:
|
# Apply base joins (already done on main query, but needed here independently)
|
||||||
unnested = func.unnest(column).label(column.key)
|
|
||||||
q = select(unnested).select_from(model).distinct()
|
|
||||||
else:
|
|
||||||
q = select(column).select_from(model).distinct()
|
|
||||||
|
|
||||||
# Apply base joins (deduplicated) — needed here independently
|
|
||||||
seen_joins: set[str] = set()
|
|
||||||
for rel in base_joins or []:
|
for rel in base_joins or []:
|
||||||
rel_key = str(rel)
|
q = q.outerjoin(rel)
|
||||||
if rel_key not in seen_joins:
|
|
||||||
seen_joins.add(rel_key)
|
|
||||||
q = q.outerjoin(rel)
|
|
||||||
|
|
||||||
# Add any extra joins required by this facet field that aren't already applied
|
# Add any extra joins required by this facet field that aren't already in base_joins
|
||||||
for rel in rels:
|
for rel in rels:
|
||||||
rel_key = str(rel)
|
if str(rel) not in existing_join_keys:
|
||||||
if rel_key not in existing_join_keys and rel_key not in seen_joins:
|
|
||||||
seen_joins.add(rel_key)
|
|
||||||
q = q.outerjoin(rel)
|
q = q.outerjoin(rel)
|
||||||
|
|
||||||
if base_filters:
|
if base_filters:
|
||||||
q = q.where(and_(*base_filters))
|
q = q.where(and_(*base_filters))
|
||||||
|
|
||||||
if is_array:
|
q = q.order_by(column)
|
||||||
q = q.order_by(unnested)
|
|
||||||
else:
|
|
||||||
q = q.order_by(column)
|
|
||||||
result = await session.execute(q)
|
result = await session.execute(q)
|
||||||
col_type = column.property.columns[0].type
|
values = [row[0] for row in result.all() if row[0] is not None]
|
||||||
enum_class = getattr(col_type, "enum_class", None)
|
|
||||||
values = [
|
|
||||||
row[0].name
|
|
||||||
if (enum_class is not None and isinstance(row[0], enum_class))
|
|
||||||
else row[0]
|
|
||||||
for row in result.all()
|
|
||||||
if row[0] is not None
|
|
||||||
]
|
|
||||||
return key, values
|
return key, values
|
||||||
|
|
||||||
pairs = await asyncio.gather(
|
pairs = await asyncio.gather(
|
||||||
@@ -282,22 +226,6 @@ async def build_facets(
|
|||||||
return dict(pairs)
|
return dict(pairs)
|
||||||
|
|
||||||
|
|
||||||
_EQUALITY_TYPES = (String, Integer, Numeric, Date, DateTime, Time, Enum, Uuid)
|
|
||||||
"""Column types that support equality / IN filtering in build_filter_by."""
|
|
||||||
|
|
||||||
|
|
||||||
def _coerce_bool(value: Any) -> bool:
|
|
||||||
"""Coerce a string value to a Python bool for Boolean column filtering."""
|
|
||||||
if isinstance(value, bool):
|
|
||||||
return value
|
|
||||||
if isinstance(value, str):
|
|
||||||
if value.lower() == "true":
|
|
||||||
return True
|
|
||||||
if value.lower() == "false":
|
|
||||||
return False
|
|
||||||
raise ValueError(f"Cannot coerce {value!r} to bool")
|
|
||||||
|
|
||||||
|
|
||||||
def build_filter_by(
|
def build_filter_by(
|
||||||
filter_by: dict[str, Any],
|
filter_by: dict[str, Any],
|
||||||
facet_fields: Sequence[FacetFieldType],
|
facet_fields: Sequence[FacetFieldType],
|
||||||
@@ -343,42 +271,9 @@ def build_filter_by(
|
|||||||
joins.append(rel)
|
joins.append(rel)
|
||||||
added_join_keys.add(rel_key)
|
added_join_keys.add(rel_key)
|
||||||
|
|
||||||
col_type = column.property.columns[0].type
|
if isinstance(value, list):
|
||||||
if isinstance(col_type, Boolean):
|
filters.append(column.in_(value))
|
||||||
coerce = _coerce_bool
|
|
||||||
if isinstance(value, list):
|
|
||||||
filters.append(column.in_([coerce(v) for v in value]))
|
|
||||||
else:
|
|
||||||
filters.append(column == coerce(value))
|
|
||||||
elif isinstance(col_type, ARRAY):
|
|
||||||
if isinstance(value, list):
|
|
||||||
filters.append(column.overlap(value))
|
|
||||||
else:
|
|
||||||
filters.append(column.any(value))
|
|
||||||
elif isinstance(col_type, Enum):
|
|
||||||
enum_class = col_type.enum_class
|
|
||||||
if enum_class is not None:
|
|
||||||
|
|
||||||
def _coerce_enum(v: Any) -> Any:
|
|
||||||
if isinstance(v, enum_class):
|
|
||||||
return v
|
|
||||||
return enum_class[v] # lookup by name: "PENDING", "RED"
|
|
||||||
|
|
||||||
if isinstance(value, list):
|
|
||||||
filters.append(column.in_([_coerce_enum(v) for v in value]))
|
|
||||||
else:
|
|
||||||
filters.append(column == _coerce_enum(value))
|
|
||||||
else: # pragma: no cover
|
|
||||||
if isinstance(value, list):
|
|
||||||
filters.append(column.in_(value))
|
|
||||||
else:
|
|
||||||
filters.append(column == value)
|
|
||||||
elif isinstance(col_type, _EQUALITY_TYPES):
|
|
||||||
if isinstance(value, list):
|
|
||||||
filters.append(column.in_(value))
|
|
||||||
else:
|
|
||||||
filters.append(column == value)
|
|
||||||
else:
|
else:
|
||||||
raise UnsupportedFacetTypeError(key, type(col_type).__name__)
|
filters.append(column == value)
|
||||||
|
|
||||||
return filters, joins
|
return filters, joins
|
||||||
|
|||||||
@@ -7,11 +7,9 @@ from .exceptions import (
|
|||||||
ForbiddenError,
|
ForbiddenError,
|
||||||
InvalidFacetFilterError,
|
InvalidFacetFilterError,
|
||||||
InvalidOrderFieldError,
|
InvalidOrderFieldError,
|
||||||
InvalidSearchColumnError,
|
|
||||||
NoSearchableFieldsError,
|
NoSearchableFieldsError,
|
||||||
NotFoundError,
|
NotFoundError,
|
||||||
UnauthorizedError,
|
UnauthorizedError,
|
||||||
UnsupportedFacetTypeError,
|
|
||||||
generate_error_responses,
|
generate_error_responses,
|
||||||
)
|
)
|
||||||
from .handler import init_exceptions_handlers
|
from .handler import init_exceptions_handlers
|
||||||
@@ -25,9 +23,7 @@ __all__ = [
|
|||||||
"init_exceptions_handlers",
|
"init_exceptions_handlers",
|
||||||
"InvalidFacetFilterError",
|
"InvalidFacetFilterError",
|
||||||
"InvalidOrderFieldError",
|
"InvalidOrderFieldError",
|
||||||
"InvalidSearchColumnError",
|
|
||||||
"NoSearchableFieldsError",
|
"NoSearchableFieldsError",
|
||||||
"NotFoundError",
|
"NotFoundError",
|
||||||
"UnauthorizedError",
|
"UnauthorizedError",
|
||||||
"UnsupportedFacetTypeError",
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -144,61 +144,6 @@ class InvalidFacetFilterError(ApiException):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class UnsupportedFacetTypeError(ApiException):
|
|
||||||
"""Raised when a facet field has a column type not supported by filter_by."""
|
|
||||||
|
|
||||||
api_error = ApiError(
|
|
||||||
code=400,
|
|
||||||
msg="Unsupported Facet Type",
|
|
||||||
desc="The column type is not supported for facet filtering.",
|
|
||||||
err_code="FACET-TYPE-400",
|
|
||||||
)
|
|
||||||
|
|
||||||
def __init__(self, key: str, col_type: str) -> None:
|
|
||||||
"""Initialize the exception.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
key: The facet field key.
|
|
||||||
col_type: The unsupported column type name.
|
|
||||||
"""
|
|
||||||
self.key = key
|
|
||||||
self.col_type = col_type
|
|
||||||
super().__init__(
|
|
||||||
desc=(
|
|
||||||
f"Facet field '{key}' has unsupported column type '{col_type}'. "
|
|
||||||
f"Supported types: String, Integer, Numeric, Boolean, "
|
|
||||||
f"Date, DateTime, Time, Enum, Uuid, ARRAY."
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidSearchColumnError(ApiException):
|
|
||||||
"""Raised when search_column is not one of the configured searchable fields."""
|
|
||||||
|
|
||||||
api_error = ApiError(
|
|
||||||
code=400,
|
|
||||||
msg="Invalid Search Column",
|
|
||||||
desc="The requested search column is not a configured searchable field.",
|
|
||||||
err_code="SEARCH-COL-400",
|
|
||||||
)
|
|
||||||
|
|
||||||
def __init__(self, column: str, valid_columns: list[str]) -> None:
|
|
||||||
"""Initialize the exception.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
column: The unknown search column provided by the caller.
|
|
||||||
valid_columns: List of valid search column keys.
|
|
||||||
"""
|
|
||||||
self.column = column
|
|
||||||
self.valid_columns = valid_columns
|
|
||||||
super().__init__(
|
|
||||||
desc=(
|
|
||||||
f"'{column}' is not a searchable column. "
|
|
||||||
f"Valid columns: {valid_columns}."
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidOrderFieldError(ApiException):
|
class InvalidOrderFieldError(ApiException):
|
||||||
"""Raised when order_by contains a field not in the allowed order fields."""
|
"""Raised when order_by contains a field not in the allowed order fields."""
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ def _format_validation_error(
|
|||||||
)
|
)
|
||||||
|
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
status_code=status.HTTP_422_UNPROCESSABLE_CONTENT,
|
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||||
content=error_response.model_dump(),
|
content=error_response.model_dump(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"""Prometheus metrics endpoint for FastAPI applications."""
|
"""Prometheus metrics endpoint for FastAPI applications."""
|
||||||
|
|
||||||
import inspect
|
import asyncio
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
@@ -55,10 +55,10 @@ def init_metrics(
|
|||||||
|
|
||||||
# Partition collectors and cache env check at startup — both are stable for the app lifetime.
|
# Partition collectors and cache env check at startup — both are stable for the app lifetime.
|
||||||
async_collectors = [
|
async_collectors = [
|
||||||
c for c in registry.get_collectors() if inspect.iscoroutinefunction(c.func)
|
c for c in registry.get_collectors() if asyncio.iscoroutinefunction(c.func)
|
||||||
]
|
]
|
||||||
sync_collectors = [
|
sync_collectors = [
|
||||||
c for c in registry.get_collectors() if not inspect.iscoroutinefunction(c.func)
|
c for c in registry.get_collectors() if not asyncio.iscoroutinefunction(c.func)
|
||||||
]
|
]
|
||||||
multiprocess_mode = _is_multiprocess()
|
multiprocess_mode = _is_multiprocess()
|
||||||
|
|
||||||
|
|||||||
@@ -231,13 +231,6 @@ class EventSession(AsyncSession):
|
|||||||
k: v for k, v in field_changes.items() if k not in transient_ids
|
k: v for k, v in field_changes.items() if k not in transient_ids
|
||||||
}
|
}
|
||||||
|
|
||||||
# Suppress updates for deleted objects (row is gone, refresh would fail).
|
|
||||||
if deletes and field_changes:
|
|
||||||
deleted_ids = {id(o) for o, _ in deletes}
|
|
||||||
field_changes = {
|
|
||||||
k: v for k, v in field_changes.items() if k not in deleted_ids
|
|
||||||
}
|
|
||||||
|
|
||||||
# Suppress updates for newly created objects (CREATE-only semantics).
|
# Suppress updates for newly created objects (CREATE-only semantics).
|
||||||
if creates and field_changes:
|
if creates and field_changes:
|
||||||
create_ids = {id(o) for o in creates}
|
create_ids = {id(o) for o in creates}
|
||||||
|
|||||||
@@ -162,8 +162,6 @@ class PaginatedResponse(BaseResponse, Generic[DataT]):
|
|||||||
pagination: OffsetPagination | CursorPagination
|
pagination: OffsetPagination | CursorPagination
|
||||||
pagination_type: PaginationType | None = None
|
pagination_type: PaginationType | None = None
|
||||||
filter_attributes: dict[str, list[Any]] | None = None
|
filter_attributes: dict[str, list[Any]] | None = None
|
||||||
search_columns: list[str] | None = None
|
|
||||||
order_columns: list[str] | None = None
|
|
||||||
|
|
||||||
_discriminated_union_cache: ClassVar[dict[Any, Any]] = {}
|
_discriminated_union_cache: ClassVar[dict[Any, Any]] = {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
"""Authentication helpers for FastAPI using Security()."""
|
|
||||||
|
|
||||||
from .abc import AuthSource
|
|
||||||
from .oauth import (
|
|
||||||
oauth_build_authorization_redirect,
|
|
||||||
oauth_decode_state,
|
|
||||||
oauth_encode_state,
|
|
||||||
oauth_fetch_userinfo,
|
|
||||||
oauth_resolve_provider_urls,
|
|
||||||
)
|
|
||||||
from .sources import APIKeyHeaderAuth, BearerTokenAuth, CookieAuth, MultiAuth
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"APIKeyHeaderAuth",
|
|
||||||
"AuthSource",
|
|
||||||
"BearerTokenAuth",
|
|
||||||
"CookieAuth",
|
|
||||||
"MultiAuth",
|
|
||||||
"oauth_build_authorization_redirect",
|
|
||||||
"oauth_decode_state",
|
|
||||||
"oauth_encode_state",
|
|
||||||
"oauth_fetch_userinfo",
|
|
||||||
"oauth_resolve_provider_urls",
|
|
||||||
]
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
"""Abstract base class for authentication sources."""
|
|
||||||
|
|
||||||
import inspect
|
|
||||||
from abc import ABC, abstractmethod
|
|
||||||
from typing import Any, Callable
|
|
||||||
|
|
||||||
from fastapi import Request
|
|
||||||
from fastapi.security import SecurityScopes
|
|
||||||
|
|
||||||
from fastapi_toolsets.exceptions import UnauthorizedError
|
|
||||||
|
|
||||||
|
|
||||||
def _ensure_async(fn: Callable[..., Any]) -> Callable[..., Any]:
|
|
||||||
"""Wrap *fn* so it can always be awaited, caching the coroutine check at init time."""
|
|
||||||
if inspect.iscoroutinefunction(fn):
|
|
||||||
return fn
|
|
||||||
|
|
||||||
async def wrapper(*args: Any, **kwargs: Any) -> Any:
|
|
||||||
return fn(*args, **kwargs)
|
|
||||||
|
|
||||||
return wrapper
|
|
||||||
|
|
||||||
|
|
||||||
class AuthSource(ABC):
|
|
||||||
"""Abstract base class for authentication sources."""
|
|
||||||
|
|
||||||
def __init__(self) -> None:
|
|
||||||
"""Set up the default FastAPI dependency signature."""
|
|
||||||
source = self
|
|
||||||
|
|
||||||
async def _call(
|
|
||||||
request: Request,
|
|
||||||
security_scopes: SecurityScopes, # noqa: ARG001
|
|
||||||
) -> Any:
|
|
||||||
credential = await source.extract(request)
|
|
||||||
if credential is None:
|
|
||||||
raise UnauthorizedError()
|
|
||||||
return await source.authenticate(credential)
|
|
||||||
|
|
||||||
self._call_fn: Callable[..., Any] = _call
|
|
||||||
self.__signature__ = inspect.signature(_call)
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
async def extract(self, request: Request) -> str | None:
|
|
||||||
"""Extract the raw credential from the request without validating."""
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
async def authenticate(self, credential: str) -> Any:
|
|
||||||
"""Validate a credential and return the authenticated identity."""
|
|
||||||
|
|
||||||
async def __call__(self, **kwargs: Any) -> Any:
|
|
||||||
"""FastAPI dependency dispatch."""
|
|
||||||
return await self._call_fn(**kwargs)
|
|
||||||
@@ -1,140 +0,0 @@
|
|||||||
"""OAuth 2.0 / OIDC helper utilities."""
|
|
||||||
|
|
||||||
import base64
|
|
||||||
from typing import Any
|
|
||||||
from urllib.parse import urlencode
|
|
||||||
|
|
||||||
import httpx
|
|
||||||
from fastapi.responses import RedirectResponse
|
|
||||||
|
|
||||||
_discovery_cache: dict[str, dict] = {}
|
|
||||||
|
|
||||||
|
|
||||||
async def oauth_resolve_provider_urls(
|
|
||||||
discovery_url: str,
|
|
||||||
) -> tuple[str, str, str | None]:
|
|
||||||
"""Fetch the OIDC discovery document and return endpoint URLs.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
discovery_url: URL of the provider's ``/.well-known/openid-configuration``.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
A ``(authorization_url, token_url, userinfo_url)`` tuple.
|
|
||||||
*userinfo_url* is ``None`` when the provider does not advertise one.
|
|
||||||
"""
|
|
||||||
if discovery_url not in _discovery_cache:
|
|
||||||
async with httpx.AsyncClient() as client:
|
|
||||||
resp = await client.get(discovery_url)
|
|
||||||
resp.raise_for_status()
|
|
||||||
_discovery_cache[discovery_url] = resp.json()
|
|
||||||
cfg = _discovery_cache[discovery_url]
|
|
||||||
return (
|
|
||||||
cfg["authorization_endpoint"],
|
|
||||||
cfg["token_endpoint"],
|
|
||||||
cfg.get("userinfo_endpoint"),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def oauth_fetch_userinfo(
|
|
||||||
*,
|
|
||||||
token_url: str,
|
|
||||||
userinfo_url: str,
|
|
||||||
code: str,
|
|
||||||
client_id: str,
|
|
||||||
client_secret: str,
|
|
||||||
redirect_uri: str,
|
|
||||||
) -> dict[str, Any]:
|
|
||||||
"""Exchange an authorization code for tokens and return the userinfo payload.
|
|
||||||
|
|
||||||
Performs the two-step OAuth 2.0 / OIDC token exchange:
|
|
||||||
|
|
||||||
1. POSTs the authorization *code* to *token_url* to obtain an access token.
|
|
||||||
2. GETs *userinfo_url* using that access token as a Bearer credential.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
token_url: Provider's token endpoint.
|
|
||||||
userinfo_url: Provider's userinfo endpoint.
|
|
||||||
code: Authorization code received from the provider's callback.
|
|
||||||
client_id: OAuth application client ID.
|
|
||||||
client_secret: OAuth application client secret.
|
|
||||||
redirect_uri: Redirect URI that was used in the authorization request.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
The JSON payload returned by the userinfo endpoint as a plain ``dict``.
|
|
||||||
"""
|
|
||||||
async with httpx.AsyncClient() as client:
|
|
||||||
token_resp = await client.post(
|
|
||||||
token_url,
|
|
||||||
data={
|
|
||||||
"grant_type": "authorization_code",
|
|
||||||
"code": code,
|
|
||||||
"client_id": client_id,
|
|
||||||
"client_secret": client_secret,
|
|
||||||
"redirect_uri": redirect_uri,
|
|
||||||
},
|
|
||||||
headers={"Accept": "application/json"},
|
|
||||||
)
|
|
||||||
token_resp.raise_for_status()
|
|
||||||
access_token = token_resp.json()["access_token"]
|
|
||||||
|
|
||||||
userinfo_resp = await client.get(
|
|
||||||
userinfo_url,
|
|
||||||
headers={"Authorization": f"Bearer {access_token}"},
|
|
||||||
)
|
|
||||||
userinfo_resp.raise_for_status()
|
|
||||||
return userinfo_resp.json()
|
|
||||||
|
|
||||||
|
|
||||||
def oauth_build_authorization_redirect(
|
|
||||||
authorization_url: str,
|
|
||||||
*,
|
|
||||||
client_id: str,
|
|
||||||
scopes: str,
|
|
||||||
redirect_uri: str,
|
|
||||||
destination: str,
|
|
||||||
) -> RedirectResponse:
|
|
||||||
"""Return an OAuth 2.0 authorization ``RedirectResponse``.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
authorization_url: Provider's authorization endpoint.
|
|
||||||
client_id: OAuth application client ID.
|
|
||||||
scopes: Space-separated list of requested scopes.
|
|
||||||
redirect_uri: URI the provider should redirect back to after authorization.
|
|
||||||
destination: URL the user should be sent to after the full OAuth flow
|
|
||||||
completes (encoded as ``state``).
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
A :class:`~fastapi.responses.RedirectResponse` to the provider's
|
|
||||||
authorization page.
|
|
||||||
"""
|
|
||||||
params = urlencode(
|
|
||||||
{
|
|
||||||
"client_id": client_id,
|
|
||||||
"response_type": "code",
|
|
||||||
"scope": scopes,
|
|
||||||
"redirect_uri": redirect_uri,
|
|
||||||
"state": oauth_encode_state(destination),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
return RedirectResponse(f"{authorization_url}?{params}")
|
|
||||||
|
|
||||||
|
|
||||||
def oauth_encode_state(url: str) -> str:
|
|
||||||
"""Base64url-encode a URL to embed as an OAuth ``state`` parameter."""
|
|
||||||
return base64.urlsafe_b64encode(url.encode()).decode()
|
|
||||||
|
|
||||||
|
|
||||||
def oauth_decode_state(state: str | None, *, fallback: str) -> str:
|
|
||||||
"""Decode a base64url OAuth ``state`` parameter.
|
|
||||||
|
|
||||||
Handles missing padding (some providers strip ``=``).
|
|
||||||
Returns *fallback* if *state* is absent, the literal string ``"null"``,
|
|
||||||
or cannot be decoded.
|
|
||||||
"""
|
|
||||||
if not state or state == "null":
|
|
||||||
return fallback
|
|
||||||
try:
|
|
||||||
padded = state + "=" * (4 - len(state) % 4)
|
|
||||||
return base64.urlsafe_b64decode(padded).decode()
|
|
||||||
except Exception:
|
|
||||||
return fallback
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
"""Built-in authentication source implementations."""
|
|
||||||
|
|
||||||
from .header import APIKeyHeaderAuth
|
|
||||||
from .bearer import BearerTokenAuth
|
|
||||||
from .cookie import CookieAuth
|
|
||||||
from .multi import MultiAuth
|
|
||||||
|
|
||||||
__all__ = ["APIKeyHeaderAuth", "BearerTokenAuth", "CookieAuth", "MultiAuth"]
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
"""Bearer token authentication source."""
|
|
||||||
|
|
||||||
import inspect
|
|
||||||
import secrets
|
|
||||||
from typing import Annotated, Any, Callable
|
|
||||||
|
|
||||||
from fastapi import Depends
|
|
||||||
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer, SecurityScopes
|
|
||||||
|
|
||||||
from fastapi_toolsets.exceptions import UnauthorizedError
|
|
||||||
|
|
||||||
from ..abc import AuthSource, _ensure_async
|
|
||||||
|
|
||||||
|
|
||||||
class BearerTokenAuth(AuthSource):
|
|
||||||
"""Bearer token authentication source.
|
|
||||||
|
|
||||||
Wraps :class:`fastapi.security.HTTPBearer` for OpenAPI documentation.
|
|
||||||
The validator is called as ``await validator(credential, **kwargs)``
|
|
||||||
where ``kwargs`` are the extra keyword arguments provided at instantiation.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
validator: Sync or async callable that receives the credential and any
|
|
||||||
extra keyword arguments, and returns the authenticated identity
|
|
||||||
(e.g. a ``User`` model). Should raise
|
|
||||||
:class:`~fastapi_toolsets.exceptions.UnauthorizedError` on failure.
|
|
||||||
prefix: Optional token prefix (e.g. ``"user_"``). If set, only tokens
|
|
||||||
whose value starts with this prefix are matched. The prefix is
|
|
||||||
**kept** in the value passed to the validator — store and compare
|
|
||||||
tokens with their prefix included. Use :meth:`generate_token` to
|
|
||||||
create correctly-prefixed tokens. This enables multiple
|
|
||||||
``BearerTokenAuth`` instances in the same app (e.g. ``"user_"``
|
|
||||||
for user tokens, ``"org_"`` for org tokens).
|
|
||||||
**kwargs: Extra keyword arguments forwarded to the validator on every
|
|
||||||
call (e.g. ``role=Role.ADMIN``).
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
validator: Callable[..., Any],
|
|
||||||
*,
|
|
||||||
prefix: str | None = None,
|
|
||||||
**kwargs: Any,
|
|
||||||
) -> None:
|
|
||||||
self._validator = _ensure_async(validator)
|
|
||||||
self._prefix = prefix
|
|
||||||
self._kwargs = kwargs
|
|
||||||
self._scheme = HTTPBearer(auto_error=False)
|
|
||||||
|
|
||||||
async def _call(
|
|
||||||
security_scopes: SecurityScopes, # noqa: ARG001
|
|
||||||
credentials: Annotated[
|
|
||||||
HTTPAuthorizationCredentials | None, Depends(self._scheme)
|
|
||||||
] = None,
|
|
||||||
) -> Any:
|
|
||||||
if credentials is None:
|
|
||||||
raise UnauthorizedError()
|
|
||||||
return await self._validate(credentials.credentials)
|
|
||||||
|
|
||||||
self._call_fn = _call
|
|
||||||
self.__signature__ = inspect.signature(_call)
|
|
||||||
|
|
||||||
async def _validate(self, token: str) -> Any:
|
|
||||||
"""Check prefix and call the validator."""
|
|
||||||
if self._prefix is not None and not token.startswith(self._prefix):
|
|
||||||
raise UnauthorizedError()
|
|
||||||
return await self._validator(token, **self._kwargs)
|
|
||||||
|
|
||||||
async def extract(self, request: Any) -> str | None:
|
|
||||||
"""Extract the raw credential from the request without validating.
|
|
||||||
|
|
||||||
Returns ``None`` if no ``Authorization: Bearer`` header is present,
|
|
||||||
the token is empty, or the token does not match the configured prefix.
|
|
||||||
The prefix is included in the returned value.
|
|
||||||
"""
|
|
||||||
auth = request.headers.get("Authorization", "")
|
|
||||||
if not auth.startswith("Bearer "):
|
|
||||||
return None
|
|
||||||
token = auth[7:]
|
|
||||||
if not token:
|
|
||||||
return None
|
|
||||||
if self._prefix is not None and not token.startswith(self._prefix):
|
|
||||||
return None
|
|
||||||
return token
|
|
||||||
|
|
||||||
async def authenticate(self, credential: str) -> Any:
|
|
||||||
"""Validate a credential and return the identity.
|
|
||||||
|
|
||||||
Calls ``await validator(credential, **kwargs)`` where ``kwargs`` are
|
|
||||||
the extra keyword arguments provided at instantiation.
|
|
||||||
"""
|
|
||||||
return await self._validate(credential)
|
|
||||||
|
|
||||||
def require(self, **kwargs: Any) -> "BearerTokenAuth":
|
|
||||||
"""Return a new instance with additional (or overriding) validator kwargs."""
|
|
||||||
return BearerTokenAuth(
|
|
||||||
self._validator,
|
|
||||||
prefix=self._prefix,
|
|
||||||
**{**self._kwargs, **kwargs},
|
|
||||||
)
|
|
||||||
|
|
||||||
def generate_token(self, nbytes: int = 32) -> str:
|
|
||||||
"""Generate a secure random token for this auth source.
|
|
||||||
|
|
||||||
Returns a URL-safe random token. If a prefix is configured it is
|
|
||||||
prepended — the returned value is what you store in your database
|
|
||||||
and return to the client as-is.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
nbytes: Number of random bytes before base64 encoding. The
|
|
||||||
resulting string is ``ceil(nbytes * 4 / 3)`` characters
|
|
||||||
(43 chars for the default 32 bytes). Defaults to 32.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
A ready-to-use token string (e.g. ``"user_Xk3..."``).
|
|
||||||
"""
|
|
||||||
token = secrets.token_urlsafe(nbytes)
|
|
||||||
if self._prefix is not None:
|
|
||||||
return f"{self._prefix}{token}"
|
|
||||||
return token
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
"""Cookie-based authentication source."""
|
|
||||||
|
|
||||||
import base64
|
|
||||||
import hashlib
|
|
||||||
import hmac
|
|
||||||
import inspect
|
|
||||||
import json
|
|
||||||
import time
|
|
||||||
from typing import Annotated, Any, Callable
|
|
||||||
|
|
||||||
from fastapi import Depends, Request, Response
|
|
||||||
from fastapi.security import APIKeyCookie, SecurityScopes
|
|
||||||
|
|
||||||
from fastapi_toolsets.exceptions import UnauthorizedError
|
|
||||||
|
|
||||||
from ..abc import AuthSource, _ensure_async
|
|
||||||
|
|
||||||
|
|
||||||
class CookieAuth(AuthSource):
|
|
||||||
"""Cookie-based authentication source.
|
|
||||||
|
|
||||||
Wraps :class:`fastapi.security.APIKeyCookie` for OpenAPI documentation.
|
|
||||||
Optionally signs the cookie with HMAC-SHA256 to provide stateless, tamper-
|
|
||||||
proof sessions without any database entry.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
name: Cookie name.
|
|
||||||
validator: Sync or async callable that receives the cookie value
|
|
||||||
(plain, after signature verification when ``secret_key`` is set)
|
|
||||||
and any extra keyword arguments, and returns the authenticated
|
|
||||||
identity.
|
|
||||||
secret_key: When provided, the cookie is HMAC-SHA256 signed.
|
|
||||||
:meth:`set_cookie` embeds an expiry and signs the payload;
|
|
||||||
:meth:`extract` verifies the signature and expiry before handing
|
|
||||||
the plain value to the validator. When ``None`` (default), the raw
|
|
||||||
cookie value is passed to the validator as-is.
|
|
||||||
ttl: Cookie lifetime in seconds (default 24 h). Only used when
|
|
||||||
``secret_key`` is set.
|
|
||||||
**kwargs: Extra keyword arguments forwarded to the validator on every
|
|
||||||
call (e.g. ``role=Role.ADMIN``).
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
name: str,
|
|
||||||
validator: Callable[..., Any],
|
|
||||||
*,
|
|
||||||
secret_key: str | None = None,
|
|
||||||
ttl: int = 86400,
|
|
||||||
**kwargs: Any,
|
|
||||||
) -> None:
|
|
||||||
self._name = name
|
|
||||||
self._validator = _ensure_async(validator)
|
|
||||||
self._secret_key = secret_key
|
|
||||||
self._ttl = ttl
|
|
||||||
self._kwargs = kwargs
|
|
||||||
self._scheme = APIKeyCookie(name=name, auto_error=False)
|
|
||||||
|
|
||||||
async def _call(
|
|
||||||
security_scopes: SecurityScopes, # noqa: ARG001
|
|
||||||
value: Annotated[str | None, Depends(self._scheme)] = None,
|
|
||||||
) -> Any:
|
|
||||||
if value is None:
|
|
||||||
raise UnauthorizedError()
|
|
||||||
plain = self._verify(value)
|
|
||||||
return await self._validator(plain, **self._kwargs)
|
|
||||||
|
|
||||||
self._call_fn = _call
|
|
||||||
self.__signature__ = inspect.signature(_call)
|
|
||||||
|
|
||||||
def _hmac(self, data: str) -> str:
|
|
||||||
if self._secret_key is None:
|
|
||||||
raise RuntimeError("_hmac called without secret_key configured")
|
|
||||||
return hmac.new(
|
|
||||||
self._secret_key.encode(), data.encode(), hashlib.sha256
|
|
||||||
).hexdigest()
|
|
||||||
|
|
||||||
def _sign(self, value: str) -> str:
|
|
||||||
data = base64.urlsafe_b64encode(
|
|
||||||
json.dumps({"v": value, "exp": int(time.time()) + self._ttl}).encode()
|
|
||||||
).decode()
|
|
||||||
return f"{data}.{self._hmac(data)}"
|
|
||||||
|
|
||||||
def _verify(self, cookie_value: str) -> str:
|
|
||||||
"""Return the plain value, verifying HMAC + expiry when signed."""
|
|
||||||
if not self._secret_key:
|
|
||||||
return cookie_value
|
|
||||||
|
|
||||||
try:
|
|
||||||
data, sig = cookie_value.rsplit(".", 1)
|
|
||||||
except ValueError:
|
|
||||||
raise UnauthorizedError()
|
|
||||||
|
|
||||||
if not hmac.compare_digest(self._hmac(data), sig):
|
|
||||||
raise UnauthorizedError()
|
|
||||||
|
|
||||||
try:
|
|
||||||
payload = json.loads(base64.urlsafe_b64decode(data))
|
|
||||||
value: str = payload["v"]
|
|
||||||
exp: int = payload["exp"]
|
|
||||||
except Exception:
|
|
||||||
raise UnauthorizedError()
|
|
||||||
|
|
||||||
if exp < int(time.time()):
|
|
||||||
raise UnauthorizedError()
|
|
||||||
|
|
||||||
return value
|
|
||||||
|
|
||||||
async def extract(self, request: Request) -> str | None:
|
|
||||||
return request.cookies.get(self._name)
|
|
||||||
|
|
||||||
async def authenticate(self, credential: str) -> Any:
|
|
||||||
plain = self._verify(credential)
|
|
||||||
return await self._validator(plain, **self._kwargs)
|
|
||||||
|
|
||||||
def require(self, **kwargs: Any) -> "CookieAuth":
|
|
||||||
"""Return a new instance with additional (or overriding) validator kwargs."""
|
|
||||||
return CookieAuth(
|
|
||||||
self._name,
|
|
||||||
self._validator,
|
|
||||||
secret_key=self._secret_key,
|
|
||||||
ttl=self._ttl,
|
|
||||||
**{**self._kwargs, **kwargs},
|
|
||||||
)
|
|
||||||
|
|
||||||
def set_cookie(self, response: Response, value: str) -> None:
|
|
||||||
"""Attach the cookie to *response*, signing it when ``secret_key`` is set."""
|
|
||||||
cookie_value = self._sign(value) if self._secret_key else value
|
|
||||||
response.set_cookie(
|
|
||||||
self._name,
|
|
||||||
cookie_value,
|
|
||||||
httponly=True,
|
|
||||||
samesite="lax",
|
|
||||||
max_age=self._ttl,
|
|
||||||
)
|
|
||||||
|
|
||||||
def delete_cookie(self, response: Response) -> None:
|
|
||||||
"""Clear the session cookie (logout)."""
|
|
||||||
response.delete_cookie(self._name, httponly=True, samesite="lax")
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
"""API key header authentication source."""
|
|
||||||
|
|
||||||
import inspect
|
|
||||||
from typing import Annotated, Any, Callable
|
|
||||||
|
|
||||||
from fastapi import Depends, Request
|
|
||||||
from fastapi.security import APIKeyHeader, SecurityScopes
|
|
||||||
|
|
||||||
from fastapi_toolsets.exceptions import UnauthorizedError
|
|
||||||
|
|
||||||
from ..abc import AuthSource, _ensure_async
|
|
||||||
|
|
||||||
|
|
||||||
class APIKeyHeaderAuth(AuthSource):
|
|
||||||
"""API key header authentication source.
|
|
||||||
|
|
||||||
Wraps :class:`fastapi.security.APIKeyHeader` for OpenAPI documentation.
|
|
||||||
The validator is called as ``await validator(api_key, **kwargs)``
|
|
||||||
where ``kwargs`` are the extra keyword arguments provided at instantiation.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
name: HTTP header name that carries the API key (e.g. ``"X-API-Key"``).
|
|
||||||
validator: Sync or async callable that receives the API key and any
|
|
||||||
extra keyword arguments, and returns the authenticated identity.
|
|
||||||
Should raise :class:`~fastapi_toolsets.exceptions.UnauthorizedError`
|
|
||||||
on failure.
|
|
||||||
**kwargs: Extra keyword arguments forwarded to the validator on every
|
|
||||||
call (e.g. ``role=Role.ADMIN``).
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
name: str,
|
|
||||||
validator: Callable[..., Any],
|
|
||||||
**kwargs: Any,
|
|
||||||
) -> None:
|
|
||||||
self._name = name
|
|
||||||
self._validator = _ensure_async(validator)
|
|
||||||
self._kwargs = kwargs
|
|
||||||
self._scheme = APIKeyHeader(name=name, auto_error=False)
|
|
||||||
|
|
||||||
async def _call(
|
|
||||||
security_scopes: SecurityScopes, # noqa: ARG001
|
|
||||||
api_key: Annotated[str | None, Depends(self._scheme)] = None,
|
|
||||||
) -> Any:
|
|
||||||
if api_key is None:
|
|
||||||
raise UnauthorizedError()
|
|
||||||
return await self._validator(api_key, **self._kwargs)
|
|
||||||
|
|
||||||
self._call_fn = _call
|
|
||||||
self.__signature__ = inspect.signature(_call)
|
|
||||||
|
|
||||||
async def extract(self, request: Request) -> str | None:
|
|
||||||
"""Extract the API key from the configured header."""
|
|
||||||
return request.headers.get(self._name) or None
|
|
||||||
|
|
||||||
async def authenticate(self, credential: str) -> Any:
|
|
||||||
"""Validate a credential and return the identity."""
|
|
||||||
return await self._validator(credential, **self._kwargs)
|
|
||||||
|
|
||||||
def require(self, **kwargs: Any) -> "APIKeyHeaderAuth":
|
|
||||||
"""Return a new instance with additional (or overriding) validator kwargs."""
|
|
||||||
return APIKeyHeaderAuth(
|
|
||||||
self._name,
|
|
||||||
self._validator,
|
|
||||||
**{**self._kwargs, **kwargs},
|
|
||||||
)
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
"""MultiAuth: combine multiple authentication sources into a single callable."""
|
|
||||||
|
|
||||||
import inspect
|
|
||||||
from typing import Any, cast
|
|
||||||
|
|
||||||
from fastapi import Request
|
|
||||||
from fastapi.security import SecurityScopes
|
|
||||||
|
|
||||||
from fastapi_toolsets.exceptions import UnauthorizedError
|
|
||||||
|
|
||||||
from ..abc import AuthSource
|
|
||||||
|
|
||||||
|
|
||||||
class MultiAuth:
|
|
||||||
"""Combine multiple authentication sources into a single callable.
|
|
||||||
|
|
||||||
Sources are tried in order; the first one whose
|
|
||||||
:meth:`~AuthSource.extract` returns a non-``None`` credential wins.
|
|
||||||
Its :meth:`~AuthSource.authenticate` is called and the result returned.
|
|
||||||
|
|
||||||
If a credential is found but the validator raises, the exception propagates
|
|
||||||
immediately — the remaining sources are **not** tried. This prevents
|
|
||||||
silent fallthrough on invalid credentials.
|
|
||||||
|
|
||||||
If no source provides a credential,
|
|
||||||
:class:`~fastapi_toolsets.exceptions.UnauthorizedError` is raised.
|
|
||||||
|
|
||||||
The :meth:`~AuthSource.extract` method of each source performs only
|
|
||||||
string matching (no I/O), so prefix-based dispatch is essentially free.
|
|
||||||
|
|
||||||
Any :class:`~AuthSource` subclass — including user-defined ones — can be
|
|
||||||
passed as a source.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
*sources: Auth source instances to try in order.
|
|
||||||
|
|
||||||
Example::
|
|
||||||
|
|
||||||
user_bearer = BearerTokenAuth(verify_user, prefix="user_")
|
|
||||||
org_bearer = BearerTokenAuth(verify_org, prefix="org_")
|
|
||||||
cookie = CookieAuth("session", verify_session)
|
|
||||||
|
|
||||||
multi = MultiAuth(user_bearer, org_bearer, cookie)
|
|
||||||
|
|
||||||
@app.get("/data")
|
|
||||||
async def data_route(user = Security(multi)):
|
|
||||||
return user
|
|
||||||
|
|
||||||
# Apply a shared requirement to all sources at once
|
|
||||||
@app.get("/admin")
|
|
||||||
async def admin_route(user = Security(multi.require(role=Role.ADMIN))):
|
|
||||||
return user
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, *sources: AuthSource) -> None:
|
|
||||||
self._sources = sources
|
|
||||||
|
|
||||||
async def _call(
|
|
||||||
request: Request,
|
|
||||||
security_scopes: SecurityScopes, # noqa: ARG001
|
|
||||||
**kwargs: Any, # noqa: ARG001 — absorbs scheme values injected by FastAPI
|
|
||||||
) -> Any:
|
|
||||||
for source in self._sources:
|
|
||||||
credential = await source.extract(request)
|
|
||||||
if credential is not None:
|
|
||||||
return await source.authenticate(credential)
|
|
||||||
raise UnauthorizedError()
|
|
||||||
|
|
||||||
self._call_fn = _call
|
|
||||||
|
|
||||||
# Build a merged signature that includes the security-scheme Depends()
|
|
||||||
# parameters from every source so FastAPI registers them in OpenAPI docs.
|
|
||||||
seen: set[str] = {"request", "security_scopes"}
|
|
||||||
merged: list[inspect.Parameter] = [
|
|
||||||
inspect.Parameter(
|
|
||||||
"request",
|
|
||||||
inspect.Parameter.POSITIONAL_OR_KEYWORD,
|
|
||||||
annotation=Request,
|
|
||||||
),
|
|
||||||
inspect.Parameter(
|
|
||||||
"security_scopes",
|
|
||||||
inspect.Parameter.POSITIONAL_OR_KEYWORD,
|
|
||||||
annotation=SecurityScopes,
|
|
||||||
),
|
|
||||||
]
|
|
||||||
for i, source in enumerate(sources):
|
|
||||||
for name, param in inspect.signature(source).parameters.items():
|
|
||||||
if name in seen:
|
|
||||||
continue
|
|
||||||
merged.append(param.replace(name=f"_s{i}_{name}"))
|
|
||||||
seen.add(name)
|
|
||||||
self.__signature__ = inspect.Signature(merged, return_annotation=Any)
|
|
||||||
|
|
||||||
async def __call__(self, **kwargs: Any) -> Any:
|
|
||||||
return await self._call_fn(**kwargs)
|
|
||||||
|
|
||||||
def require(self, **kwargs: Any) -> "MultiAuth":
|
|
||||||
"""Return a new :class:`MultiAuth` with kwargs forwarded to each source.
|
|
||||||
|
|
||||||
Calls ``.require(**kwargs)`` on every source that supports it. Sources
|
|
||||||
that do not implement ``.require()`` (e.g. custom :class:`~AuthSource`
|
|
||||||
subclasses) are passed through unchanged.
|
|
||||||
|
|
||||||
New kwargs are merged over each source's existing kwargs — new values
|
|
||||||
win on conflict::
|
|
||||||
|
|
||||||
multi = MultiAuth(bearer, cookie)
|
|
||||||
|
|
||||||
@app.get("/admin")
|
|
||||||
async def admin(user = Security(multi.require(role=Role.ADMIN))):
|
|
||||||
return user
|
|
||||||
"""
|
|
||||||
new_sources = tuple(
|
|
||||||
cast(Any, source).require(**kwargs)
|
|
||||||
if hasattr(source, "require")
|
|
||||||
else source
|
|
||||||
for source in self._sources
|
|
||||||
)
|
|
||||||
return MultiAuth(*new_sources)
|
|
||||||
@@ -15,15 +15,13 @@ ModelType = TypeVar("ModelType", bound=DeclarativeBase)
|
|||||||
SchemaType = TypeVar("SchemaType", bound=BaseModel)
|
SchemaType = TypeVar("SchemaType", bound=BaseModel)
|
||||||
|
|
||||||
# CRUD type aliases
|
# CRUD type aliases
|
||||||
JoinType = list[tuple[type[DeclarativeBase] | Any, Any]]
|
JoinType = list[tuple[type[DeclarativeBase], Any]]
|
||||||
LateralJoinType = list[tuple[Any, Any]]
|
|
||||||
M2MFieldType = Mapping[str, QueryableAttribute[Any]]
|
M2MFieldType = Mapping[str, QueryableAttribute[Any]]
|
||||||
OrderByClause = ColumnElement[Any] | QueryableAttribute[Any]
|
OrderByClause = ColumnElement[Any] | QueryableAttribute[Any]
|
||||||
|
|
||||||
# Search / facet / order type aliases
|
# Search / facet type aliases
|
||||||
SearchFieldType = InstrumentedAttribute[Any] | tuple[InstrumentedAttribute[Any], ...]
|
SearchFieldType = InstrumentedAttribute[Any] | tuple[InstrumentedAttribute[Any], ...]
|
||||||
FacetFieldType = SearchFieldType
|
FacetFieldType = SearchFieldType
|
||||||
OrderFieldType = SearchFieldType
|
|
||||||
|
|
||||||
# Dependency type aliases
|
# Dependency type aliases
|
||||||
SessionDependency = Callable[[], AsyncGenerator[AsyncSession, None]] | Any
|
SessionDependency = Callable[[], AsyncGenerator[AsyncSession, None]] | Any
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import uuid
|
import uuid
|
||||||
from enum import Enum
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
@@ -13,16 +12,13 @@ from sqlalchemy import (
|
|||||||
Column,
|
Column,
|
||||||
Date,
|
Date,
|
||||||
DateTime,
|
DateTime,
|
||||||
Enum as SAEnum,
|
|
||||||
ForeignKey,
|
ForeignKey,
|
||||||
Integer,
|
Integer,
|
||||||
JSON,
|
|
||||||
Numeric,
|
Numeric,
|
||||||
String,
|
String,
|
||||||
Table,
|
Table,
|
||||||
Uuid,
|
Uuid,
|
||||||
)
|
)
|
||||||
from sqlalchemy.dialects.postgresql import ARRAY
|
|
||||||
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
|
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
|
||||||
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship
|
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship
|
||||||
|
|
||||||
@@ -141,57 +137,6 @@ class Post(Base):
|
|||||||
tags: Mapped[list[Tag]] = relationship(secondary=post_tags)
|
tags: Mapped[list[Tag]] = relationship(secondary=post_tags)
|
||||||
|
|
||||||
|
|
||||||
class OrderStatus(int, Enum):
|
|
||||||
"""Integer-backed enum for order status."""
|
|
||||||
|
|
||||||
PENDING = 1
|
|
||||||
PROCESSING = 2
|
|
||||||
SHIPPED = 3
|
|
||||||
CANCELLED = 4
|
|
||||||
|
|
||||||
|
|
||||||
class Color(str, Enum):
|
|
||||||
"""String-backed enum for color."""
|
|
||||||
|
|
||||||
RED = "red"
|
|
||||||
GREEN = "green"
|
|
||||||
BLUE = "blue"
|
|
||||||
|
|
||||||
|
|
||||||
class Order(Base):
|
|
||||||
"""Test model with an IntEnum column (Enum(int, Enum)) and a raw Integer column."""
|
|
||||||
|
|
||||||
__tablename__ = "orders"
|
|
||||||
|
|
||||||
id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, default=uuid.uuid4)
|
|
||||||
name: Mapped[str] = mapped_column(String(100))
|
|
||||||
status: Mapped[OrderStatus] = mapped_column(SAEnum(OrderStatus))
|
|
||||||
priority: Mapped[int] = mapped_column(Integer)
|
|
||||||
color: Mapped[Color] = mapped_column(SAEnum(Color))
|
|
||||||
|
|
||||||
|
|
||||||
class Transfer(Base):
|
|
||||||
"""Test model with two FKs to the same table (users)."""
|
|
||||||
|
|
||||||
__tablename__ = "transfers"
|
|
||||||
|
|
||||||
id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, default=uuid.uuid4)
|
|
||||||
amount: Mapped[str] = mapped_column(String(50))
|
|
||||||
sender_id: Mapped[uuid.UUID] = mapped_column(ForeignKey("users.id"))
|
|
||||||
receiver_id: Mapped[uuid.UUID] = mapped_column(ForeignKey("users.id"))
|
|
||||||
|
|
||||||
|
|
||||||
class Article(Base):
|
|
||||||
"""Test article model with ARRAY and JSON columns."""
|
|
||||||
|
|
||||||
__tablename__ = "articles"
|
|
||||||
|
|
||||||
id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, default=uuid.uuid4)
|
|
||||||
title: Mapped[str] = mapped_column(String(200))
|
|
||||||
labels: Mapped[list[str]] = mapped_column(ARRAY(String))
|
|
||||||
metadata_: Mapped[dict | None] = mapped_column("metadata", JSON, nullable=True)
|
|
||||||
|
|
||||||
|
|
||||||
class RoleCreate(BaseModel):
|
class RoleCreate(BaseModel):
|
||||||
"""Schema for creating a role."""
|
"""Schema for creating a role."""
|
||||||
|
|
||||||
@@ -326,61 +271,6 @@ class ProductCreate(BaseModel):
|
|||||||
price: decimal.Decimal
|
price: decimal.Decimal
|
||||||
|
|
||||||
|
|
||||||
class ArticleCreate(BaseModel):
|
|
||||||
"""Schema for creating an article."""
|
|
||||||
|
|
||||||
id: uuid.UUID | None = None
|
|
||||||
title: str
|
|
||||||
labels: list[str] = []
|
|
||||||
|
|
||||||
|
|
||||||
class ArticleRead(PydanticBase):
|
|
||||||
"""Schema for reading an article."""
|
|
||||||
|
|
||||||
id: uuid.UUID
|
|
||||||
title: str
|
|
||||||
labels: list[str]
|
|
||||||
|
|
||||||
|
|
||||||
class OrderCreate(BaseModel):
|
|
||||||
"""Schema for creating an order."""
|
|
||||||
|
|
||||||
id: uuid.UUID | None = None
|
|
||||||
name: str
|
|
||||||
status: OrderStatus
|
|
||||||
priority: int = 0
|
|
||||||
color: Color = Color.RED
|
|
||||||
|
|
||||||
|
|
||||||
class OrderRead(PydanticBase):
|
|
||||||
"""Schema for reading an order."""
|
|
||||||
|
|
||||||
id: uuid.UUID
|
|
||||||
name: str
|
|
||||||
status: OrderStatus
|
|
||||||
priority: int
|
|
||||||
color: Color
|
|
||||||
|
|
||||||
|
|
||||||
class TransferCreate(BaseModel):
|
|
||||||
"""Schema for creating a transfer."""
|
|
||||||
|
|
||||||
id: uuid.UUID | None = None
|
|
||||||
amount: str
|
|
||||||
sender_id: uuid.UUID
|
|
||||||
receiver_id: uuid.UUID
|
|
||||||
|
|
||||||
|
|
||||||
class TransferRead(PydanticBase):
|
|
||||||
"""Schema for reading a transfer."""
|
|
||||||
|
|
||||||
id: uuid.UUID
|
|
||||||
amount: str
|
|
||||||
|
|
||||||
|
|
||||||
OrderCrud = CrudFactory(Order)
|
|
||||||
TransferCrud = CrudFactory(Transfer)
|
|
||||||
ArticleCrud = CrudFactory(Article)
|
|
||||||
RoleCrud = CrudFactory(Role)
|
RoleCrud = CrudFactory(Role)
|
||||||
RoleCursorCrud = CrudFactory(Role, cursor_column=Role.id)
|
RoleCursorCrud = CrudFactory(Role, cursor_column=Role.id)
|
||||||
IntRoleCursorCrud = CrudFactory(IntRole, cursor_column=IntRole.id)
|
IntRoleCursorCrud = CrudFactory(IntRole, cursor_column=IntRole.id)
|
||||||
|
|||||||
@@ -6,15 +6,9 @@ import pytest
|
|||||||
from sqlalchemy.ext.asyncio import AsyncSession
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
from sqlalchemy.orm import selectinload
|
from sqlalchemy.orm import selectinload
|
||||||
|
|
||||||
from fastapi_toolsets.crud import CrudFactory, PaginationType, lateral_load
|
from fastapi_toolsets.crud import CrudFactory, PaginationType
|
||||||
from fastapi_toolsets.crud.factory import (
|
from fastapi_toolsets.crud.factory import AsyncCrud, _CursorDirection
|
||||||
AsyncCrud,
|
|
||||||
_CursorDirection,
|
|
||||||
_LateralLoad,
|
|
||||||
_ResolvedLateral,
|
|
||||||
)
|
|
||||||
from fastapi_toolsets.exceptions import NotFoundError
|
from fastapi_toolsets.exceptions import NotFoundError
|
||||||
from fastapi_toolsets.schemas import PydanticBase
|
|
||||||
|
|
||||||
from .conftest import (
|
from .conftest import (
|
||||||
EventCreate,
|
EventCreate,
|
||||||
@@ -44,10 +38,6 @@ from .conftest import (
|
|||||||
Tag,
|
Tag,
|
||||||
TagCreate,
|
TagCreate,
|
||||||
TagCrud,
|
TagCrud,
|
||||||
Transfer,
|
|
||||||
TransferCreate,
|
|
||||||
TransferCrud,
|
|
||||||
TransferRead,
|
|
||||||
User,
|
User,
|
||||||
UserCreate,
|
UserCreate,
|
||||||
UserCrud,
|
UserCrud,
|
||||||
@@ -57,12 +47,6 @@ from .conftest import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class UserWithRoleRead(PydanticBase):
|
|
||||||
id: uuid.UUID
|
|
||||||
username: str
|
|
||||||
role: RoleRead | None = None
|
|
||||||
|
|
||||||
|
|
||||||
class TestCrudFactory:
|
class TestCrudFactory:
|
||||||
"""Tests for CrudFactory."""
|
"""Tests for CrudFactory."""
|
||||||
|
|
||||||
@@ -220,97 +204,11 @@ class TestResolveLoadOptions:
|
|||||||
assert crud._resolve_load_options(None) is None
|
assert crud._resolve_load_options(None) is None
|
||||||
|
|
||||||
def test_empty_list_overrides_default(self):
|
def test_empty_list_overrides_default(self):
|
||||||
"""An explicit empty list disables default_load_options (no options applied)."""
|
"""An empty list is a valid override and disables default_load_options."""
|
||||||
default = [selectinload(User.role)]
|
default = [selectinload(User.role)]
|
||||||
crud = CrudFactory(User, default_load_options=default)
|
crud = CrudFactory(User, default_load_options=default)
|
||||||
# Empty list replaces default; None and [] are both falsy → no options applied
|
# Empty list is not None, so it should replace default
|
||||||
assert not crud._resolve_load_options([])
|
assert crud._resolve_load_options([]) == []
|
||||||
|
|
||||||
|
|
||||||
class TestResolveSearchColumns:
|
|
||||||
"""Tests for _resolve_search_columns logic."""
|
|
||||||
|
|
||||||
def test_returns_none_when_no_searchable_fields(self):
|
|
||||||
"""Returns None when cls.searchable_fields is None and no search_fields passed."""
|
|
||||||
|
|
||||||
class AbstractCrud(AsyncCrud[User]):
|
|
||||||
pass
|
|
||||||
|
|
||||||
assert AbstractCrud._resolve_search_columns(None) is None
|
|
||||||
|
|
||||||
def test_returns_none_when_empty_search_fields_passed(self):
|
|
||||||
"""Returns None when an empty list is passed explicitly."""
|
|
||||||
crud = CrudFactory(User)
|
|
||||||
assert crud._resolve_search_columns([]) is None
|
|
||||||
|
|
||||||
def test_returns_keys_from_class_searchable_fields(self):
|
|
||||||
"""Returns column keys from cls.searchable_fields when no override passed."""
|
|
||||||
crud = CrudFactory(User, searchable_fields=[User.username])
|
|
||||||
result = crud._resolve_search_columns(None)
|
|
||||||
assert result is not None
|
|
||||||
assert "username" in result
|
|
||||||
|
|
||||||
def test_search_fields_override_takes_priority(self):
|
|
||||||
"""Explicit search_fields override cls.searchable_fields."""
|
|
||||||
crud = CrudFactory(User, searchable_fields=[User.username])
|
|
||||||
result = crud._resolve_search_columns([User.email])
|
|
||||||
assert result is not None
|
|
||||||
assert "email" in result
|
|
||||||
assert "username" not in result
|
|
||||||
|
|
||||||
|
|
||||||
class TestResolveOrderColumns:
|
|
||||||
"""Tests for _resolve_order_columns logic."""
|
|
||||||
|
|
||||||
def test_returns_none_when_no_order_fields(self):
|
|
||||||
"""Returns None when cls.order_fields is None and no order_fields passed."""
|
|
||||||
|
|
||||||
class AbstractCrud(AsyncCrud[User]):
|
|
||||||
pass
|
|
||||||
|
|
||||||
assert AbstractCrud._resolve_order_columns(None) is None
|
|
||||||
|
|
||||||
def test_returns_none_when_empty_order_fields_passed(self):
|
|
||||||
"""Returns None when an empty list is passed explicitly."""
|
|
||||||
crud = CrudFactory(User)
|
|
||||||
assert crud._resolve_order_columns([]) is None
|
|
||||||
|
|
||||||
def test_returns_keys_from_class_order_fields(self):
|
|
||||||
"""Returns sorted column keys from cls.order_fields when no override passed."""
|
|
||||||
crud = CrudFactory(User, order_fields=[User.username])
|
|
||||||
result = crud._resolve_order_columns(None)
|
|
||||||
assert result is not None
|
|
||||||
assert "username" in result
|
|
||||||
|
|
||||||
def test_order_fields_override_takes_priority(self):
|
|
||||||
"""Explicit order_fields override cls.order_fields."""
|
|
||||||
crud = CrudFactory(User, order_fields=[User.username])
|
|
||||||
result = crud._resolve_order_columns([User.email])
|
|
||||||
assert result is not None
|
|
||||||
assert "email" in result
|
|
||||||
assert "username" not in result
|
|
||||||
|
|
||||||
def test_returns_sorted_keys(self):
|
|
||||||
"""Keys are returned in sorted order."""
|
|
||||||
crud = CrudFactory(User, order_fields=[User.email, User.username])
|
|
||||||
result = crud._resolve_order_columns(None)
|
|
||||||
assert result is not None
|
|
||||||
assert result == sorted(result)
|
|
||||||
|
|
||||||
def test_relation_tuple_produces_dunder_key(self):
|
|
||||||
"""A (rel, column) tuple produces a 'rel__column' key."""
|
|
||||||
crud = CrudFactory(User, order_fields=[(User.role, Role.name)])
|
|
||||||
result = crud._resolve_order_columns(None)
|
|
||||||
assert result == ["role__name"]
|
|
||||||
|
|
||||||
def test_mixed_flat_and_relation_fields(self):
|
|
||||||
"""Flat and relation fields can be mixed; keys are sorted."""
|
|
||||||
crud = CrudFactory(User, order_fields=[User.username, (User.role, Role.name)])
|
|
||||||
result = crud._resolve_order_columns(None)
|
|
||||||
assert result is not None
|
|
||||||
assert "username" in result
|
|
||||||
assert "role__name" in result
|
|
||||||
assert result == sorted(result)
|
|
||||||
|
|
||||||
|
|
||||||
class TestDefaultLoadOptionsIntegration:
|
class TestDefaultLoadOptionsIntegration:
|
||||||
@@ -371,6 +269,13 @@ class TestDefaultLoadOptionsIntegration:
|
|||||||
self, db_session: AsyncSession
|
self, db_session: AsyncSession
|
||||||
):
|
):
|
||||||
"""default_load_options loads relationships automatically on offset_paginate()."""
|
"""default_load_options loads relationships automatically on offset_paginate()."""
|
||||||
|
from fastapi_toolsets.schemas import PydanticBase
|
||||||
|
|
||||||
|
class UserWithRoleRead(PydanticBase):
|
||||||
|
id: uuid.UUID
|
||||||
|
username: str
|
||||||
|
role: RoleRead | None = None
|
||||||
|
|
||||||
UserWithDefaultLoad = CrudFactory(
|
UserWithDefaultLoad = CrudFactory(
|
||||||
User, default_load_options=[selectinload(User.role)]
|
User, default_load_options=[selectinload(User.role)]
|
||||||
)
|
)
|
||||||
@@ -385,43 +290,6 @@ class TestDefaultLoadOptionsIntegration:
|
|||||||
assert result.data[0].role is not None
|
assert result.data[0].role is not None
|
||||||
assert result.data[0].role.name == "admin"
|
assert result.data[0].role.name == "admin"
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_default_load_options_applied_to_create(
|
|
||||||
self, db_session: AsyncSession
|
|
||||||
):
|
|
||||||
"""default_load_options loads relationships after create()."""
|
|
||||||
UserWithDefaultLoad = CrudFactory(
|
|
||||||
User, default_load_options=[selectinload(User.role)]
|
|
||||||
)
|
|
||||||
role = await RoleCrud.create(db_session, RoleCreate(name="admin"))
|
|
||||||
user = await UserWithDefaultLoad.create(
|
|
||||||
db_session,
|
|
||||||
UserCreate(username="alice", email="alice@test.com", role_id=role.id),
|
|
||||||
)
|
|
||||||
assert user.role is not None
|
|
||||||
assert user.role.name == "admin"
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_default_load_options_applied_to_update(
|
|
||||||
self, db_session: AsyncSession
|
|
||||||
):
|
|
||||||
"""default_load_options loads relationships after update()."""
|
|
||||||
UserWithDefaultLoad = CrudFactory(
|
|
||||||
User, default_load_options=[selectinload(User.role)]
|
|
||||||
)
|
|
||||||
role = await RoleCrud.create(db_session, RoleCreate(name="admin"))
|
|
||||||
user = await UserCrud.create(
|
|
||||||
db_session,
|
|
||||||
UserCreate(username="alice", email="alice@test.com"),
|
|
||||||
)
|
|
||||||
updated = await UserWithDefaultLoad.update(
|
|
||||||
db_session,
|
|
||||||
UserUpdate(role_id=role.id),
|
|
||||||
filters=[User.id == user.id],
|
|
||||||
)
|
|
||||||
assert updated.role is not None
|
|
||||||
assert updated.role.name == "admin"
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_load_options_overrides_default_load_options(
|
async def test_load_options_overrides_default_load_options(
|
||||||
self, db_session: AsyncSession
|
self, db_session: AsyncSession
|
||||||
@@ -1382,128 +1250,6 @@ class TestCrudJoins:
|
|||||||
assert users[0].username == "multi_join"
|
assert users[0].username == "multi_join"
|
||||||
|
|
||||||
|
|
||||||
class TestCrudAliasedJoins:
|
|
||||||
"""Tests for CRUD operations with aliased joins (same table joined twice)."""
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_get_multi_with_aliased_joins(self, db_session: AsyncSession):
|
|
||||||
"""Aliased joins allow joining the same table twice."""
|
|
||||||
from sqlalchemy.orm import aliased
|
|
||||||
|
|
||||||
alice = await UserCrud.create(
|
|
||||||
db_session, UserCreate(username="alice", email="alice@test.com")
|
|
||||||
)
|
|
||||||
bob = await UserCrud.create(
|
|
||||||
db_session, UserCreate(username="bob", email="bob@test.com")
|
|
||||||
)
|
|
||||||
await TransferCrud.create(
|
|
||||||
db_session,
|
|
||||||
TransferCreate(amount="100", sender_id=alice.id, receiver_id=bob.id),
|
|
||||||
)
|
|
||||||
|
|
||||||
Sender = aliased(User)
|
|
||||||
Receiver = aliased(User)
|
|
||||||
|
|
||||||
results = await TransferCrud.get_multi(
|
|
||||||
db_session,
|
|
||||||
joins=[
|
|
||||||
(Sender, Transfer.sender_id == Sender.id),
|
|
||||||
(Receiver, Transfer.receiver_id == Receiver.id),
|
|
||||||
],
|
|
||||||
filters=[Sender.username == "alice", Receiver.username == "bob"],
|
|
||||||
)
|
|
||||||
assert len(results) == 1
|
|
||||||
assert results[0].amount == "100"
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_get_multi_aliased_no_match(self, db_session: AsyncSession):
|
|
||||||
"""Aliased joins correctly filter out non-matching rows."""
|
|
||||||
from sqlalchemy.orm import aliased
|
|
||||||
|
|
||||||
alice = await UserCrud.create(
|
|
||||||
db_session, UserCreate(username="alice", email="alice@test.com")
|
|
||||||
)
|
|
||||||
bob = await UserCrud.create(
|
|
||||||
db_session, UserCreate(username="bob", email="bob@test.com")
|
|
||||||
)
|
|
||||||
await TransferCrud.create(
|
|
||||||
db_session,
|
|
||||||
TransferCreate(amount="100", sender_id=alice.id, receiver_id=bob.id),
|
|
||||||
)
|
|
||||||
|
|
||||||
Sender = aliased(User)
|
|
||||||
Receiver = aliased(User)
|
|
||||||
|
|
||||||
# bob is receiver, not sender — should return nothing
|
|
||||||
results = await TransferCrud.get_multi(
|
|
||||||
db_session,
|
|
||||||
joins=[
|
|
||||||
(Sender, Transfer.sender_id == Sender.id),
|
|
||||||
(Receiver, Transfer.receiver_id == Receiver.id),
|
|
||||||
],
|
|
||||||
filters=[Sender.username == "bob", Receiver.username == "alice"],
|
|
||||||
)
|
|
||||||
assert len(results) == 0
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_paginate_with_aliased_joins(self, db_session: AsyncSession):
|
|
||||||
"""Aliased joins work with offset_paginate."""
|
|
||||||
from sqlalchemy.orm import aliased
|
|
||||||
|
|
||||||
alice = await UserCrud.create(
|
|
||||||
db_session, UserCreate(username="alice", email="alice@test.com")
|
|
||||||
)
|
|
||||||
bob = await UserCrud.create(
|
|
||||||
db_session, UserCreate(username="bob", email="bob@test.com")
|
|
||||||
)
|
|
||||||
await TransferCrud.create(
|
|
||||||
db_session,
|
|
||||||
TransferCreate(amount="50", sender_id=alice.id, receiver_id=bob.id),
|
|
||||||
)
|
|
||||||
await TransferCrud.create(
|
|
||||||
db_session,
|
|
||||||
TransferCreate(amount="75", sender_id=bob.id, receiver_id=alice.id),
|
|
||||||
)
|
|
||||||
|
|
||||||
Sender = aliased(User)
|
|
||||||
result = await TransferCrud.offset_paginate(
|
|
||||||
db_session,
|
|
||||||
joins=[(Sender, Transfer.sender_id == Sender.id)],
|
|
||||||
filters=[Sender.username == "alice"],
|
|
||||||
schema=TransferRead,
|
|
||||||
)
|
|
||||||
assert result.pagination.total_count == 1
|
|
||||||
assert result.data[0].amount == "50"
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_count_with_aliased_join(self, db_session: AsyncSession):
|
|
||||||
"""Aliased joins work with count."""
|
|
||||||
from sqlalchemy.orm import aliased
|
|
||||||
|
|
||||||
alice = await UserCrud.create(
|
|
||||||
db_session, UserCreate(username="alice", email="alice@test.com")
|
|
||||||
)
|
|
||||||
bob = await UserCrud.create(
|
|
||||||
db_session, UserCreate(username="bob", email="bob@test.com")
|
|
||||||
)
|
|
||||||
await TransferCrud.create(
|
|
||||||
db_session,
|
|
||||||
TransferCreate(amount="10", sender_id=alice.id, receiver_id=bob.id),
|
|
||||||
)
|
|
||||||
await TransferCrud.create(
|
|
||||||
db_session,
|
|
||||||
TransferCreate(amount="20", sender_id=alice.id, receiver_id=bob.id),
|
|
||||||
)
|
|
||||||
|
|
||||||
Sender = aliased(User)
|
|
||||||
count = await TransferCrud.count(
|
|
||||||
db_session,
|
|
||||||
joins=[(Sender, Transfer.sender_id == Sender.id)],
|
|
||||||
filters=[Sender.username == "alice"],
|
|
||||||
)
|
|
||||||
assert count == 2
|
|
||||||
|
|
||||||
|
|
||||||
class TestCrudFactoryM2M:
|
class TestCrudFactoryM2M:
|
||||||
"""Tests for CrudFactory with m2m_fields parameter."""
|
"""Tests for CrudFactory with m2m_fields parameter."""
|
||||||
|
|
||||||
@@ -2467,7 +2213,12 @@ class TestCursorPaginateExtraOptions:
|
|||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_with_load_options(self, db_session: AsyncSession):
|
async def test_with_load_options(self, db_session: AsyncSession):
|
||||||
"""cursor_paginate passes load_options to the query."""
|
"""cursor_paginate passes load_options to the query."""
|
||||||
from fastapi_toolsets.schemas import CursorPagination
|
from fastapi_toolsets.schemas import CursorPagination, PydanticBase
|
||||||
|
|
||||||
|
class UserWithRoleRead(PydanticBase):
|
||||||
|
id: uuid.UUID
|
||||||
|
username: str
|
||||||
|
role: RoleRead | None = None
|
||||||
|
|
||||||
role = await RoleCrud.create(db_session, RoleCreate(name="manager"))
|
role = await RoleCrud.create(db_session, RoleCreate(name="manager"))
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
@@ -2833,445 +2584,3 @@ class TestPaginate:
|
|||||||
|
|
||||||
assert isinstance(result.pagination, OffsetPagination)
|
assert isinstance(result.pagination, OffsetPagination)
|
||||||
assert result.pagination.total_count is None
|
assert result.pagination.total_count is None
|
||||||
|
|
||||||
|
|
||||||
class TestLateralLoadValidation:
|
|
||||||
"""lateral_load() raises immediately for bad relationship types."""
|
|
||||||
|
|
||||||
def test_valid_many_to_one_returns_marker(self):
|
|
||||||
"""lateral_load() on a Many:One rel returns a _LateralLoad with rel_attr set."""
|
|
||||||
marker = lateral_load(User.role)
|
|
||||||
assert isinstance(marker, _LateralLoad)
|
|
||||||
assert marker.rel_attr is User.role
|
|
||||||
|
|
||||||
def test_raises_type_error_for_plain_column(self):
|
|
||||||
"""lateral_load() raises TypeError when passed a plain column."""
|
|
||||||
with pytest.raises(TypeError, match="relationship attribute"):
|
|
||||||
lateral_load(User.username)
|
|
||||||
|
|
||||||
def test_raises_value_error_for_many_to_many(self):
|
|
||||||
"""lateral_load() raises ValueError for Many:Many (secondary table)."""
|
|
||||||
with pytest.raises(ValueError, match="Many:Many"):
|
|
||||||
lateral_load(Post.tags)
|
|
||||||
|
|
||||||
def test_raises_value_error_for_one_to_many(self):
|
|
||||||
"""lateral_load() raises ValueError for One:Many (uselist=True)."""
|
|
||||||
with pytest.raises(ValueError, match="One:Many"):
|
|
||||||
lateral_load(Role.users)
|
|
||||||
|
|
||||||
|
|
||||||
class TestLateralLoadInSubclass:
|
|
||||||
"""lateral_load() markers in default_load_options are processed at class definition."""
|
|
||||||
|
|
||||||
def test_marker_extracted_from_default_load_options(self):
|
|
||||||
"""_LateralLoad is removed from default_load_options and stored in _resolved_lateral."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
assert UserLateralCrud.default_load_options is None
|
|
||||||
assert UserLateralCrud._resolved_lateral is not None
|
|
||||||
|
|
||||||
def test_resolved_lateral_has_one_join_and_eager(self):
|
|
||||||
"""_resolved_lateral contains exactly one join and one eager option."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
resolved = UserLateralCrud._resolved_lateral
|
|
||||||
assert isinstance(resolved, _ResolvedLateral)
|
|
||||||
assert len(resolved.joins) == 1
|
|
||||||
assert len(resolved.eager) == 1
|
|
||||||
|
|
||||||
def test_regular_options_preserved_alongside_lateral(self):
|
|
||||||
"""Non-lateral opts stay in default_load_options; lateral marker is extracted."""
|
|
||||||
regular = selectinload(User.role)
|
|
||||||
|
|
||||||
class UserMixedCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role), regular]
|
|
||||||
|
|
||||||
assert UserMixedCrud._resolved_lateral is not None
|
|
||||||
assert UserMixedCrud.default_load_options == [regular]
|
|
||||||
|
|
||||||
def test_no_lateral_leaves_default_load_options_untouched(self):
|
|
||||||
"""When no lateral marker is present, default_load_options is unchanged."""
|
|
||||||
opts = [selectinload(User.role)]
|
|
||||||
|
|
||||||
class UserNormalCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = opts
|
|
||||||
|
|
||||||
assert UserNormalCrud.default_load_options is opts
|
|
||||||
assert UserNormalCrud._resolved_lateral is None
|
|
||||||
|
|
||||||
def test_no_default_load_options_leaves_resolved_lateral_none(self):
|
|
||||||
"""_resolved_lateral stays None when default_load_options is not set."""
|
|
||||||
|
|
||||||
class UserPlainCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
|
|
||||||
assert UserPlainCrud._resolved_lateral is None
|
|
||||||
|
|
||||||
|
|
||||||
class TestResolveLoadOptionsWithLateral:
|
|
||||||
"""_resolve_load_options always appends lateral eager options."""
|
|
||||||
|
|
||||||
def test_lateral_eager_included_when_no_call_site_opts(self):
|
|
||||||
"""contains_eager from lateral_load is returned when load_options=None."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
resolved = UserLateralCrud._resolve_load_options(None)
|
|
||||||
assert resolved is not None
|
|
||||||
assert len(resolved) == 1 # the contains_eager
|
|
||||||
|
|
||||||
def test_call_site_opts_bypass_lateral_eager(self):
|
|
||||||
"""When call-site load_options are provided, lateral eager is NOT appended."""
|
|
||||||
extra = selectinload(User.role)
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
resolved = UserLateralCrud._resolve_load_options([extra])
|
|
||||||
assert resolved is not None
|
|
||||||
assert len(resolved) == 1 # only the call-site option; lateral eager skipped
|
|
||||||
|
|
||||||
def test_lateral_eager_appended_to_default_load_options(self):
|
|
||||||
"""default_load_options (regular) + lateral eager are both returned."""
|
|
||||||
regular = selectinload(User.role)
|
|
||||||
|
|
||||||
class UserMixedCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role), regular]
|
|
||||||
|
|
||||||
resolved = UserMixedCrud._resolve_load_options(None)
|
|
||||||
assert resolved is not None
|
|
||||||
assert len(resolved) == 2
|
|
||||||
|
|
||||||
|
|
||||||
class TestGetLateralJoins:
|
|
||||||
"""_get_lateral_joins merges auto-resolved and manual lateral_joins."""
|
|
||||||
|
|
||||||
def test_returns_none_when_no_lateral_configured(self):
|
|
||||||
"""Returns None when neither lateral_joins nor lateral_load is set."""
|
|
||||||
|
|
||||||
class UserPlainCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
|
|
||||||
assert UserPlainCrud._get_lateral_joins() is None
|
|
||||||
|
|
||||||
def test_returns_resolved_lateral_joins(self):
|
|
||||||
"""Returns the join tuple built from lateral_load()."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
joins = UserLateralCrud._get_lateral_joins()
|
|
||||||
assert joins is not None
|
|
||||||
assert len(joins) == 1
|
|
||||||
|
|
||||||
def test_manual_lateral_joins_included(self):
|
|
||||||
"""Manual lateral_joins class var is included in _get_lateral_joins."""
|
|
||||||
from sqlalchemy import select, true
|
|
||||||
|
|
||||||
manual_sub = select(Role).where(Role.id == User.role_id).lateral("_manual_role")
|
|
||||||
|
|
||||||
class UserManualCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
lateral_joins = [(manual_sub, true())]
|
|
||||||
|
|
||||||
joins = UserManualCrud._get_lateral_joins()
|
|
||||||
assert joins is not None
|
|
||||||
assert len(joins) == 1
|
|
||||||
|
|
||||||
def test_manual_and_auto_lateral_joins_merged(self):
|
|
||||||
"""Both manual lateral_joins and auto-resolved from lateral_load are combined."""
|
|
||||||
from sqlalchemy import select, true
|
|
||||||
|
|
||||||
manual_sub = select(Role).where(Role.id == User.role_id).lateral("_manual_role")
|
|
||||||
|
|
||||||
class UserBothCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
lateral_joins = [(manual_sub, true())]
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
joins = UserBothCrud._get_lateral_joins()
|
|
||||||
assert joins is not None
|
|
||||||
assert len(joins) == 2
|
|
||||||
|
|
||||||
|
|
||||||
class TestLateralLoadIntegration:
|
|
||||||
"""lateral_load() in real DB queries: relationship loaded, pagination correct."""
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_get_loads_relationship(self, db_session: AsyncSession):
|
|
||||||
"""get() populates the relationship via lateral join."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
role = await RoleCrud.create(db_session, RoleCreate(name="admin"))
|
|
||||||
user = await UserCrud.create(
|
|
||||||
db_session,
|
|
||||||
UserCreate(username="alice", email="alice@test.com", role_id=role.id),
|
|
||||||
)
|
|
||||||
|
|
||||||
fetched = await UserLateralCrud.get(db_session, [User.id == user.id])
|
|
||||||
assert fetched.role is not None
|
|
||||||
assert fetched.role.name == "admin"
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_get_null_fk_preserved(self, db_session: AsyncSession):
|
|
||||||
"""User with null role_id still returned (LEFT JOIN behaviour)."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
user = await UserCrud.create(
|
|
||||||
db_session, UserCreate(username="bob", email="bob@test.com")
|
|
||||||
)
|
|
||||||
|
|
||||||
fetched = await UserLateralCrud.get(db_session, [User.id == user.id])
|
|
||||||
assert fetched is not None
|
|
||||||
assert fetched.role is None
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_first_loads_relationship(self, db_session: AsyncSession):
|
|
||||||
"""first() populates the relationship via lateral join."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
role = await RoleCrud.create(db_session, RoleCreate(name="editor"))
|
|
||||||
await UserCrud.create(
|
|
||||||
db_session,
|
|
||||||
UserCreate(username="carol", email="carol@test.com", role_id=role.id),
|
|
||||||
)
|
|
||||||
|
|
||||||
user = await UserLateralCrud.first(db_session)
|
|
||||||
assert user is not None
|
|
||||||
assert user.role is not None
|
|
||||||
assert user.role.name == "editor"
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_get_multi_loads_relationship(self, db_session: AsyncSession):
|
|
||||||
"""get_multi() populates the relationship via lateral join for all rows."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
role = await RoleCrud.create(db_session, RoleCreate(name="member"))
|
|
||||||
for i in range(3):
|
|
||||||
await UserCrud.create(
|
|
||||||
db_session,
|
|
||||||
UserCreate(
|
|
||||||
username=f"user{i}", email=f"u{i}@test.com", role_id=role.id
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
users = await UserLateralCrud.get_multi(db_session)
|
|
||||||
assert len(users) == 3
|
|
||||||
assert all(u.role is not None and u.role.name == "member" for u in users)
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_offset_paginate_correct_count(self, db_session: AsyncSession):
|
|
||||||
"""offset_paginate total_count is not inflated by the lateral join."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
role = await RoleCrud.create(db_session, RoleCreate(name="admin"))
|
|
||||||
for i in range(5):
|
|
||||||
await UserCrud.create(
|
|
||||||
db_session,
|
|
||||||
UserCreate(
|
|
||||||
username=f"user{i}", email=f"u{i}@test.com", role_id=role.id
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
result = await UserLateralCrud.offset_paginate(
|
|
||||||
db_session, schema=UserWithRoleRead, items_per_page=10
|
|
||||||
)
|
|
||||||
assert result.pagination.total_count == 5
|
|
||||||
assert len(result.data) == 5
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_offset_paginate_loads_relationship(self, db_session: AsyncSession):
|
|
||||||
"""offset_paginate serializes relationship data loaded via lateral."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
role = await RoleCrud.create(db_session, RoleCreate(name="admin"))
|
|
||||||
await UserCrud.create(
|
|
||||||
db_session,
|
|
||||||
UserCreate(username="alice", email="alice@test.com", role_id=role.id),
|
|
||||||
)
|
|
||||||
|
|
||||||
result = await UserLateralCrud.offset_paginate(
|
|
||||||
db_session, schema=UserWithRoleRead, items_per_page=10
|
|
||||||
)
|
|
||||||
assert result.data[0].role is not None
|
|
||||||
assert result.data[0].role.name == "admin"
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_offset_paginate_mixed_null_fk(self, db_session: AsyncSession):
|
|
||||||
"""offset_paginate returns all users including those with null role_id."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
role = await RoleCrud.create(db_session, RoleCreate(name="admin"))
|
|
||||||
await UserCrud.create(
|
|
||||||
db_session,
|
|
||||||
UserCreate(username="with_role", email="a@test.com", role_id=role.id),
|
|
||||||
)
|
|
||||||
await UserCrud.create(
|
|
||||||
db_session, UserCreate(username="no_role", email="b@test.com")
|
|
||||||
)
|
|
||||||
|
|
||||||
result = await UserLateralCrud.offset_paginate(
|
|
||||||
db_session, schema=UserWithRoleRead, items_per_page=10
|
|
||||||
)
|
|
||||||
assert result.pagination.total_count == 2
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_cursor_paginate_loads_relationship(self, db_session: AsyncSession):
|
|
||||||
"""cursor_paginate populates the relationship via lateral join."""
|
|
||||||
|
|
||||||
class UserLateralCursorCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
cursor_column = User.id
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
role = await RoleCrud.create(db_session, RoleCreate(name="admin"))
|
|
||||||
for i in range(3):
|
|
||||||
await UserCrud.create(
|
|
||||||
db_session,
|
|
||||||
UserCreate(
|
|
||||||
username=f"user{i}", email=f"u{i}@test.com", role_id=role.id
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
result = await UserLateralCursorCrud.cursor_paginate(
|
|
||||||
db_session, schema=UserWithRoleRead, items_per_page=10
|
|
||||||
)
|
|
||||||
assert len(result.data) == 3
|
|
||||||
assert all(item.role is not None for item in result.data)
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_offset_paginate_with_search_and_lateral(
|
|
||||||
self, db_session: AsyncSession
|
|
||||||
):
|
|
||||||
"""search filter works alongside lateral join."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
searchable_fields = [User.username]
|
|
||||||
|
|
||||||
role = await RoleCrud.create(db_session, RoleCreate(name="admin"))
|
|
||||||
await UserCrud.create(
|
|
||||||
db_session,
|
|
||||||
UserCreate(username="alice", email="a@test.com", role_id=role.id),
|
|
||||||
)
|
|
||||||
await UserCrud.create(
|
|
||||||
db_session, UserCreate(username="bob", email="b@test.com", role_id=role.id)
|
|
||||||
)
|
|
||||||
|
|
||||||
result = await UserLateralCrud.offset_paginate(
|
|
||||||
db_session, schema=UserWithRoleRead, search="alice", items_per_page=10
|
|
||||||
)
|
|
||||||
assert result.pagination.total_count == 1
|
|
||||||
assert result.data[0].username == "alice"
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_first_call_site_load_options_bypasses_lateral(
|
|
||||||
self, db_session: AsyncSession
|
|
||||||
):
|
|
||||||
"""When load_options is provided, lateral join is skipped (no conflict)."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
role = await RoleCrud.create(db_session, RoleCreate(name="admin"))
|
|
||||||
user = await UserCrud.create(
|
|
||||||
db_session,
|
|
||||||
UserCreate(username="alice", email="alice@test.com", role_id=role.id),
|
|
||||||
)
|
|
||||||
|
|
||||||
# Passing explicit load_options bypasses the lateral join — role loaded via selectinload
|
|
||||||
fetched = await UserLateralCrud.first(
|
|
||||||
db_session,
|
|
||||||
filters=[User.id == user.id],
|
|
||||||
load_options=[selectinload(User.role)],
|
|
||||||
)
|
|
||||||
assert fetched is not None
|
|
||||||
assert fetched.role is not None
|
|
||||||
assert fetched.role.name == "admin"
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_get_multi_call_site_load_options_bypasses_lateral(
|
|
||||||
self, db_session: AsyncSession
|
|
||||||
):
|
|
||||||
"""When load_options is provided, lateral join is skipped (no conflict)."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
role = await RoleCrud.create(db_session, RoleCreate(name="viewer"))
|
|
||||||
for i in range(2):
|
|
||||||
await UserCrud.create(
|
|
||||||
db_session,
|
|
||||||
UserCreate(username=f"u{i}", email=f"u{i}@test.com", role_id=role.id),
|
|
||||||
)
|
|
||||||
|
|
||||||
# Passing explicit load_options bypasses the lateral join — role loaded via selectinload
|
|
||||||
users = await UserLateralCrud.get_multi(
|
|
||||||
db_session, load_options=[selectinload(User.role)]
|
|
||||||
)
|
|
||||||
assert len(users) == 2
|
|
||||||
assert all(u.role is not None and u.role.name == "viewer" for u in users)
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_offset_paginate_call_site_load_options_bypasses_lateral(
|
|
||||||
self, db_session: AsyncSession
|
|
||||||
):
|
|
||||||
"""When load_options is provided, lateral join is skipped (no conflict)."""
|
|
||||||
|
|
||||||
class UserLateralCrud(AsyncCrud[User]):
|
|
||||||
model = User
|
|
||||||
default_load_options = [lateral_load(User.role)]
|
|
||||||
|
|
||||||
role = await RoleCrud.create(db_session, RoleCreate(name="editor"))
|
|
||||||
for i in range(3):
|
|
||||||
await UserCrud.create(
|
|
||||||
db_session,
|
|
||||||
UserCreate(username=f"e{i}", email=f"e{i}@test.com", role_id=role.id),
|
|
||||||
)
|
|
||||||
|
|
||||||
# Passing explicit load_options bypasses the lateral join — role loaded via selectinload
|
|
||||||
result = await UserLateralCrud.offset_paginate(
|
|
||||||
db_session,
|
|
||||||
schema=UserWithRoleRead,
|
|
||||||
items_per_page=10,
|
|
||||||
load_options=[selectinload(User.role)],
|
|
||||||
)
|
|
||||||
assert result.pagination.total_count == 3
|
|
||||||
assert all(item.role is not None for item in result.data)
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1041,25 +1041,6 @@ class TestTransientObject:
|
|||||||
assert len(creates) == 1
|
assert len(creates) == 1
|
||||||
assert len(deletes) == 1
|
assert len(deletes) == 1
|
||||||
|
|
||||||
@pytest.mark.anyio
|
|
||||||
async def test_update_then_delete_suppresses_update_callback(self, mixin_session):
|
|
||||||
"""UPDATE callback is suppressed when the object is also deleted in the same transaction."""
|
|
||||||
obj = WatchedModel(status="initial", other="x")
|
|
||||||
mixin_session.add(obj)
|
|
||||||
await mixin_session.commit()
|
|
||||||
|
|
||||||
_test_events.clear()
|
|
||||||
|
|
||||||
obj.status = "changed"
|
|
||||||
await mixin_session.flush()
|
|
||||||
await mixin_session.delete(obj)
|
|
||||||
await mixin_session.commit()
|
|
||||||
|
|
||||||
updates = [e for e in _test_events if e["event"] == "update"]
|
|
||||||
deletes = [e for e in _test_events if e["event"] == "delete"]
|
|
||||||
assert updates == []
|
|
||||||
assert len(deletes) == 1
|
|
||||||
|
|
||||||
|
|
||||||
class TestPolymorphism:
|
class TestPolymorphism:
|
||||||
"""Event dispatch with STI (Single Table Inheritance)."""
|
"""Event dispatch with STI (Single Table Inheritance)."""
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
192
uv.lock
generated
192
uv.lock
generated
@@ -81,76 +81,6 @@ wheels = [
|
|||||||
{ url = "https://files.pythonhosted.org/packages/3c/d7/8fb3044eaef08a310acfe23dae9a8e2e07d305edc29a53497e52bc76eca7/asyncpg-0.31.0-cp314-cp314t-win_amd64.whl", hash = "sha256:bd4107bb7cdd0e9e65fae66a62afd3a249663b844fa34d479f6d5b3bef9c04c3", size = 706062, upload-time = "2025-11-24T23:26:44.086Z" },
|
{ url = "https://files.pythonhosted.org/packages/3c/d7/8fb3044eaef08a310acfe23dae9a8e2e07d305edc29a53497e52bc76eca7/asyncpg-0.31.0-cp314-cp314t-win_amd64.whl", hash = "sha256:bd4107bb7cdd0e9e65fae66a62afd3a249663b844fa34d479f6d5b3bef9c04c3", size = 706062, upload-time = "2025-11-24T23:26:44.086Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bcrypt"
|
|
||||||
version = "5.0.0"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/d4/36/3329e2518d70ad8e2e5817d5a4cac6bba05a47767ec416c7d020a965f408/bcrypt-5.0.0.tar.gz", hash = "sha256:f748f7c2d6fd375cc93d3fba7ef4a9e3a092421b8dbf34d8d4dc06be9492dfdd", size = 25386, upload-time = "2025-09-25T19:50:47.829Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/13/85/3e65e01985fddf25b64ca67275bb5bdb4040bd1a53b66d355c6c37c8a680/bcrypt-5.0.0-cp313-cp313t-macosx_10_12_universal2.whl", hash = "sha256:f3c08197f3039bec79cee59a606d62b96b16669cff3949f21e74796b6e3cd2be", size = 481806, upload-time = "2025-09-25T19:49:05.102Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/44/dc/01eb79f12b177017a726cbf78330eb0eb442fae0e7b3dfd84ea2849552f3/bcrypt-5.0.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:200af71bc25f22006f4069060c88ed36f8aa4ff7f53e67ff04d2ab3f1e79a5b2", size = 268626, upload-time = "2025-09-25T19:49:06.723Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/8c/cf/e82388ad5959c40d6afd94fb4743cc077129d45b952d46bdc3180310e2df/bcrypt-5.0.0-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:baade0a5657654c2984468efb7d6c110db87ea63ef5a4b54732e7e337253e44f", size = 271853, upload-time = "2025-09-25T19:49:08.028Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ec/86/7134b9dae7cf0efa85671651341f6afa695857fae172615e960fb6a466fa/bcrypt-5.0.0-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:c58b56cdfb03202b3bcc9fd8daee8e8e9b6d7e3163aa97c631dfcfcc24d36c86", size = 269793, upload-time = "2025-09-25T19:49:09.727Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/cc/82/6296688ac1b9e503d034e7d0614d56e80c5d1a08402ff856a4549cb59207/bcrypt-5.0.0-cp313-cp313t-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:4bfd2a34de661f34d0bda43c3e4e79df586e4716ef401fe31ea39d69d581ef23", size = 289930, upload-time = "2025-09-25T19:49:11.204Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d1/18/884a44aa47f2a3b88dd09bc05a1e40b57878ecd111d17e5bba6f09f8bb77/bcrypt-5.0.0-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:ed2e1365e31fc73f1825fa830f1c8f8917ca1b3ca6185773b349c20fd606cec2", size = 272194, upload-time = "2025-09-25T19:49:12.524Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/0e/8f/371a3ab33c6982070b674f1788e05b656cfbf5685894acbfef0c65483a59/bcrypt-5.0.0-cp313-cp313t-manylinux_2_34_aarch64.whl", hash = "sha256:83e787d7a84dbbfba6f250dd7a5efd689e935f03dd83b0f919d39349e1f23f83", size = 269381, upload-time = "2025-09-25T19:49:14.308Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/b1/34/7e4e6abb7a8778db6422e88b1f06eb07c47682313997ee8a8f9352e5a6f1/bcrypt-5.0.0-cp313-cp313t-manylinux_2_34_x86_64.whl", hash = "sha256:137c5156524328a24b9fac1cb5db0ba618bc97d11970b39184c1d87dc4bf1746", size = 271750, upload-time = "2025-09-25T19:49:15.584Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/c0/1b/54f416be2499bd72123c70d98d36c6cd61a4e33d9b89562c22481c81bb30/bcrypt-5.0.0-cp313-cp313t-musllinux_1_1_aarch64.whl", hash = "sha256:38cac74101777a6a7d3b3e3cfefa57089b5ada650dce2baf0cbdd9d65db22a9e", size = 303757, upload-time = "2025-09-25T19:49:17.244Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/13/62/062c24c7bcf9d2826a1a843d0d605c65a755bc98002923d01fd61270705a/bcrypt-5.0.0-cp313-cp313t-musllinux_1_1_x86_64.whl", hash = "sha256:d8d65b564ec849643d9f7ea05c6d9f0cd7ca23bdd4ac0c2dbef1104ab504543d", size = 306740, upload-time = "2025-09-25T19:49:18.693Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d5/c8/1fdbfc8c0f20875b6b4020f3c7dc447b8de60aa0be5faaf009d24242aec9/bcrypt-5.0.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:741449132f64b3524e95cd30e5cd3343006ce146088f074f31ab26b94e6c75ba", size = 334197, upload-time = "2025-09-25T19:49:20.523Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a6/c1/8b84545382d75bef226fbc6588af0f7b7d095f7cd6a670b42a86243183cd/bcrypt-5.0.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:212139484ab3207b1f0c00633d3be92fef3c5f0af17cad155679d03ff2ee1e41", size = 352974, upload-time = "2025-09-25T19:49:22.254Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/10/a6/ffb49d4254ed085e62e3e5dd05982b4393e32fe1e49bb1130186617c29cd/bcrypt-5.0.0-cp313-cp313t-win32.whl", hash = "sha256:9d52ed507c2488eddd6a95bccee4e808d3234fa78dd370e24bac65a21212b861", size = 148498, upload-time = "2025-09-25T19:49:24.134Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/48/a9/259559edc85258b6d5fc5471a62a3299a6aa37a6611a169756bf4689323c/bcrypt-5.0.0-cp313-cp313t-win_amd64.whl", hash = "sha256:f6984a24db30548fd39a44360532898c33528b74aedf81c26cf29c51ee47057e", size = 145853, upload-time = "2025-09-25T19:49:25.702Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/2d/df/9714173403c7e8b245acf8e4be8876aac64a209d1b392af457c79e60492e/bcrypt-5.0.0-cp313-cp313t-win_arm64.whl", hash = "sha256:9fffdb387abe6aa775af36ef16f55e318dcda4194ddbf82007a6f21da29de8f5", size = 139626, upload-time = "2025-09-25T19:49:26.928Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/f8/14/c18006f91816606a4abe294ccc5d1e6f0e42304df5a33710e9e8e95416e1/bcrypt-5.0.0-cp314-cp314t-macosx_10_12_universal2.whl", hash = "sha256:4870a52610537037adb382444fefd3706d96d663ac44cbb2f37e3919dca3d7ef", size = 481862, upload-time = "2025-09-25T19:49:28.365Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/67/49/dd074d831f00e589537e07a0725cf0e220d1f0d5d8e85ad5bbff251c45aa/bcrypt-5.0.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:48f753100931605686f74e27a7b49238122aa761a9aefe9373265b8b7aa43ea4", size = 268544, upload-time = "2025-09-25T19:49:30.39Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/f5/91/50ccba088b8c474545b034a1424d05195d9fcbaaf802ab8bfe2be5a4e0d7/bcrypt-5.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:f70aadb7a809305226daedf75d90379c397b094755a710d7014b8b117df1ebbf", size = 271787, upload-time = "2025-09-25T19:49:32.144Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/aa/e7/d7dba133e02abcda3b52087a7eea8c0d4f64d3e593b4fffc10c31b7061f3/bcrypt-5.0.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:744d3c6b164caa658adcb72cb8cc9ad9b4b75c7db507ab4bc2480474a51989da", size = 269753, upload-time = "2025-09-25T19:49:33.885Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/33/fc/5b145673c4b8d01018307b5c2c1fc87a6f5a436f0ad56607aee389de8ee3/bcrypt-5.0.0-cp314-cp314t-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:a28bc05039bdf3289d757f49d616ab3efe8cf40d8e8001ccdd621cd4f98f4fc9", size = 289587, upload-time = "2025-09-25T19:49:35.144Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/27/d7/1ff22703ec6d4f90e62f1a5654b8867ef96bafb8e8102c2288333e1a6ca6/bcrypt-5.0.0-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:7f277a4b3390ab4bebe597800a90da0edae882c6196d3038a73adf446c4f969f", size = 272178, upload-time = "2025-09-25T19:49:36.793Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/c8/88/815b6d558a1e4d40ece04a2f84865b0fef233513bd85fd0e40c294272d62/bcrypt-5.0.0-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:79cfa161eda8d2ddf29acad370356b47f02387153b11d46042e93a0a95127493", size = 269295, upload-time = "2025-09-25T19:49:38.164Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/51/8c/e0db387c79ab4931fc89827d37608c31cc57b6edc08ccd2386139028dc0d/bcrypt-5.0.0-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:a5393eae5722bcef046a990b84dff02b954904c36a194f6cfc817d7dca6c6f0b", size = 271700, upload-time = "2025-09-25T19:49:39.917Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/06/83/1570edddd150f572dbe9fc00f6203a89fc7d4226821f67328a85c330f239/bcrypt-5.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:7f4c94dec1b5ab5d522750cb059bb9409ea8872d4494fd152b53cca99f1ddd8c", size = 334034, upload-time = "2025-09-25T19:49:41.227Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/c9/f2/ea64e51a65e56ae7a8a4ec236c2bfbdd4b23008abd50ac33fbb2d1d15424/bcrypt-5.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:0cae4cb350934dfd74c020525eeae0a5f79257e8a201c0c176f4b84fdbf2a4b4", size = 352766, upload-time = "2025-09-25T19:49:43.08Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d7/d4/1a388d21ee66876f27d1a1f41287897d0c0f1712ef97d395d708ba93004c/bcrypt-5.0.0-cp314-cp314t-win32.whl", hash = "sha256:b17366316c654e1ad0306a6858e189fc835eca39f7eb2cafd6aaca8ce0c40a2e", size = 152449, upload-time = "2025-09-25T19:49:44.971Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/3f/61/3291c2243ae0229e5bca5d19f4032cecad5dfb05a2557169d3a69dc0ba91/bcrypt-5.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:92864f54fb48b4c718fc92a32825d0e42265a627f956bc0361fe869f1adc3e7d", size = 149310, upload-time = "2025-09-25T19:49:46.162Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/3e/89/4b01c52ae0c1a681d4021e5dd3e45b111a8fb47254a274fa9a378d8d834b/bcrypt-5.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:dd19cf5184a90c873009244586396a6a884d591a5323f0e8a5922560718d4993", size = 143761, upload-time = "2025-09-25T19:49:47.345Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/84/29/6237f151fbfe295fe3e074ecc6d44228faa1e842a81f6d34a02937ee1736/bcrypt-5.0.0-cp38-abi3-macosx_10_12_universal2.whl", hash = "sha256:fc746432b951e92b58317af8e0ca746efe93e66555f1b40888865ef5bf56446b", size = 494553, upload-time = "2025-09-25T19:49:49.006Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/45/b6/4c1205dde5e464ea3bd88e8742e19f899c16fa8916fb8510a851fae985b5/bcrypt-5.0.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:c2388ca94ffee269b6038d48747f4ce8df0ffbea43f31abfa18ac72f0218effb", size = 275009, upload-time = "2025-09-25T19:49:50.581Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/3b/71/427945e6ead72ccffe77894b2655b695ccf14ae1866cd977e185d606dd2f/bcrypt-5.0.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:560ddb6ec730386e7b3b26b8b4c88197aaed924430e7b74666a586ac997249ef", size = 278029, upload-time = "2025-09-25T19:49:52.533Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/17/72/c344825e3b83c5389a369c8a8e58ffe1480b8a699f46c127c34580c4666b/bcrypt-5.0.0-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:d79e5c65dcc9af213594d6f7f1fa2c98ad3fc10431e7aa53c176b441943efbdd", size = 275907, upload-time = "2025-09-25T19:49:54.709Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/0b/7e/d4e47d2df1641a36d1212e5c0514f5291e1a956a7749f1e595c07a972038/bcrypt-5.0.0-cp38-abi3-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:2b732e7d388fa22d48920baa267ba5d97cca38070b69c0e2d37087b381c681fd", size = 296500, upload-time = "2025-09-25T19:49:56.013Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/0f/c3/0ae57a68be2039287ec28bc463b82e4b8dc23f9d12c0be331f4782e19108/bcrypt-5.0.0-cp38-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:0c8e093ea2532601a6f686edbc2c6b2ec24131ff5c52f7610dd64fa4553b5464", size = 278412, upload-time = "2025-09-25T19:49:57.356Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/45/2b/77424511adb11e6a99e3a00dcc7745034bee89036ad7d7e255a7e47be7d8/bcrypt-5.0.0-cp38-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:5b1589f4839a0899c146e8892efe320c0fa096568abd9b95593efac50a87cb75", size = 275486, upload-time = "2025-09-25T19:49:59.116Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/43/0a/405c753f6158e0f3f14b00b462d8bca31296f7ecfc8fc8bc7919c0c7d73a/bcrypt-5.0.0-cp38-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:89042e61b5e808b67daf24a434d89bab164d4de1746b37a8d173b6b14f3db9ff", size = 277940, upload-time = "2025-09-25T19:50:00.869Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/62/83/b3efc285d4aadc1fa83db385ec64dcfa1707e890eb42f03b127d66ac1b7b/bcrypt-5.0.0-cp38-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:e3cf5b2560c7b5a142286f69bde914494b6d8f901aaa71e453078388a50881c4", size = 310776, upload-time = "2025-09-25T19:50:02.393Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/95/7d/47ee337dacecde6d234890fe929936cb03ebc4c3a7460854bbd9c97780b8/bcrypt-5.0.0-cp38-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:f632fd56fc4e61564f78b46a2269153122db34988e78b6be8b32d28507b7eaeb", size = 312922, upload-time = "2025-09-25T19:50:04.232Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d6/3a/43d494dfb728f55f4e1cf8fd435d50c16a2d75493225b54c8d06122523c6/bcrypt-5.0.0-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:801cad5ccb6b87d1b430f183269b94c24f248dddbbc5c1f78b6ed231743e001c", size = 341367, upload-time = "2025-09-25T19:50:05.559Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/55/ab/a0727a4547e383e2e22a630e0f908113db37904f58719dc48d4622139b5c/bcrypt-5.0.0-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:3cf67a804fc66fc217e6914a5635000259fbbbb12e78a99488e4d5ba445a71eb", size = 359187, upload-time = "2025-09-25T19:50:06.916Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/1b/bb/461f352fdca663524b4643d8b09e8435b4990f17fbf4fea6bc2a90aa0cc7/bcrypt-5.0.0-cp38-abi3-win32.whl", hash = "sha256:3abeb543874b2c0524ff40c57a4e14e5d3a66ff33fb423529c88f180fd756538", size = 153752, upload-time = "2025-09-25T19:50:08.515Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/41/aa/4190e60921927b7056820291f56fc57d00d04757c8b316b2d3c0d1d6da2c/bcrypt-5.0.0-cp38-abi3-win_amd64.whl", hash = "sha256:35a77ec55b541e5e583eb3436ffbbf53b0ffa1fa16ca6782279daf95d146dcd9", size = 150881, upload-time = "2025-09-25T19:50:09.742Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/54/12/cd77221719d0b39ac0b55dbd39358db1cd1246e0282e104366ebbfb8266a/bcrypt-5.0.0-cp38-abi3-win_arm64.whl", hash = "sha256:cde08734f12c6a4e28dc6755cd11d3bdfea608d93d958fffbe95a7026ebe4980", size = 144931, upload-time = "2025-09-25T19:50:11.016Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/5d/ba/2af136406e1c3839aea9ecadc2f6be2bcd1eff255bd451dd39bcf302c47a/bcrypt-5.0.0-cp39-abi3-macosx_10_12_universal2.whl", hash = "sha256:0c418ca99fd47e9c59a301744d63328f17798b5947b0f791e9af3c1c499c2d0a", size = 495313, upload-time = "2025-09-25T19:50:12.309Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ac/ee/2f4985dbad090ace5ad1f7dd8ff94477fe089b5fab2040bd784a3d5f187b/bcrypt-5.0.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:ddb4e1500f6efdd402218ffe34d040a1196c072e07929b9820f363a1fd1f4191", size = 275290, upload-time = "2025-09-25T19:50:13.673Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e4/6e/b77ade812672d15cf50842e167eead80ac3514f3beacac8902915417f8b7/bcrypt-5.0.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7aeef54b60ceddb6f30ee3db090351ecf0d40ec6e2abf41430997407a46d2254", size = 278253, upload-time = "2025-09-25T19:50:15.089Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/36/c4/ed00ed32f1040f7990dac7115f82273e3c03da1e1a1587a778d8cea496d8/bcrypt-5.0.0-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:f0ce778135f60799d89c9693b9b398819d15f1921ba15fe719acb3178215a7db", size = 276084, upload-time = "2025-09-25T19:50:16.699Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e7/c4/fa6e16145e145e87f1fa351bbd54b429354fd72145cd3d4e0c5157cf4c70/bcrypt-5.0.0-cp39-abi3-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:a71f70ee269671460b37a449f5ff26982a6f2ba493b3eabdd687b4bf35f875ac", size = 297185, upload-time = "2025-09-25T19:50:18.525Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/24/b4/11f8a31d8b67cca3371e046db49baa7c0594d71eb40ac8121e2fc0888db0/bcrypt-5.0.0-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:f8429e1c410b4073944f03bd778a9e066e7fad723564a52ff91841d278dfc822", size = 278656, upload-time = "2025-09-25T19:50:19.809Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ac/31/79f11865f8078e192847d2cb526e3fa27c200933c982c5b2869720fa5fce/bcrypt-5.0.0-cp39-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:edfcdcedd0d0f05850c52ba3127b1fce70b9f89e0fe5ff16517df7e81fa3cbb8", size = 275662, upload-time = "2025-09-25T19:50:21.567Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d4/8d/5e43d9584b3b3591a6f9b68f755a4da879a59712981ef5ad2a0ac1379f7a/bcrypt-5.0.0-cp39-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:611f0a17aa4a25a69362dcc299fda5c8a3d4f160e2abb3831041feb77393a14a", size = 278240, upload-time = "2025-09-25T19:50:23.305Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/89/48/44590e3fc158620f680a978aafe8f87a4c4320da81ed11552f0323aa9a57/bcrypt-5.0.0-cp39-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:db99dca3b1fdc3db87d7c57eac0c82281242d1eabf19dcb8a6b10eb29a2e72d1", size = 311152, upload-time = "2025-09-25T19:50:24.597Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/5f/85/e4fbfc46f14f47b0d20493669a625da5827d07e8a88ee460af6cd9768b44/bcrypt-5.0.0-cp39-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:5feebf85a9cefda32966d8171f5db7e3ba964b77fdfe31919622256f80f9cf42", size = 313284, upload-time = "2025-09-25T19:50:26.268Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/25/ae/479f81d3f4594456a01ea2f05b132a519eff9ab5768a70430fa1132384b1/bcrypt-5.0.0-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:3ca8a166b1140436e058298a34d88032ab62f15aae1c598580333dc21d27ef10", size = 341643, upload-time = "2025-09-25T19:50:28.02Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/df/d2/36a086dee1473b14276cd6ea7f61aef3b2648710b5d7f1c9e032c29b859f/bcrypt-5.0.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:61afc381250c3182d9078551e3ac3a41da14154fbff647ddf52a769f588c4172", size = 359698, upload-time = "2025-09-25T19:50:31.347Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/c0/f6/688d2cd64bfd0b14d805ddb8a565e11ca1fb0fd6817175d58b10052b6d88/bcrypt-5.0.0-cp39-abi3-win32.whl", hash = "sha256:64d7ce196203e468c457c37ec22390f1a61c85c6f0b8160fd752940ccfb3a683", size = 153725, upload-time = "2025-09-25T19:50:34.384Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/9f/b9/9d9a641194a730bda138b3dfe53f584d61c58cd5230e37566e83ec2ffa0d/bcrypt-5.0.0-cp39-abi3-win_amd64.whl", hash = "sha256:64ee8434b0da054d830fa8e89e1c8bf30061d539044a39524ff7dec90481e5c2", size = 150912, upload-time = "2025-09-25T19:50:35.69Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/27/44/d2ef5e87509158ad2187f4dd0852df80695bb1ee0cfe0a684727b01a69e0/bcrypt-5.0.0-cp39-abi3-win_arm64.whl", hash = "sha256:f2347d3534e76bf50bca5500989d6c1d05ed64b440408057a37673282c654927", size = 144953, upload-time = "2025-09-25T19:50:37.32Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/8a/75/4aa9f5a4d40d762892066ba1046000b329c7cd58e888a6db878019b282dc/bcrypt-5.0.0-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:7edda91d5ab52b15636d9c30da87d2cc84f426c72b9dba7a9b4fe142ba11f534", size = 271180, upload-time = "2025-09-25T19:50:38.575Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/54/79/875f9558179573d40a9cc743038ac2bf67dfb79cecb1e8b5d70e88c94c3d/bcrypt-5.0.0-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:046ad6db88edb3c5ece4369af997938fb1c19d6a699b9c1b27b0db432faae4c4", size = 273791, upload-time = "2025-09-25T19:50:39.913Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/bc/fe/975adb8c216174bf70fc17535f75e85ac06ed5252ea077be10d9cff5ce24/bcrypt-5.0.0-pp311-pypy311_pp73-manylinux_2_34_aarch64.whl", hash = "sha256:dcd58e2b3a908b5ecc9b9df2f0085592506ac2d5110786018ee5e160f28e0911", size = 270746, upload-time = "2025-09-25T19:50:43.306Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e4/f8/972c96f5a2b6c4b3deca57009d93e946bbdbe2241dca9806d502f29dd3ee/bcrypt-5.0.0-pp311-pypy311_pp73-manylinux_2_34_x86_64.whl", hash = "sha256:6b8f520b61e8781efee73cba14e3e8c9556ccfb375623f4f97429544734545b4", size = 273375, upload-time = "2025-09-25T19:50:45.43Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "certifi"
|
name = "certifi"
|
||||||
version = "2026.1.4"
|
version = "2026.1.4"
|
||||||
@@ -305,7 +235,7 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastapi"
|
name = "fastapi"
|
||||||
version = "0.135.3"
|
version = "0.135.1"
|
||||||
source = { registry = "https://pypi.org/simple" }
|
source = { registry = "https://pypi.org/simple" }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "annotated-doc" },
|
{ name = "annotated-doc" },
|
||||||
@@ -314,14 +244,14 @@ dependencies = [
|
|||||||
{ name = "typing-extensions" },
|
{ name = "typing-extensions" },
|
||||||
{ name = "typing-inspection" },
|
{ name = "typing-inspection" },
|
||||||
]
|
]
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/f7/e6/7adb4c5fa231e82c35b8f5741a9f2d055f520c29af5546fd70d3e8e1cd2e/fastapi-0.135.3.tar.gz", hash = "sha256:bd6d7caf1a2bdd8d676843cdcd2287729572a1ef524fc4d65c17ae002a1be654", size = 396524, upload-time = "2026-04-01T16:23:58.188Z" }
|
sdist = { url = "https://files.pythonhosted.org/packages/e7/7b/f8e0211e9380f7195ba3f3d40c292594fd81ba8ec4629e3854c353aaca45/fastapi-0.135.1.tar.gz", hash = "sha256:d04115b508d936d254cea545b7312ecaa58a7b3a0f84952535b4c9afae7668cd", size = 394962, upload-time = "2026-03-01T18:18:29.369Z" }
|
||||||
wheels = [
|
wheels = [
|
||||||
{ url = "https://files.pythonhosted.org/packages/84/a4/5caa2de7f917a04ada20018eccf60d6cc6145b0199d55ca3711b0fc08312/fastapi-0.135.3-py3-none-any.whl", hash = "sha256:9b0f590c813acd13d0ab43dd8494138eb58e484bfac405db1f3187cfc5810d98", size = 117734, upload-time = "2026-04-01T16:23:59.328Z" },
|
{ url = "https://files.pythonhosted.org/packages/e4/72/42e900510195b23a56bde950d26a51f8b723846bfcaa0286e90287f0422b/fastapi-0.135.1-py3-none-any.whl", hash = "sha256:46e2fc5745924b7c840f71ddd277382af29ce1cdb7d5eab5bf697e3fb9999c9e", size = 116999, upload-time = "2026-03-01T18:18:30.831Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastapi-toolsets"
|
name = "fastapi-toolsets"
|
||||||
version = "3.0.3"
|
version = "2.4.3"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "asyncpg" },
|
{ name = "asyncpg" },
|
||||||
@@ -352,7 +282,6 @@ pytest = [
|
|||||||
|
|
||||||
[package.dev-dependencies]
|
[package.dev-dependencies]
|
||||||
dev = [
|
dev = [
|
||||||
{ name = "bcrypt" },
|
|
||||||
{ name = "coverage" },
|
{ name = "coverage" },
|
||||||
{ name = "fastapi-toolsets", extra = ["all"] },
|
{ name = "fastapi-toolsets", extra = ["all"] },
|
||||||
{ name = "httpx" },
|
{ name = "httpx" },
|
||||||
@@ -372,9 +301,6 @@ docs = [
|
|||||||
{ name = "mkdocstrings-python" },
|
{ name = "mkdocstrings-python" },
|
||||||
{ name = "zensical" },
|
{ name = "zensical" },
|
||||||
]
|
]
|
||||||
docs-src = [
|
|
||||||
{ name = "bcrypt" },
|
|
||||||
]
|
|
||||||
tests = [
|
tests = [
|
||||||
{ name = "coverage" },
|
{ name = "coverage" },
|
||||||
{ name = "httpx" },
|
{ name = "httpx" },
|
||||||
@@ -401,7 +327,6 @@ provides-extras = ["cli", "metrics", "pytest", "all"]
|
|||||||
|
|
||||||
[package.metadata.requires-dev]
|
[package.metadata.requires-dev]
|
||||||
dev = [
|
dev = [
|
||||||
{ name = "bcrypt", specifier = ">=4.0.0" },
|
|
||||||
{ name = "coverage", specifier = ">=7.0.0" },
|
{ name = "coverage", specifier = ">=7.0.0" },
|
||||||
{ name = "fastapi-toolsets", extras = ["all"] },
|
{ name = "fastapi-toolsets", extras = ["all"] },
|
||||||
{ name = "httpx", specifier = ">=0.25.0" },
|
{ name = "httpx", specifier = ">=0.25.0" },
|
||||||
@@ -421,7 +346,6 @@ docs = [
|
|||||||
{ name = "mkdocstrings-python", specifier = ">=2.0.2" },
|
{ name = "mkdocstrings-python", specifier = ">=2.0.2" },
|
||||||
{ name = "zensical", specifier = ">=0.0.30" },
|
{ name = "zensical", specifier = ">=0.0.30" },
|
||||||
]
|
]
|
||||||
docs-src = [{ name = "bcrypt", specifier = ">=4.0.0" }]
|
|
||||||
tests = [
|
tests = [
|
||||||
{ name = "coverage", specifier = ">=7.0.0" },
|
{ name = "coverage", specifier = ">=7.0.0" },
|
||||||
{ name = "httpx", specifier = ">=0.25.0" },
|
{ name = "httpx", specifier = ">=0.25.0" },
|
||||||
@@ -970,15 +894,15 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pymdown-extensions"
|
name = "pymdown-extensions"
|
||||||
version = "10.21.2"
|
version = "10.21"
|
||||||
source = { registry = "https://pypi.org/simple" }
|
source = { registry = "https://pypi.org/simple" }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "markdown" },
|
{ name = "markdown" },
|
||||||
{ name = "pyyaml" },
|
{ name = "pyyaml" },
|
||||||
]
|
]
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/df/08/f1c908c581fd11913da4711ea7ba32c0eee40b0190000996bb863b0c9349/pymdown_extensions-10.21.2.tar.gz", hash = "sha256:c3f55a5b8a1d0edf6699e35dcbea71d978d34ff3fa79f3d807b8a5b3fa90fbdc", size = 853922, upload-time = "2026-03-29T15:01:55.233Z" }
|
sdist = { url = "https://files.pythonhosted.org/packages/ba/63/06673d1eb6d8f83c0ea1f677d770e12565fb516928b4109c9e2055656a9e/pymdown_extensions-10.21.tar.gz", hash = "sha256:39f4a020f40773f6b2ff31d2cd2546c2c04d0a6498c31d9c688d2be07e1767d5", size = 853363, upload-time = "2026-02-15T20:44:06.748Z" }
|
||||||
wheels = [
|
wheels = [
|
||||||
{ url = "https://files.pythonhosted.org/packages/f7/27/a2fc51a4a122dfd1015e921ae9d22fee3d20b0b8080d9a704578bf9deece/pymdown_extensions-10.21.2-py3-none-any.whl", hash = "sha256:5c0fd2a2bea14eb39af8ff284f1066d898ab2187d81b889b75d46d4348c01638", size = 268901, upload-time = "2026-03-29T15:01:53.244Z" },
|
{ url = "https://files.pythonhosted.org/packages/6f/2c/5b079febdc65e1c3fb2729bf958d18b45be7113828528e8a0b5850dd819a/pymdown_extensions-10.21-py3-none-any.whl", hash = "sha256:91b879f9f864d49794c2d9534372b10150e6141096c3908a455e45ca72ad9d3f", size = 268877, upload-time = "2026-02-15T20:44:05.464Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1140,27 +1064,27 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruff"
|
name = "ruff"
|
||||||
version = "0.15.8"
|
version = "0.15.7"
|
||||||
source = { registry = "https://pypi.org/simple" }
|
source = { registry = "https://pypi.org/simple" }
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/14/b0/73cf7550861e2b4824950b8b52eebdcc5adc792a00c514406556c5b80817/ruff-0.15.8.tar.gz", hash = "sha256:995f11f63597ee362130d1d5a327a87cb6f3f5eae3094c620bcc632329a4d26e", size = 4610921, upload-time = "2026-03-26T18:39:38.675Z" }
|
sdist = { url = "https://files.pythonhosted.org/packages/a1/22/9e4f66ee588588dc6c9af6a994e12d26e19efbe874d1a909d09a6dac7a59/ruff-0.15.7.tar.gz", hash = "sha256:04f1ae61fc20fe0b148617c324d9d009b5f63412c0b16474f3d5f1a1a665f7ac", size = 4601277, upload-time = "2026-03-19T16:26:22.605Z" }
|
||||||
wheels = [
|
wheels = [
|
||||||
{ url = "https://files.pythonhosted.org/packages/4a/92/c445b0cd6da6e7ae51e954939cb69f97e008dbe750cfca89b8cedc081be7/ruff-0.15.8-py3-none-linux_armv6l.whl", hash = "sha256:cbe05adeba76d58162762d6b239c9056f1a15a55bd4b346cfd21e26cd6ad7bc7", size = 10527394, upload-time = "2026-03-26T18:39:41.566Z" },
|
{ url = "https://files.pythonhosted.org/packages/41/2f/0b08ced94412af091807b6119ca03755d651d3d93a242682bf020189db94/ruff-0.15.7-py3-none-linux_armv6l.whl", hash = "sha256:a81cc5b6910fb7dfc7c32d20652e50fa05963f6e13ead3c5915c41ac5d16668e", size = 10489037, upload-time = "2026-03-19T16:26:32.47Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/eb/92/f1c662784d149ad1414cae450b082cf736430c12ca78367f20f5ed569d65/ruff-0.15.8-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:d3e3d0b6ba8dca1b7ef9ab80a28e840a20070c4b62e56d675c24f366ef330570", size = 10905693, upload-time = "2026-03-26T18:39:30.364Z" },
|
{ url = "https://files.pythonhosted.org/packages/91/4a/82e0fa632e5c8b1eba5ee86ecd929e8ff327bbdbfb3c6ac5d81631bef605/ruff-0.15.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:722d165bd52403f3bdabc0ce9e41fc47070ac56d7a91b4e0d097b516a53a3477", size = 10955433, upload-time = "2026-03-19T16:27:00.205Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/ca/f2/7a631a8af6d88bcef997eb1bf87cc3da158294c57044aafd3e17030613de/ruff-0.15.8-py3-none-macosx_11_0_arm64.whl", hash = "sha256:6ee3ae5c65a42f273f126686353f2e08ff29927b7b7e203b711514370d500de3", size = 10323044, upload-time = "2026-03-26T18:39:33.37Z" },
|
{ url = "https://files.pythonhosted.org/packages/ab/10/12586735d0ff42526ad78c049bf51d7428618c8b5c467e72508c694119df/ruff-0.15.7-py3-none-macosx_11_0_arm64.whl", hash = "sha256:7fbc2448094262552146cbe1b9643a92f66559d3761f1ad0656d4991491af49e", size = 10269302, upload-time = "2026-03-19T16:26:26.183Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/67/18/1bf38e20914a05e72ef3b9569b1d5c70a7ef26cd188d69e9ca8ef588d5bf/ruff-0.15.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fdce027ada77baa448077ccc6ebb2fa9c3c62fd110d8659d601cf2f475858d94", size = 10629135, upload-time = "2026-03-26T18:39:44.142Z" },
|
{ url = "https://files.pythonhosted.org/packages/eb/5d/32b5c44ccf149a26623671df49cbfbd0a0ae511ff3df9d9d2426966a8d57/ruff-0.15.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6b39329b60eba44156d138275323cc726bbfbddcec3063da57caa8a8b1d50adf", size = 10607625, upload-time = "2026-03-19T16:27:03.263Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/d2/e9/138c150ff9af60556121623d41aba18b7b57d95ac032e177b6a53789d279/ruff-0.15.8-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:12e617fc01a95e5821648a6df341d80456bd627bfab8a829f7cfc26a14a4b4a3", size = 10348041, upload-time = "2026-03-26T18:39:52.178Z" },
|
{ url = "https://files.pythonhosted.org/packages/5d/f1/f0001cabe86173aaacb6eb9bb734aa0605f9a6aa6fa7d43cb49cbc4af9c9/ruff-0.15.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:87768c151808505f2bfc93ae44e5f9e7c8518943e5074f76ac21558ef5627c85", size = 10324743, upload-time = "2026-03-19T16:27:09.791Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/02/f1/5bfb9298d9c323f842c5ddeb85f1f10ef51516ac7a34ba446c9347d898df/ruff-0.15.8-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:432701303b26416d22ba696c39f2c6f12499b89093b61360abc34bcc9bf07762", size = 11121987, upload-time = "2026-03-26T18:39:55.195Z" },
|
{ url = "https://files.pythonhosted.org/packages/7a/87/b8a8f3d56b8d848008559e7c9d8bf367934d5367f6d932ba779456e2f73b/ruff-0.15.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fb0511670002c6c529ec66c0e30641c976c8963de26a113f3a30456b702468b0", size = 11138536, upload-time = "2026-03-19T16:27:06.101Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/10/11/6da2e538704e753c04e8d86b1fc55712fdbdcc266af1a1ece7a51fff0d10/ruff-0.15.8-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d910ae974b7a06a33a057cb87d2a10792a3b2b3b35e33d2699fdf63ec8f6b17a", size = 11951057, upload-time = "2026-03-26T18:39:19.18Z" },
|
{ url = "https://files.pythonhosted.org/packages/e4/f2/4fd0d05aab0c5934b2e1464784f85ba2eab9d54bffc53fb5430d1ed8b829/ruff-0.15.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e0d19644f801849229db8345180a71bee5407b429dd217f853ec515e968a6912", size = 11994292, upload-time = "2026-03-19T16:26:48.718Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/83/f0/c9208c5fd5101bf87002fed774ff25a96eea313d305f1e5d5744698dc314/ruff-0.15.8-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2033f963c43949d51e6fdccd3946633c6b37c484f5f98c3035f49c27395a8ab8", size = 11464613, upload-time = "2026-03-26T18:40:06.301Z" },
|
{ url = "https://files.pythonhosted.org/packages/64/22/fc4483871e767e5e95d1622ad83dad5ebb830f762ed0420fde7dfa9d9b08/ruff-0.15.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4806d8e09ef5e84eb19ba833d0442f7e300b23fe3f0981cae159a248a10f0036", size = 11398981, upload-time = "2026-03-19T16:26:54.513Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/f8/22/d7f2fabdba4fae9f3b570e5605d5eb4500dcb7b770d3217dca4428484b17/ruff-0.15.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f29b989a55572fb885b77464cf24af05500806ab4edf9a0fd8977f9759d85b1", size = 11257557, upload-time = "2026-03-26T18:39:57.972Z" },
|
{ url = "https://files.pythonhosted.org/packages/b0/99/66f0343176d5eab02c3f7fcd2de7a8e0dd7a41f0d982bee56cd1c24db62b/ruff-0.15.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dce0896488562f09a27b9c91b1f58a097457143931f3c4d519690dea54e624c5", size = 11242422, upload-time = "2026-03-19T16:26:29.277Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/71/8c/382a9620038cf6906446b23ce8632ab8c0811b8f9d3e764f58bedd0c9a6f/ruff-0.15.8-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:ac51d486bf457cdc985a412fb1801b2dfd1bd8838372fc55de64b1510eff4bec", size = 11169440, upload-time = "2026-03-26T18:39:22.205Z" },
|
{ url = "https://files.pythonhosted.org/packages/5d/3a/a7060f145bfdcce4c987ea27788b30c60e2c81d6e9a65157ca8afe646328/ruff-0.15.7-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:1852ce241d2bc89e5dc823e03cff4ce73d816b5c6cdadd27dbfe7b03217d2a12", size = 11232158, upload-time = "2026-03-19T16:26:42.321Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/4d/0d/0994c802a7eaaf99380085e4e40c845f8e32a562e20a38ec06174b52ef24/ruff-0.15.8-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:c9861eb959edab053c10ad62c278835ee69ca527b6dcd72b47d5c1e5648964f6", size = 10605963, upload-time = "2026-03-26T18:39:46.682Z" },
|
{ url = "https://files.pythonhosted.org/packages/a7/53/90fbb9e08b29c048c403558d3cdd0adf2668b02ce9d50602452e187cd4af/ruff-0.15.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:5f3e4b221fb4bd293f79912fc5e93a9063ebd6d0dcbd528f91b89172a9b8436c", size = 10577861, upload-time = "2026-03-19T16:26:57.459Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/19/aa/d624b86f5b0aad7cef6bbf9cd47a6a02dfdc4f72c92a337d724e39c9d14b/ruff-0.15.8-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:8d9a5b8ea13f26ae90838afc33f91b547e61b794865374f114f349e9036835fb", size = 10357484, upload-time = "2026-03-26T18:39:49.176Z" },
|
{ url = "https://files.pythonhosted.org/packages/2f/aa/5f486226538fe4d0f0439e2da1716e1acf895e2a232b26f2459c55f8ddad/ruff-0.15.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:b15e48602c9c1d9bdc504b472e90b90c97dc7d46c7028011ae67f3861ceba7b4", size = 10327310, upload-time = "2026-03-19T16:26:35.909Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/35/c3/e0b7835d23001f7d999f3895c6b569927c4d39912286897f625736e1fd04/ruff-0.15.8-py3-none-musllinux_1_2_i686.whl", hash = "sha256:c2a33a529fb3cbc23a7124b5c6ff121e4d6228029cba374777bd7649cc8598b8", size = 10830426, upload-time = "2026-03-26T18:40:03.702Z" },
|
{ url = "https://files.pythonhosted.org/packages/99/9e/271afdffb81fe7bfc8c43ba079e9d96238f674380099457a74ccb3863857/ruff-0.15.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:1b4705e0e85cedc74b0a23cf6a179dbb3df184cb227761979cc76c0440b5ab0d", size = 10840752, upload-time = "2026-03-19T16:26:45.723Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/f0/51/ab20b322f637b369383adc341d761eaaa0f0203d6b9a7421cd6e783d81b9/ruff-0.15.8-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:75e5cd06b1cf3f47a3996cfc999226b19aa92e7cce682dcd62f80d7035f98f49", size = 11345125, upload-time = "2026-03-26T18:39:27.799Z" },
|
{ url = "https://files.pythonhosted.org/packages/bf/29/a4ae78394f76c7759953c47884eb44de271b03a66634148d9f7d11e721bd/ruff-0.15.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:112c1fa316a558bb34319282c1200a8bf0495f1b735aeb78bfcb2991e6087580", size = 11336961, upload-time = "2026-03-19T16:26:39.076Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/37/e6/90b2b33419f59d0f2c4c8a48a4b74b460709a557e8e0064cf33ad894f983/ruff-0.15.8-py3-none-win32.whl", hash = "sha256:bc1f0a51254ba21767bfa9a8b5013ca8149dcf38092e6a9eb704d876de94dc34", size = 10571959, upload-time = "2026-03-26T18:39:36.117Z" },
|
{ url = "https://files.pythonhosted.org/packages/26/6b/8786ba5736562220d588a2f6653e6c17e90c59ced34a2d7b512ef8956103/ruff-0.15.7-py3-none-win32.whl", hash = "sha256:6d39e2d3505b082323352f733599f28169d12e891f7dd407f2d4f54b4c2886de", size = 10582538, upload-time = "2026-03-19T16:26:15.992Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/1f/a2/ef467cb77099062317154c63f234b8a7baf7cb690b99af760c5b68b9ee7f/ruff-0.15.8-py3-none-win_amd64.whl", hash = "sha256:04f79eff02a72db209d47d665ba7ebcad609d8918a134f86cb13dd132159fc89", size = 11743893, upload-time = "2026-03-26T18:39:25.01Z" },
|
{ url = "https://files.pythonhosted.org/packages/2b/e9/346d4d3fffc6871125e877dae8d9a1966b254fbd92a50f8561078b88b099/ruff-0.15.7-py3-none-win_amd64.whl", hash = "sha256:4d53d712ddebcd7dace1bc395367aec12c057aacfe9adbb6d832302575f4d3a1", size = 11755839, upload-time = "2026-03-19T16:26:19.897Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/15/e2/77be4fff062fa78d9b2a4dea85d14785dac5f1d0c1fb58ed52331f0ebe28/ruff-0.15.8-py3-none-win_arm64.whl", hash = "sha256:cf891fa8e3bb430c0e7fac93851a5978fc99c8fa2c053b57b118972866f8e5f2", size = 11048175, upload-time = "2026-03-26T18:40:01.06Z" },
|
{ url = "https://files.pythonhosted.org/packages/8f/e8/726643a3ea68c727da31570bde48c7a10f1aa60eddd628d94078fec586ff/ruff-0.15.7-py3-none-win_arm64.whl", hash = "sha256:18e8d73f1c3fdf27931497972250340f92e8c861722161a9caeb89a58ead6ed2", size = 11023304, upload-time = "2026-03-19T16:26:51.669Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1304,26 +1228,26 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ty"
|
name = "ty"
|
||||||
version = "0.0.27"
|
version = "0.0.25"
|
||||||
source = { registry = "https://pypi.org/simple" }
|
source = { registry = "https://pypi.org/simple" }
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/f4/de/e5cf1f151cf52fe1189e42d03d90909d7d1354fdc0c1847cbb63a0baa3da/ty-0.0.27.tar.gz", hash = "sha256:d7a8de3421d92420b40c94fe7e7d4816037560621903964dd035cf9bd0204a73", size = 5424130, upload-time = "2026-03-31T19:07:20.806Z" }
|
sdist = { url = "https://files.pythonhosted.org/packages/12/bf/3c3147c7237277b0e8a911ff89de7183408be96b31fb42b38edb666d287f/ty-0.0.25.tar.gz", hash = "sha256:8ae3891be17dfb6acab51a2df3a8f8f6c551eb60ea674c10946dc92aae8d4401", size = 5375500, upload-time = "2026-03-24T22:32:34.608Z" }
|
||||||
wheels = [
|
wheels = [
|
||||||
{ url = "https://files.pythonhosted.org/packages/fa/20/2a9ea661758bd67f2bfd54ce9daacb5a26c56c5f8b49fbd9a43b365a8a7d/ty-0.0.27-py3-none-linux_armv6l.whl", hash = "sha256:eb14456b8611c9e8287aa9b633f4d2a0d9f3082a31796969e0b50bdda8930281", size = 10571211, upload-time = "2026-03-31T19:07:23.28Z" },
|
{ url = "https://files.pythonhosted.org/packages/97/a4/6c289cbd1474285223124a4ffb55c078dbe9ae1d925d0b6a948643c7f115/ty-0.0.25-py3-none-linux_armv6l.whl", hash = "sha256:26d6d5aede5d54fb055779460f896d9c1473c6fb996716bd11cb90f027d8fee7", size = 10452747, upload-time = "2026-03-24T22:32:32.662Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/da/b2/8887a51f705d075ddbe78ae7f0d4755ef48d0a90235f67aee289e9cee950/ty-0.0.27-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:02e662184703db7586118df611cf24a000d35dae38d950053d1dd7b6736fd2c4", size = 10427576, upload-time = "2026-03-31T19:07:15.499Z" },
|
{ url = "https://files.pythonhosted.org/packages/00/13/74cb9de356b9ceb3f281ab048f8c4ac2207122161b0ac0066886ce129abe/ty-0.0.25-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:aedcfbc7b6b96dbc55b0da78fa02bd049373ff3d8a827f613dadd8bd17d10758", size = 10271349, upload-time = "2026-03-24T22:32:13.041Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/1d/c3/79d88163f508fb709ce19bc0b0a66c7c64b53d372d4caa56172c3d9b3ae8/ty-0.0.27-py3-none-macosx_11_0_arm64.whl", hash = "sha256:be5fc2899441f7f8f7ef40f9ffd006075a5ff6b06c44e8d2aa30e1b900c12f51", size = 9870359, upload-time = "2026-03-31T19:07:36.852Z" },
|
{ url = "https://files.pythonhosted.org/packages/0e/93/ffc5a20cc9e14fa9b32b0c54884864bede30d144ce2ae013805bce0c86d0/ty-0.0.25-py3-none-macosx_11_0_arm64.whl", hash = "sha256:0a8fb3c1e28f73618941811e2568dca195178a1a6314651d4ee97086a4497253", size = 9730308, upload-time = "2026-03-24T22:32:19.24Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/dc/4d/ed1b0db0e1e46b5ed4976bbfe0d1825faf003b4e3774ef28c785ed73e4bb/ty-0.0.27-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:30231e652b14742a76b64755e54bf0cb1cd4c128bcaf625222e0ca92a2094887", size = 10380488, upload-time = "2026-03-31T19:07:31.268Z" },
|
{ url = "https://files.pythonhosted.org/packages/6d/78/52e05ef32a5f172fce70633a4e19d8e04364271a4322ae12382c7344b0de/ty-0.0.25-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:814870b7f347b5d0276304cddb98a0958f08de183bf159abc920ebe321247ad4", size = 10247664, upload-time = "2026-03-24T22:32:08.669Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/b1/f2/20372f6d510b01570028433064880adec2f8abe68bf0c4603be61a560bef/ty-0.0.27-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5a119b1168f64261b3205a37e40b5b6c4aac8fd58e4587988f4e4b22c3c79847", size = 10390248, upload-time = "2026-03-31T19:07:28.345Z" },
|
{ url = "https://files.pythonhosted.org/packages/c2/64/0d0a47ed0aa1d634c666c2cc15d3b0af4b95d0fd3dbb796032bd493f3433/ty-0.0.25-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:781150e23825dc110cd5e1f50ca3d61664f7a5db5b4a55d5dbf7d3b1e246b917", size = 10261961, upload-time = "2026-03-24T22:32:43.935Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/45/4b/46b31a7311306be1a560f7f20fdc37b5bf718787f60626cd265d9b637554/ty-0.0.27-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e38f4e187b6975d2cbebf0f1eb1221f8f64f6e509bad14d7bb2a91afc97e4956", size = 10878479, upload-time = "2026-03-31T19:07:39.393Z" },
|
{ url = "https://files.pythonhosted.org/packages/3e/ba/4666b96f0499465efb97c244554107c541d74a1add393e62276b3de9b54f/ty-0.0.25-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ffc81ff2a0143911321251dc81d1c259fa5cdc56d043019a733c845d55409e2a", size = 10746076, upload-time = "2026-03-24T22:32:26.37Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/42/ba/5231a2a1fb1cebe053a25de8fded95e1a30a1e77d3628a9e58487297bafc/ty-0.0.27-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a07b1a8fbb23844f6d22091275430d9ac617175f34aa99159b268193de210389", size = 11461232, upload-time = "2026-03-31T19:07:02.518Z" },
|
{ url = "https://files.pythonhosted.org/packages/e7/ed/aa958ccbcd85cc206600e48fbf0a1c27aef54b4b90112d9a73f69ed0c739/ty-0.0.25-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f03c5c5b5c10355ea030cbe3cd93b2e759b9492c66688288ea03a68086069f2e", size = 11287331, upload-time = "2026-03-24T22:32:21.607Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/c3/37/558abab3e1f6670493524f61280b4dfcc3219555f13889223e733381dfab/ty-0.0.27-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d3ec4033031f240836bb0337274bac5c49dde312c7c6d7575451ed719bf8ffa3", size = 11133002, upload-time = "2026-03-31T19:07:18.371Z" },
|
{ url = "https://files.pythonhosted.org/packages/26/e4/f4a004e1952e6042f5bfeeb7d09cffb379270ef009d9f8568471863e86e6/ty-0.0.25-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7fc1ef49cd6262eb9223ccf6e258ac899aaa53e7dc2151ba65a2c9fa248dfa75", size = 11028804, upload-time = "2026-03-24T22:32:39.088Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/32/38/188c14a57f52160407ce62c6abb556011718fd0bcbe1dca690529ce84c46/ty-0.0.27-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:924a8849afd500d260bf5b7296165a05b7424fbb6b19113f30f3b999d682873f", size = 10986624, upload-time = "2026-03-31T19:07:13.066Z" },
|
{ url = "https://files.pythonhosted.org/packages/56/32/5c15bb8ea20ed54d43c734f253a2a5da95d41474caecf4ef3682df9f68f5/ty-0.0.25-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7ad98da1393161096235a387cc36abecd31861060c68416761eccdb7c1bc326b", size = 10845246, upload-time = "2026-03-24T22:32:41.33Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/9f/f1/667a71393f47d2cd6ba9ed07541b8df3eb63aab1f2ee658e77d91b8362fa/ty-0.0.27-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:d8270026c07e7423a1b3a3fd065b46ed1478748f0662518b523b57744f3fa025", size = 10366721, upload-time = "2026-03-31T19:07:00.131Z" },
|
{ url = "https://files.pythonhosted.org/packages/6f/fe/4ddd83e810c8682fcfada0d1c9d38936a34a024d32d7736075c1e53a038e/ty-0.0.25-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:2d4336aa5381eb4eab107c3dec75fe22943a648ef6646f5a8431ef1c8cdabb66", size = 10233515, upload-time = "2026-03-24T22:32:17.012Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/8b/aa/8edafe41be898bda774249abc5be6edd733e53fb1777d59ea9331e38537d/ty-0.0.27-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:e26e9735d3bdfd95d881111ad1cf570eab8188d8c3be36d6bcaad044d38984d8", size = 10412239, upload-time = "2026-03-31T19:07:05.297Z" },
|
{ url = "https://files.pythonhosted.org/packages/ad/db/9fe54f6fb952e5b218f2e661e64ed656512edf2046cfbb9c159558e255db/ty-0.0.25-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:e10ed39564227de2b7bd89398250b65daaedbef15a25cef8eee70078f5d9e0b2", size = 10275289, upload-time = "2026-03-24T22:32:28.21Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/53/ff/8bafaed4a18d38264f46bdfc427de7ea2974cf9064e4e0bdb1b6e6c724e3/ty-0.0.27-py3-none-musllinux_1_2_i686.whl", hash = "sha256:7c09cc9a699810609acc0090af8d0db68adaee6e60a7c3e05ab80cc954a83db7", size = 10573507, upload-time = "2026-03-31T19:06:57.064Z" },
|
{ url = "https://files.pythonhosted.org/packages/b1/e0/090d7b33791b42bc7ec29463ac6a634738e16b289e027608ebe542682773/ty-0.0.25-py3-none-musllinux_1_2_i686.whl", hash = "sha256:aca04e9ed9b61c706064a1c0b71a247c3f92f373d0222103f3bc54b649421796", size = 10461195, upload-time = "2026-03-24T22:32:24.252Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/16/2e/63a8284a2fefd08ab56ecbad0fde7dd4b2d4045a31cf24c1d1fcd9643227/ty-0.0.27-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:2d3e02853bb037221a456e034b1898aaa573e6374fbb53884e33cb7513ccb85a", size = 11090233, upload-time = "2026-03-31T19:07:34.139Z" },
|
{ url = "https://files.pythonhosted.org/packages/42/31/5bf12bce01b80b72a7a4e627380779b41510e730f6000862a1d078e423f7/ty-0.0.25-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:18a5443e4ef339c1bd8c57fc13112c22080617ea582bfc22b497d82d65361325", size = 10931471, upload-time = "2026-03-24T22:32:14.985Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/14/d3/d6fa1cafdfa2b34dbfa304fc6833af8e1669fc34e24d214fa76d2a2e5a25/ty-0.0.27-py3-none-win32.whl", hash = "sha256:34e7377f2047c14dbbb7bf5322e84114db7a5f2cb470db6bee63f8f3550cfc1e", size = 9984415, upload-time = "2026-03-31T19:07:07.98Z" },
|
{ url = "https://files.pythonhosted.org/packages/6a/5e/ab60c11f8a6dd2a0ae96daac83458ef2e9be1ae70481d1ad9c59d3eaf20f/ty-0.0.25-py3-none-win32.whl", hash = "sha256:a685b9a611b69195b5a557e05dbb7ebcd12815f6c32fb27fdf15edeb1fa33d8f", size = 9835974, upload-time = "2026-03-24T22:32:36.86Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/85/e6/dd4e27da9632b3472d5711ca49dbd3709dbd3e8c73f3af6db9c254235ca9/ty-0.0.27-py3-none-win_amd64.whl", hash = "sha256:3f7e4145aad8b815ed69b324c93b5b773eb864dda366ca16ab8693ff88ce6f36", size = 10961535, upload-time = "2026-03-31T19:07:10.566Z" },
|
{ url = "https://files.pythonhosted.org/packages/41/55/625acc2ef34646268bc2baa8fdd6e22fb47cd5965e2acd3be92c687fb6b0/ty-0.0.25-py3-none-win_amd64.whl", hash = "sha256:0d4d37a1f1ab7f2669c941c38c65144ff223eb51ececd7ccfc0d623afbc0f729", size = 10815449, upload-time = "2026-03-24T22:32:11.031Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/0e/1a/824b3496d66852ed7d5d68d9787711131552b68dce8835ce9410db32e618/ty-0.0.27-py3-none-win_arm64.whl", hash = "sha256:95bf8d01eb96bb2ba3ffc39faff19da595176448e80871a7b362f4d2de58476c", size = 10376689, upload-time = "2026-03-31T19:07:25.732Z" },
|
{ url = "https://files.pythonhosted.org/packages/82/c7/0147bfb543df97740b45b222c54ff79ef20fa57f14b9d2c1dab3cd7d3faa/ty-0.0.25-py3-none-win_arm64.whl", hash = "sha256:d80b8cd965cbacbfd887ac2d985f5b6da09b7aa3569371e2894e0b30b26b89cd", size = 10225494, upload-time = "2026-03-24T22:32:30.611Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1400,7 +1324,7 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zensical"
|
name = "zensical"
|
||||||
version = "0.0.31"
|
version = "0.0.30"
|
||||||
source = { registry = "https://pypi.org/simple" }
|
source = { registry = "https://pypi.org/simple" }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "click" },
|
{ name = "click" },
|
||||||
@@ -1410,18 +1334,18 @@ dependencies = [
|
|||||||
{ name = "pymdown-extensions" },
|
{ name = "pymdown-extensions" },
|
||||||
{ name = "pyyaml" },
|
{ name = "pyyaml" },
|
||||||
]
|
]
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/d5/1a/9b6f5285c5aef648db38f9132f49a7059bd2c9d748f68ef0c52ed8afcff3/zensical-0.0.31.tar.gz", hash = "sha256:9c12f07bde70c4bfdb13d6cae1bedf8d18064d257a6e81128a152502b28a8fc3", size = 3891758, upload-time = "2026-04-01T11:30:21.88Z" }
|
sdist = { url = "https://files.pythonhosted.org/packages/1d/53/5e551f8912718816733a75adcb53a0787b2d2edca5869c156325aaf82e24/zensical-0.0.30.tar.gz", hash = "sha256:408b531683f6bcb6cc5ab928146d2c68afbc16fac4eda87ae3dd20af1498180f", size = 3844287, upload-time = "2026-03-28T17:55:52.836Z" }
|
||||||
wheels = [
|
wheels = [
|
||||||
{ url = "https://files.pythonhosted.org/packages/c2/db/cc4e555d2e816f2d91304ff969d62cc3a401ee477dbb7c720b874bec67d6/zensical-0.0.31-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:b489936d670733dd204f16b689a2acc0e45b69e42cc4901f5131ae57658b8fbc", size = 12419980, upload-time = "2026-04-01T11:29:44.01Z" },
|
{ url = "https://files.pythonhosted.org/packages/1b/e3/ac0eb77a8a7f793613813de68bde26776d0da68d8041fa9eb8d0b986a449/zensical-0.0.30-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:b67fca8bfcd71c94b331045a591bf6e24fe123a66fba94587aa3379faf521a16", size = 12313786, upload-time = "2026-03-28T17:55:18.839Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/e7/c1/6789f73164c7f5821f5defb8a80b1dba8d5af24bdec7db36876793c5afd9/zensical-0.0.31-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:d9f678efc0d9918e45eeb8bc62847b2cce23db7393c8c59c1be6d1c064bbaacd", size = 12292301, upload-time = "2026-04-01T11:29:47.277Z" },
|
{ url = "https://files.pythonhosted.org/packages/a5/6a/73e461dfa27d3bc415e48396f83a3287b43df2fd3361e25146bc86360aab/zensical-0.0.30-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:8ceadfece1153edc26506e8ddf68d9818afe8517cf3bcdb6bfe4cb2793ae247b", size = 12186136, upload-time = "2026-03-28T17:55:21.836Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/4f/9a/6a83ad209081a953e0285d5056e5452c4fbcabd2f104f3797d53e4bdd96f/zensical-0.0.31-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fb2b50ecf674997f818e53f12f2a67875a21b0c79ed74c151dfaef2f1475e5bf", size = 12661472, upload-time = "2026-04-01T11:29:50.706Z" },
|
{ url = "https://files.pythonhosted.org/packages/a3/bc/9022156b4c28c1b95209acb64319b1e5cd0af2e97035bdd461e58408cb46/zensical-0.0.30-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e100b2b654337ac5306ba12818f3c5336c66d0d34c593ef05e316c124a5819cb", size = 12556115, upload-time = "2026-03-28T17:55:24.849Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/9c/4a/a82f5c81893b7a607cf9d439b75c3c3894b4ef4d3e92d5d818b4fa5c6f23/zensical-0.0.31-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:6fb5c634fe88254770a2d4db5c05b06f1c3ee5e29d2ae3e7efdae8905e435b1d", size = 12603784, upload-time = "2026-04-01T11:29:53.623Z" },
|
{ url = "https://files.pythonhosted.org/packages/0b/29/9e8f5bd6d33b35f4c368ae8b13d431dc42b2de17ea6eccbd71d48122eba6/zensical-0.0.30-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bdf641ffddaf21c6971b91a4426b81cd76271c5b1adb7176afcce3f1508328b1", size = 12498121, upload-time = "2026-03-28T17:55:27.637Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/f7/1c/79c198628b8e006be32dfb1c5b73561757a349a6cf3069600a67ffa62495/zensical-0.0.31-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:94e64630552793274db1ec66c971e49a15ad351536d5d12de67ec6da7358ac50", size = 12959832, upload-time = "2026-04-01T11:29:56.736Z" },
|
{ url = "https://files.pythonhosted.org/packages/c4/e1/b8dfa0769050e62cd731358145fdeb67af35e322197bd7e7727250596e7b/zensical-0.0.30-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1fd909a0c2116e26190c7f3ec4fb55837c417b7a8d99ebf4f3deb26b07b97e49", size = 12854142, upload-time = "2026-03-28T17:55:30.54Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/db/9d/45839d9ca0f69622e8a3b944f2d8d7f7d2b7c2da78201079c4feb275feb6/zensical-0.0.31-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:738a2fd5832e3b3c10ff642eebaf89c89ca1d28e4451dad0f36fdac53c415577", size = 12704024, upload-time = "2026-04-01T11:29:59.836Z" },
|
{ url = "https://files.pythonhosted.org/packages/04/11/62a36cfb81522b6108db8f9e96d36da8cccb306b02c15ad19e1b333fa7c8/zensical-0.0.30-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:16fd2da09fe4e5cbec2ca74f31abc70f32f7330d56593b647e0a114bb329171a", size = 12598341, upload-time = "2026-03-28T17:55:32.988Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/df/5f/451d7f4d94092bc38bd8d514826fb7b0329c188db506795b1d20bd07d517/zensical-0.0.31-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:bd601f6132e285ef6c3e4c3852be2094fc0473295a8080003db76a79760f84fb", size = 12837788, upload-time = "2026-04-01T11:30:03.048Z" },
|
{ url = "https://files.pythonhosted.org/packages/a7/a4/8c7a6725fb226aa71d19209403d974e45f39d757e725f9558c6ed8d350a5/zensical-0.0.30-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:896b36eaef7fed5f8fc6f2c8264b2751aad63c2d66d3d8650e38481b6b4f6f7b", size = 12732307, upload-time = "2026-03-28T17:55:35.618Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/d8/39/390a8fc384fb174ebd4450343a0aa2877b3a31ddcedf5ef0b8d26944e12c/zensical-0.0.31-cp310-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:dc3b6a9dfb5903c0aa779ef65cd6185add2b8aa1db237be840874b8c9db761b8", size = 12876822, upload-time = "2026-04-01T11:30:06.418Z" },
|
{ url = "https://files.pythonhosted.org/packages/5e/a1/7858fb3f6ac67d7d24a8acbe834cbe26851d6bd151ece6fba3fc88b0f878/zensical-0.0.30-cp310-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:a1f515ec67a0d0250e53846327bf0c69635a1f39749da3b04feb68431188d3c6", size = 12770962, upload-time = "2026-03-28T17:55:38.627Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/d5/60/640da2f095782cf38974cd851fb7afa62651d09a36543a1d8942b31aabdc/zensical-0.0.31-cp310-abi3-musllinux_1_2_i686.whl", hash = "sha256:ddd4321b275e82c4897aa45b05038ce204b88fb311ad55f8c2af572173a9b56c", size = 13024036, upload-time = "2026-04-01T11:30:09.501Z" },
|
{ url = "https://files.pythonhosted.org/packages/49/b7/228298112a69d0b74e6e93041bffcf1fc96d03cf252be94a354f277d4789/zensical-0.0.30-cp310-abi3-musllinux_1_2_i686.whl", hash = "sha256:ce33d1002438838a35fa43358a1f43d74f874586596d3d116999d3756cded00e", size = 12919256, upload-time = "2026-03-28T17:55:41.413Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/3f/06/0564377cbfccea3653254adfa851c1b20d1696e4b16770c7b2e1dd1ef1d7/zensical-0.0.31-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:147ab4bc17f3088f703aa6c4b9c416411f4ea8ca64d26f6586beae49d97fd3c7", size = 12975505, upload-time = "2026-04-01T11:30:12.268Z" },
|
{ url = "https://files.pythonhosted.org/packages/de/c7/5b4ea036f7f7d84abf907f7f7a3e8420b054c89279c5273ca248d3bc9f48/zensical-0.0.30-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:029dad561568f4ae3056dde16a81012efd92c426d4eb7101f960f448c1168196", size = 12869760, upload-time = "2026-03-28T17:55:44.474Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/35/4b/b8a0c4e5937cb05882dcce667798403e00897135080a69f92363e5e3ff9f/zensical-0.0.31-cp310-abi3-win32.whl", hash = "sha256:03fa11e629a308507693489541f43e751697784e94365e7435b02104aefd1c2c", size = 12011233, upload-time = "2026-04-01T11:30:15.496Z" },
|
{ url = "https://files.pythonhosted.org/packages/36/b4/77bef2132e43108db718ae014a5961fc511e88fc446c11f1c3483def429e/zensical-0.0.30-cp310-abi3-win32.whl", hash = "sha256:0105672850f053c326fba9fdd95adf60e9f90308f8cc1c08e3a00e15a8d5e90f", size = 11905658, upload-time = "2026-03-28T17:55:47.416Z" },
|
||||||
{ url = "https://files.pythonhosted.org/packages/3e/99/0eacdb466d344c0c86596932201268517be42f3e0bb6c78b2b0cd84c55f6/zensical-0.0.31-cp310-abi3-win_amd64.whl", hash = "sha256:d6621d4bb46af4143560045d4a18c8c76302db56bf1dbb6e2ce107d7fb643e09", size = 12207545, upload-time = "2026-04-01T11:30:19.054Z" },
|
{ url = "https://files.pythonhosted.org/packages/a1/59/23b6c7ff062e2b299cc60e333095e853f9d38d1b5abe743c7b94c4ac432c/zensical-0.0.30-cp310-abi3-win_amd64.whl", hash = "sha256:b879dbf4c69d3ea41694bae33e1b948847e635dcbcd6ec8c522920833379dd48", size = 12101867, upload-time = "2026-03-28T17:55:50.083Z" },
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -2,15 +2,10 @@
|
|||||||
site_name = "FastAPI Toolsets"
|
site_name = "FastAPI Toolsets"
|
||||||
site_description = "Production-ready utilities for FastAPI applications."
|
site_description = "Production-ready utilities for FastAPI applications."
|
||||||
site_author = "d3vyce"
|
site_author = "d3vyce"
|
||||||
site_url = "https://fastapi-toolsets.d3vyce.fr/"
|
site_url = "https://fastapi-toolsets.d3vyce.fr"
|
||||||
copyright = "Copyright © 2026 d3vyce"
|
copyright = "Copyright © 2026 d3vyce"
|
||||||
repo_url = "https://github.com/d3vyce/fastapi-toolsets"
|
repo_url = "https://github.com/d3vyce/fastapi-toolsets"
|
||||||
|
|
||||||
[project.extra.version]
|
|
||||||
provider = "mike"
|
|
||||||
default = "stable"
|
|
||||||
alias = true
|
|
||||||
|
|
||||||
[project.theme]
|
[project.theme]
|
||||||
custom_dir = "docs/overrides"
|
custom_dir = "docs/overrides"
|
||||||
language = "en"
|
language = "en"
|
||||||
|
|||||||
Reference in New Issue
Block a user