Skip to main content

A super-charged FastAPI framework for even faster delivery

Project description

fastoo

A powerful framework for dealing with FastAPI apps.

It includes various utilities for building big FastAPI apps, inclding templates and modules.

Quickstart

-m means add default modules

python -m pip install fastoo==0.1.4
fastoo new blog -m
cd blog
uvicorn app:app --reload

More commands

fastoo module bing

Creates a new module named bing in modules/

Url defined in info.toml.

Can be changed to what we want. Default is /module_name

Configs

Define configuration profile in init (development, production, testing)

In your apps import get_settings from init

Render templates

consider this

.
├── api
│   ├── __init__.py
│   ├── module.py
│   └── templates.py
├── app.py
├── cli.py
├── config.py
├── __init__.py
├── init.py
├── modules
│   └── auth
│       ├── business.py
│       ├── models.py
│       ├── templates
│       │   └── abc.html
│       └── view.py
└── templates
    └── themes
        ├── back
        └── front
            └── dingy
                └── index.html

imports

from fastoo.api.module import Module

from fastapi import APIRouter
from fastapi import Request
from fastapi import Depends

from typing import Annotated

from pydantic_settings import BaseSettings

from init import get_settings

If we set render_own_templates to True, render_template will look in a folder called templates in the mdoules folder

router = APIRouter(include_in_schema=False)
module = Module(__file__, render_own_templates=True)

@router.get("/login/")
def login(request: Request):
    with module.set(request) as m:
        return module.render_template("abc.html", {})

This can be overriden using

module = Module(__file__, render_own_templates=True, templates="custom/path")

If you don't want the whole goodies, just call

from fastoo import render_template
...

    return render_template("template/path", {}, request, directory="custom/templates/path")

Modules

Modules must contain info.toml like this

[base]
url_prefix = "/auth"

A module includes

  • view.py
  • forms.py # stafrlette-wtforms
  • models.py
  • info.toml
  • business.py # view logic goes here

Validation

fastoo.api.validation has these helpful features

  • verify_slug # for wtf forms
  • is_valid_url
  • is_valid_slug
  • is_empty_str
  • is_alpha_num_underscore

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

Fastoo-0.1.4.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

Fastoo-0.1.4-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file Fastoo-0.1.4.tar.gz.

File metadata

  • Download URL: Fastoo-0.1.4.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for Fastoo-0.1.4.tar.gz
Algorithm Hash digest
SHA256 ca842b18012f4050090183e9f9dd7631e9dcb2e0f3ef882f8118a1e69d90317c
MD5 48c7da6d208fff65ec5be5e28f783d45
BLAKE2b-256 a89c49dd888262dc50152d5fd7152580723a2c3624ab4c70790bacacc263eec2

See more details on using hashes here.

File details

Details for the file Fastoo-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: Fastoo-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for Fastoo-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2a52deb934813ce7f23e51cef3ea8b03872c9d9adc8b04d773a3e532097e5aec
MD5 6834ffcc144aa837b2edde74b217d67d
BLAKE2b-256 4059eae26aa0638a6ae2ad33f169e2944538bba68763092f70f2438e7087b315

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page