Reusable FastAPI utilities: AWS helpers, SQLite cache, and uvicorn-style access logging
Project description
fastapi-lite
Reusable FastAPI utilities extracted for shared use: AWS helpers (boto3 session, botocore models, SSO auth), SQLite-backed cache, and uvicorn-style access logging.
Installation
pip install fastapi-lite
Modules
fastapi_lite.log — Access logging
Drop-in uvicorn-style HTTP access-log middleware:
from fastapi import FastAPI
from fastapi_lite.log import add_uvicorn_like_access_log
app = FastAPI()
add_uvicorn_like_access_log(app)
fastapi_lite.cache — SQLite cache
Namespace-based SQLite cache with TTL, plus a ready-to-include FastAPI router:
from pathlib import Path
from fastapi_lite.cache import CacheManager, CacheStore, router as cache_router, set_cache_manager
# Optionally configure cache directory (defaults to ~/.fastapi_lite/cache)
set_cache_manager(CacheManager(Path.home() / ".myapp" / "cache"))
app.include_router(cache_router)
Use the store directly:
from fastapi_lite.cache import CacheManager
from pathlib import Path
manager = CacheManager(Path("/tmp/cache"))
store = manager.get_store("my-namespace")
store.set_item("key", {"hello": "world"}, ttl_ms=60000)
print(store.get_item("key"))
fastapi_lite.aws — AWS helpers
from fastapi_lite.aws import (
get_boto3_session,
execute_aws_action,
BotoJSONEncoder,
set_aws_sso_config,
botocore_router,
aws_router,
auth_router,
)
# Configure SSO (call once at startup)
set_aws_sso_config([
{
"ssoRegion": "eu-west-1",
"ssoStartUrl": "https://d-xxx.awsapps.com/start",
"domain": "aws.amazon.com",
"instance": "aws",
}
])
# Include routers
app.include_router(botocore_router)
app.include_router(aws_router)
app.include_router(auth_router)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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_lite-1.1.0.tar.gz.
File metadata
- Download URL: fastapi_lite-1.1.0.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d59a597ff36ec1c56564807708e83128a632a7c647fddec8df75095d923acf6
|
|
| MD5 |
7b7da482c4e7e5608b313267c6e56b1d
|
|
| BLAKE2b-256 |
f99632cf9228db80278df0944178ca742ac58b69deea98a25fc80ec857ae221e
|
Provenance
The following attestation bundles were made for fastapi_lite-1.1.0.tar.gz:
Publisher:
python-publish.yml on kejun91/fastapi-lite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastapi_lite-1.1.0.tar.gz -
Subject digest:
6d59a597ff36ec1c56564807708e83128a632a7c647fddec8df75095d923acf6 - Sigstore transparency entry: 1131847550
- Sigstore integration time:
-
Permalink:
kejun91/fastapi-lite@e2411343e5706b5a3c5c9c9452ffe2ad40879a76 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/kejun91
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@e2411343e5706b5a3c5c9c9452ffe2ad40879a76 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fastapi_lite-1.1.0-py3-none-any.whl.
File metadata
- Download URL: fastapi_lite-1.1.0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc93350c9954c64f067e252ac1040981daad935c842c0b88f6048884e7e94983
|
|
| MD5 |
8843223230db60a33a1bc863892cfa18
|
|
| BLAKE2b-256 |
82dfc69922cd85165ad974265d88f5c26692d5d674c3043ad3e17c4629cb9124
|
Provenance
The following attestation bundles were made for fastapi_lite-1.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on kejun91/fastapi-lite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastapi_lite-1.1.0-py3-none-any.whl -
Subject digest:
dc93350c9954c64f067e252ac1040981daad935c842c0b88f6048884e7e94983 - Sigstore transparency entry: 1131847802
- Sigstore integration time:
-
Permalink:
kejun91/fastapi-lite@e2411343e5706b5a3c5c9c9452ffe2ad40879a76 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/kejun91
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@e2411343e5706b5a3c5c9c9452ffe2ad40879a76 -
Trigger Event:
push
-
Statement type: