Core abstractions for superfunctions ecosystem - database adapters and HTTP utilities
Project description
superfunctions
Core abstractions for the superfunctions ecosystem - database adapters and HTTP utilities
Location: packages/python-core/
Package: sfns
Import: from superfunctions.db import ... or from superfunctions.http import ...
Installation
pip install sfns
Usage
Database Adapters
from superfunctions.db import (
Adapter,
CreateParams,
FindManyParams,
WhereClause,
Operator,
)
# Use with any adapter implementation
user = await adapter.create(
CreateParams(
model="users",
data={"name": "Alice", "email": "alice@example.com"},
)
)
# Query with filters
users = await adapter.find_many(
FindManyParams(
model="users",
where=[
WhereClause(field="email", operator=Operator.LIKE, value="%@example.com")
],
limit=10,
)
)
HTTP Abstractions
from superfunctions.http import Request, Response, RouteContext, NotFoundError
async def get_user_handler(request: Request, context: RouteContext) -> Response:
user_id = context.params.get("id")
user = await db.find_one(...)
if not user:
raise NotFoundError(f"User {user_id} not found")
return Response(status=200, body=user)
Adapters
Install adapter packages separately based on your stack:
Database Adapters
# SQLAlchemy (coming soon)
pip install superfunctions-sqlalchemy
# Django ORM (coming soon)
pip install superfunctions-django
# Tortoise ORM (coming soon)
pip install superfunctions-tortoise
HTTP Framework Adapters
# FastAPI (coming soon)
pip install superfunctions-fastapi
# Flask (coming soon)
pip install superfunctions-flask
# Django (coming soon)
pip install superfunctions-django
Documentation
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 sfns-0.1.0.tar.gz.
File metadata
- Download URL: sfns-0.1.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7db3afe8de9f66de3b9ec2d965bb235483a4bc9508239b8b0695991f38796442
|
|
| MD5 |
a8a4eb6825e867abbdcdb3aa7aed6039
|
|
| BLAKE2b-256 |
79ab5991e8713738a4bae16fc1910b2579df0b44429594d1927cecb9821cd960
|
File details
Details for the file sfns-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sfns-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d57d290997d4445546c899a2afacdf0350d95bc533ad08d34957526f97ae581
|
|
| MD5 |
7ceea305e39ae9d9011487b43c1c950b
|
|
| BLAKE2b-256 |
485f42f5029b5cb4793e7a4ac75f946f38eb49be6d93ccb2731b8c9e50b1bfb2
|