Pagination utilities for FastAPI with SQLModel ORM
Project description
FastAPI RestKit
Pagination utilities for FastAPI with SQLModel ORM.
Features
- 🚀 Easy pagination for SQLModel queries
- 📦 Generic response models with type hints
- ⚡ FastAPI dependencies ready to use
- 🔍 Async support out of the box
Installation
pip install fastapi-restkit
Or with uv:
uv add fastapi-restkit
Quick Start
from fastapi import FastAPI, Depends
from sqlmodel import Session
from fastapi_restkit import PaginationParams, paginate, PaginatedResponse
app = FastAPI()
@app.get("/items", response_model=PaginatedResponse[Item])
async def list_items(
session: Session = Depends(get_session),
pagination: PaginationParams = Depends(),
):
return await paginate(session, select(Item), pagination)
Development
Setup
# Clone the repository
git clone https://github.com/cacenot/fastapi-restkit.git
cd fastapi-restkit
# Install dependencies with uv
uv sync --dev
# Run tests
uv run pytest
# Run linter
uv run ruff check .
# Run formatter
uv run ruff format .
Project Structure
fastapi-restkit/
├── src/
│ └── fastapi_restkit/
│ ├── __init__.py
│ ├── pagination.py # Core pagination logic
│ ├── models.py # Response models
│ └── dependencies.py # FastAPI dependencies
├── tests/
├── docs/
└── pyproject.toml
License
MIT License - see LICENSE for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastapi_restkit-0.1.0.tar.gz
(19.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_restkit-0.1.0.tar.gz.
File metadata
- Download URL: fastapi_restkit-0.1.0.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
688577b88a7f638928cc8c5e6cc651b205bd6bc0d5a75040600a6f2b849b03fa
|
|
| MD5 |
43dc902dfec2919a484ef8784c5928f1
|
|
| BLAKE2b-256 |
cc650100bc8602a143926d8e479feda7a45d6749a80d3ebc17ef92e9eb4b0415
|
File details
Details for the file fastapi_restkit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fastapi_restkit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64f06f4cd0ab452074909ae1a7f9f33263510b90f45e4dbfeeca12cc16d0124c
|
|
| MD5 |
0319091c9669ccf088436427ca2147a4
|
|
| BLAKE2b-256 |
90e3859f9486498e6ec56bf7ae38064fc8607d62a3ec963d00ae645a81d19319
|