/falca

Falca is an intuitive REST APIs framework based on the falcon framework.

Primary LanguagePythonMIT LicenseMIT

Falca

Logo

PyPI - Downloads PyPI PyPI - Python Version PyPI - Format PyPI - Status PyPI - License GitHub issues GitHub closed issues Scrutinizer code quality (GitHub/Bitbucket) Black Formatter

Falca is an intuitive REST APIs framework.
Powered by https://falconframework.org/.

⚠️ This is a BETA version please don't use it in a production environment. Thank you! 🚧

Goals of this project:

  • Validates request body based on type hints.
  • (Pydantic & Marshmallow) support as object serialization and deserialization
  • Request body mapping
  • Nested routers
  • Plugin support
  • Settings (Global Configuration) support
  • Async Support
  • Routing sub-application
  • CLI
  • Dependency injection
  • Resource shortcut (get, post, put, delete, websocket, etc)

Contribution

Do not hesitate!

if you want to contribute like bug fixes, feature additions, etc. Please read our contribution guidelines.

Also bug reports are welcome :)

Installation

Using pip:

pip install falca

Alternatively, clone this repository and go to the falca directory:

git clone https://github.com/aprilahijriyan/falca
cd falca

Initialize the environment with python v3.7 using poetry

poetry env use $(which python3.7)

Install dependencies

poetry install --no-dev

Usage

Let's see how beautiful it is

# app.py

from typing import Optional

from falca.app import ASGI
from falca.depends.pydantic import Query
from falca.responses import JSONResponse
from falca.serializers.pydantic import Schema


class LimitOffsetSchema(Schema):
    limit: Optional[int]
    offset: Optional[int]

class Simple:
    async def on_get(self, query: dict = Query(LimitOffsetSchema)):
        return JSONResponse(query)

app = ASGI(__name__)
app.add_route("/", Simple())

Save the code above with filename app.py And run it with the command:

falca runserver

NOTE: For the ASGI app, you need to install uvicorn before running it. Also for other examples, you can find them here