All Projects â†’ perdy â†’ Flama

perdy / Flama

Licence: gpl-3.0
🔥 Fire up your API with this flamethrower

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Flama

Flasgger
Easy OpenAPI specs and Swagger UI for your Flask API
Stars: ✭ 2,825 (+1654.66%)
Mutual labels:  api, swagger, openapi, restful, marshmallow
Loopback Next
LoopBack makes it easy to build modern API applications that require complex integrations.
Stars: ✭ 3,972 (+2367.08%)
Mutual labels:  api, rest, swagger, openapi, dependency-injection
Compojure Api
Sweet web apis with Compojure & Swagger
Stars: ✭ 1,056 (+555.9%)
Mutual labels:  api, rest, swagger, openapi, schema
Flask Restplus
Fully featured framework for fast, easy and documented API development with Flask
Stars: ✭ 2,585 (+1505.59%)
Mutual labels:  api, rest, swagger, restful
Js Client
A Open-API derived JS + Node.js API client for Netlify
Stars: ✭ 170 (+5.59%)
Mutual labels:  api, rest, swagger, openapi
Hapi Openapi
Build design-driven apis with OpenAPI (formerly swagger) 2.0 and hapi.
Stars: ✭ 196 (+21.74%)
Mutual labels:  api, rest, swagger, openapi
Proteus
Lean, mean, and incredibly fast JVM framework for web and microservice development.
Stars: ✭ 178 (+10.56%)
Mutual labels:  api, rest, swagger, openapi
Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+2041.61%)
Mutual labels:  api, rest, swagger, openapi
Golang Gin Realworld Example App
Exemplary real world application built with Golang + Gin
Stars: ✭ 1,780 (+1005.59%)
Mutual labels:  api, rest, restful, crud
Apispec
A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification)..
Stars: ✭ 831 (+416.15%)
Mutual labels:  api, swagger, openapi, marshmallow
Goa
Design-based APIs and microservices in Go
Stars: ✭ 4,493 (+2690.68%)
Mutual labels:  api, rest, swagger, openapi
Fastapi
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Stars: ✭ 39,588 (+24488.82%)
Mutual labels:  api, rest, swagger, openapi
Php Crud Api
Single file PHP script that adds a REST API to a SQL database
Stars: ✭ 2,904 (+1703.73%)
Mutual labels:  swagger, openapi, restful, crud
Koa Rest Api Boilerplate
💯 Boilerplate for Node.js Koa RESTful API application with Docker, Swagger, Jest, CodeCov and CircleCI
Stars: ✭ 420 (+160.87%)
Mutual labels:  api, rest, swagger, restful
Flask Restx
Fork of Flask-RESTPlus: Fully featured framework for fast, easy and documented API development with Flask
Stars: ✭ 1,050 (+552.17%)
Mutual labels:  api, rest, swagger, restful
Rest Hapi
🚀 A RESTful API generator for Node.js
Stars: ✭ 1,102 (+584.47%)
Mutual labels:  api, rest, swagger, crud
Swagger Combine
Combines multiple Swagger schemas into one dereferenced schema.
Stars: ✭ 102 (-36.65%)
Mutual labels:  api, swagger, openapi
Kaizen Openapi Editor
Eclipse Editor for the Swagger-OpenAPI Description Language
Stars: ✭ 97 (-39.75%)
Mutual labels:  rest, swagger, openapi
Swagger meqa
Auto generate and run tests using swagger/OpenAPI spec, no coding needed
Stars: ✭ 151 (-6.21%)
Mutual labels:  swagger, openapi, restful
Webapiclient
An open source project based on the HttpClient. You only need to define the c# interface and modify the related features to invoke the client library of the remote http interface asynchronously.
Stars: ✭ 1,618 (+904.97%)
Mutual labels:  swagger, openapi, restful

Flama

🔥 Fire up your API.

CI Status Docs Status Coverage Package version PyPI - Python Version


Documentation: https://flama.perdy.io


Flama

Flama aims to bring a layer on top of Starlette to provide an easy to learn and fast to develop approach for building highly performant GraphQL and REST APIs. In the same way of Starlette is, Flama is a perfect option for developing asynchronous and production-ready services.

Among other characteristics it provides the following:

  • Generic classes for API resources that provides standard CRUD methods over SQLAlchemy tables.
  • Schema system based on Marshmallow that allows to declare the inputs and outputs of endpoints and provides a reliable way of validate data against those schemas.
  • Dependency Injection that ease the process of managing parameters needed in endpoints. Flama ASGI objects like Request, Response, Session and so on are defined as components and ready to be injected in your endpoints.
  • Components as the base of the plugin ecosystem, allowing you to create custom or use those already defined in your endpoints, injected as parameters.
  • Auto generated API schema using OpenAPI standard. It uses the schema system of your endpoints to extract all the necessary information to generate your API Schema.
  • Auto generated docs providing a Swagger UI or ReDoc endpoint.
  • Pagination automatically handled using multiple methods such as limit and offset, page numbers...

Requirements

Installation

$ pip install flama

Example

from marshmallow import Schema, fields, validate
from flama.applications import Flama
import uvicorn

# Data Schema
class Puppy(Schema):
    id = fields.Integer()
    name = fields.String()
    age = fields.Integer(validate=validate.Range(min=0))


# Database
puppies = [
    {"id": 1, "name": "Canna", "age": 6},
    {"id": 2, "name": "Sandy", "age": 12},
]


# Application
app = Flama(
    components=[],      # Without custom components
    title="Foo",        # API title
    version="0.1",      # API version
    description="Bar",  # API description
    schema="/schema/",  # Path to expose OpenAPI schema
    docs="/docs/",      # Path to expose Swagger UI docs
    redoc="/redoc/",    # Path to expose ReDoc docs
)


# Views
@app.route("/", methods=["GET"])
def list_puppies(name: str = None) -> Puppy(many=True):
    """
    description:
        List the puppies collection. There is an optional query parameter that 
        specifies a name for filtering the collection based on it.
    responses:
        200:
            description: List puppies.
    """
    return [puppy for puppy in puppies if name in (puppy["name"], None)]
    

@app.route("/", methods=["POST"])
def create_puppy(puppy: Puppy) -> Puppy:
    """
    description:
        Create a new puppy using data validated from request body and add it 
        to the collection.
    responses:
        200:
            description: Puppy created successfully.
    """
    puppies.append(puppy)
    
    return puppy


if __name__ == '__main__':
    uvicorn.run(app, host='0.0.0.0', port=8000)

Dependencies

Following Starlette philosophy Flama reduce the number of hard dependencies to those that are used as the core:

It does not have any more hard dependencies, but some of them are necessaries to use some features:

  • pyyaml - Required for API Schema and Docs auto generation.
  • apispec - Required for API Schema and Docs auto generation.
  • python-forge - Required for pagination.
  • sqlalchemy - Required for Generic API resources.
  • databases - Required for Generic API resources.

You can install all of these with pip3 install flama[full].

Credits

That library is heavily inspired by APIStar server in an attempt to bring a good amount of it essence to work with Starlette as the ASGI framework and Marshmallow as the schema system.

Contributing

This project is absolutely open to contributions so if you have a nice idea, create an issue to let the community discuss it.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].