Skip to main content

SFTKit

A general purpose collection of base building blocks and utilities to make building python applications on the basis of postgresql (asyncpg) + fastapi a breeze.

Getting Started

To get started simply run

pip install sftkit

A basic server could look like this

import asyncio
from dataclasses import dataclass

from sftkit.http import Server, HTTPServerConfig
from fastapi import APIRouter


config = HTTPServerConfig(base_url="/api/v1", port=8074, host="127.0.0.1")

router = APIRouter(
    responses={404: {"description": "not found"}},
)


@router.get("/ping")
async def ping():
    return "pong"


@dataclass
class Context:
    config: HTTPServerConfig


class Api:
    def __init__(self, config: HTTPServerConfig = config):
        self.config = config
        self.server = Server(title="<your title>", config=config, license_name="<your license>", version="0.1.0")
        self.server.add_router(router)

    async def run(self):
        context = Context(config=self.config)
        await self.server.run(context)


if __name__ == "__main__":
    server = Api()
    asyncio.run(server.run())

Copy the code to main.py and run the server using python main.py.

You can ping the server at http://127.0.0.1:8074/api/v1/ping or inspect the API specification at http://127.0.0.1:8074/api/v1/docs.

Usage

Dev CLI

Configure sftkit in your pyproject.toml

[tool.sftkit]
db_code_dir = "<path-to-your-sql-code-folder>"
db_migrations_dir = "<path-to-your-sql-data-migrations>"

Create new migrations via

sftkit create-migration <name>

Metadata

Release files for sftkit 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sftkit 0.5.0
File Size Uploaded Provenance Actions
sftkit-0.5.0.tar.gz 20.1 kB Without provenance Details for sftkit-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sftkit 0.5.0
File Interpreter ABI Platform Actions
sftkit-0.5.0-py3-none-any.whl Python 3 none any Details for sftkit-0.5.0-py3-none-any.whl

Total release size: 45.9 kB

Release files / sftkit-0.5.0.tar.gz

Download URL sftkit-0.5.0.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7e9509d1c1d991d25a105351201d73bda71ada87994fded3ed4fbc24971451ca
BLAKE2b-256 checksum
How to use checksums
4520506fc71247818a01bf1a72dc02e8231302fa63d3813211aa41911d95bd81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / sftkit-0.5.0-py3-none-any.whl

Download URL sftkit-0.5.0-py3-none-any.whl
Size 25.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a6afab2c5168777bde4247e1625df04714d3be31eec71f9a7392bf187735109
BLAKE2b-256 checksum
How to use checksums
b4294a9806f14b4cc6c256c1c73253ace14773ba9385e312cb86e4364ce943a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for sftkit 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page