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.2
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"

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.2.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

Fastoo-0.1.2-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for Fastoo-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ebf9f364e0c6be1637581dc89d138e5910a2d1d3cd17e3e95e82cbd8b4914693
MD5 a2c541bf26cf2b2ab1d87fb0ac27e03f
BLAKE2b-256 d9adf5f45b834a1b791701b88afaf5edc161b909477f884ad50c9a575f36db32

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for Fastoo-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6a04680a44d4673d87c3be24c191d734f2dfa82f10d4c01e736fa08e8dd608da
MD5 92e7202d2efab6bc8546293e6f419cb5
BLAKE2b-256 e3a633f24dc2a1699a4051c647e9174490398122dc4ff740c70e59ecde9ffcb8

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