fastopenapi
FastOpenAPI is a library for generating and integrating OpenAPI schemas using Pydantic v2 and various frameworks (AioHttp, Falcon, Flask, Quart, Sanic, Starlette, Tornado).
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.4%) to scientific vocabulary
Keywords
Repository
FastOpenAPI is a library for generating and integrating OpenAPI schemas using Pydantic v2 and various frameworks (AioHttp, Falcon, Flask, Quart, Sanic, Starlette, Tornado).
Basic Info
Statistics
- Stars: 427
- Watchers: 2
- Forks: 9
- Open Issues: 2
- Releases: 9
Topics
Metadata Files
README.md
FastOpenAPI is a library for generating and integrating OpenAPI schemas using Pydantic and various frameworks.
This project was inspired by FastAPI and aims to provide a similar developer-friendly experience.
📦 Installation
Install only FastOpenAPI:
bash
pip install fastopenapi
Install FastOpenAPI with a specific framework:
bash
pip install fastopenapi[aiohttp]
bash
pip install fastopenapi[falcon]
bash
pip install fastopenapi[flask]
bash
pip install fastopenapi[quart]
bash
pip install fastopenapi[sanic]
bash
pip install fastopenapi[starlette]
bash
pip install fastopenapi[tornado]
bash
pip install fastopenapi[django]
🛠️ Quick Start
Step 1. Create an application
- Create the
main.pyfile - Copy the code from an example
- For some examples uvicorn is required (
pip install uvicorn)
Examples:
Click to expand the Falcon Example
```python from aiohttp import web from pydantic import BaseModel
from fastopenapi.routers import AioHttpRouter
app = web.Application() router = AioHttpRouter(app=app)
class HelloResponse(BaseModel): message: str
@router.get("/hello", tags=["Hello"], statuscode=200, responsemodel=HelloResponse) async def hello(name: str): """Say hello from aiohttp""" return HelloResponse(message=f"Hello, {name}! It's aiohttp!")
if name == "main": web.run_app(app, host="127.0.0.1", port=8000) ```
Click to expand the Falcon Example
```python import falcon.asgi import uvicorn from pydantic import BaseModel
from fastopenapi.routers import FalconRouter
app = falcon.asgi.App() router = FalconRouter(app=app)
class HelloResponse(BaseModel): message: str
@router.get("/hello", tags=["Hello"], statuscode=200, responsemodel=HelloResponse) async def hello(name: str): """Say hello from Falcon""" return HelloResponse(message=f"Hello, {name}! It's Falcon!")
if name == "main": uvicorn.run(app, host="127.0.0.1", port=8000) ```
Click to expand the Flask Example
```python from flask import Flask from pydantic import BaseModel
from fastopenapi.routers import FlaskRouter
app = Flask(name) router = FlaskRouter(app=app)
class HelloResponse(BaseModel): message: str
@router.get("/hello", tags=["Hello"], statuscode=200, responsemodel=HelloResponse) def hello(name: str): """Say hello from Flask""" return HelloResponse(message=f"Hello, {name}! It's Flask!")
if name == "main": app.run(port=8000) ```
Click to expand the Quart Example
```python from pydantic import BaseModel from quart import Quart
from fastopenapi.routers import QuartRouter
app = Quart(name) router = QuartRouter(app=app)
class HelloResponse(BaseModel): message: str
@router.get("/hello", tags=["Hello"], statuscode=200, responsemodel=HelloResponse) async def hello(name: str): """Say hello from Quart""" return HelloResponse(message=f"Hello, {name}! It's Quart!")
if name == "main": app.run(port=8000) ```
Click to expand the Sanic Example
```python from pydantic import BaseModel from sanic import Sanic
from fastopenapi.routers import SanicRouter
app = Sanic("MySanicApp") router = SanicRouter(app=app)
class HelloResponse(BaseModel): message: str
@router.get("/hello", tags=["Hello"], statuscode=200, responsemodel=HelloResponse) async def hello(name: str): """Say hello from Sanic""" return HelloResponse(message=f"Hello, {name}! It's Sanic!")
if name == "main": app.run(host="0.0.0.0", port=8000) ```
Click to expand the Starlette Example
```python import uvicorn from pydantic import BaseModel from starlette.applications import Starlette
from fastopenapi.routers import StarletteRouter
app = Starlette() router = StarletteRouter(app=app)
class HelloResponse(BaseModel): message: str
@router.get("/hello", tags=["Hello"], statuscode=200, responsemodel=HelloResponse) async def hello(name: str): """Say hello from Starlette""" return HelloResponse(message=f"Hello, {name}! It's Starlette!")
if name == "main": uvicorn.run(app, host="127.0.0.1", port=8000) ```
Click to expand the Tornado Example
```python import asyncio
from pydantic import BaseModel from tornado.web import Application
from fastopenapi.routers.tornado import TornadoRouter
app = Application()
router = TornadoRouter(app=app)
class HelloResponse(BaseModel): message: str
@router.get("/hello", tags=["Hello"], statuscode=200, responsemodel=HelloResponse) def hello(name: str): """Say hello from Tornado""" return HelloResponse(message=f"Hello, {name}! It's Tornado!")
async def main(): app.listen(8000) await asyncio.Event().wait()
if name == "main": asyncio.run(main()) ```
Click to expand the Django Example
```python from django.conf import settings from django.core.management import callcommand from django.core.wsgi import getwsgi_application from django.urls import path from pydantic import BaseModel
from fastopenapi.routers import DjangoRouter
settings.configure(DEBUG=True, SECRETKEY="CHANGEME", ROOTURLCONF=name) application = getwsgiapplication()
router = DjangoRouter(app=True)
class HelloResponse(BaseModel): message: str
@router.get("/hello", tags=["Hello"], statuscode=200, responsemodel=HelloResponse) def hello(name: str): """Say hello from django""" return HelloResponse(message=f"Hello, {name}! It's Django!")
urlpatterns = [path("", router.urls)]
if name == "main": call_command("runserver")
```
Step 2. Run the server
Launch the application:
bash
python main.py
Once launched, the documentation will be available at:
Swagger UI:
http://127.0.0.1:8000/docs
ReDoc UI:
http://127.0.0.1:8000/redoc
⚙️ Features
- Generate OpenAPI schemas with Pydantic v2.
- Data validation using Pydantic models.
- Supports multiple frameworks: AIOHTTP, Falcon, Flask, Quart, Sanic, Starlette, Tornado, Django.
- Proxy routing provides FastAPI-style routing
📖 Documentation
Explore the Docs for an overview of FastOpenAPI, its core components, and usage guidelines. The documentation is continuously updated and improved.
📂 Advanced Examples
Examples of integration and detailed usage for each framework are available in the examples directory.
📊 Quick & Dirty Benchmarks
Fast but not perfect benchmarks. Check the benchmarks directory for details.
✅ Development Recommendations
- Use Pydantic models for strict typing and data validation.
- Follow the project structure similar to provided examples for easy scalability.
- Regularly update dependencies and monitor library updates for new features.
🛠️ Contributing
If you have suggestions or find a bug, please open an issue or create a pull request on GitHub.
🤝 Acknowledgements
Supported by JetBrains under the Open Source Support Program.
📄 License
This project is licensed under the terms of the MIT license.
Owner
- Name: Nikita Ryzhenkov
- Login: mr-fatalyst
- Kind: user
- Repositories: 1
- Profile: https://github.com/mr-fatalyst
Citation (CITATION.cff)
cff-version: 1.2.0
title: FastOpenAPI
message: 'If you use this software, please cite it as below.'
type: software
authors:
- given-names: Nikita
family-names: Ryzhenkov
email: nikita.ryzhenkoff@gmail.com
identifiers:
repository-code: 'https://github.com/mr-fatalyst/fastopenapi'
url: 'https://fastopenapi.fatalyst.dev/'
abstract: >-
FastOpenAPI is a library for generating and integrating OpenAPI schemas
using Pydantic v2 and various frameworks
(AioHttp, Falcon, Flask, Quart, Sanic, Starlette, Tornado, Django).
keywords:
- aiohttp
- falcon
- flask
- quart
- sanic
- starlette
- tornado
- pydantic
- openapi
- django
license: MIT
GitHub Events
Total
- Create event: 18
- Issues event: 1
- Release event: 9
- Watch event: 386
- Delete event: 8
- Push event: 81
- Public event: 2
- Pull request review event: 3
- Pull request review comment event: 7
- Pull request event: 19
- Fork event: 10
Last Year
- Create event: 18
- Issues event: 1
- Release event: 9
- Watch event: 386
- Delete event: 8
- Push event: 81
- Public event: 2
- Pull request review event: 3
- Pull request review comment event: 7
- Pull request event: 19
- Fork event: 10
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Nikita Ryzhenkov | n****f@g****m | 50 |
| Nick Greenfield | n****d@g****m | 1 |
| putbullet | s****s@g****m | 1 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 1
- Total pull requests: 10
- Average time to close issues: N/A
- Average time to close pull requests: 6 days
- Total issue authors: 1
- Total pull request authors: 4
- Average comments per issue: 0.0
- Average comments per pull request: 0.1
- Merged pull requests: 9
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 10
- Average time to close issues: N/A
- Average time to close pull requests: 6 days
- Issue authors: 1
- Pull request authors: 4
- Average comments per issue: 0.0
- Average comments per pull request: 0.1
- Merged pull requests: 9
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ghettoDdOS (1)
Pull Request Authors
- mr-fatalyst (13)
- ghettoDdOS (2)
- putbullet (2)
- boydgreenfield (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 2,924 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 9
- Total maintainers: 1
pypi.org: fastopenapi
FastOpenAPI is a library for generating and integrating OpenAPI schemas using Pydantic v2 and various frameworks (AioHttp, Falcon, Flask, Quart, Sanic, Starlette, Tornado).
- Homepage: https://fastopenapi.fatalyst.dev/
- Documentation: https://fastopenapi.fatalyst.dev/
- License: MIT
-
Latest release: 0.7.0
published 10 months ago