Fast & Friendly, Web Framework For Building Async APIs
Project description
Panther
Is A Fast & Friendly Web Framework For Building Async APIs With Python 3.10+
📚 Full Documentation: PantherPy.GitHub.io
Why Use Panther ?
- Document-oriented Databases ODM (PantherDB, MongoDB)
- Built-in Websocket Support
- Cache APIs (In Memory, In Redis)
- Built-in Authentication Classes (Customizable)
- Built-in Permission Classes (Customizable)
- Handle Custom Middlewares
- Handle Custom Throttling
- Visual API Monitoring (In Terminal)
Supported by
Benchmark
Framework | Throughput (Request/Second) |
---|---|
Blacksheep | 5,339 |
Muffin | 5,320 |
Panther | 5,112 |
Sanic | 3,660 |
FastAPI | 3,260 |
Tornado | 2,081 |
Bottle | 2,045 |
Django | 821 |
Flask | 749 |
More Detail: https://GitHub.com/PantherPy/frameworks-benchmark
Installation
-
1. Create a Virtual Environment
$ python3 -m venv .venv
-
2. Active The Environment
* Linux & Mac$ source .venv/bin/activate
* Windows$ .\.venv\Scripts\activate
-
3. Install Panther
- ⬇ Normal Installation$ pip install panther
- ⬇ Include full requirements (MongoDB, JWTAuth, Ruff, Redis, bpython)$ pip install panther[full]
Usage
-
Create Project
$ panther create
-
Run Project
$ panther run --reload
* Panther uses Uvicorn as ASGI (Asynchronous Server Gateway Interface) but you can run the project with Granian, daphne or any ASGI server too
-
Monitoring Requests
$ panther monitor
-
Python Shell
$ panther shell
Single-File Structure Example
-
Create
main.py
from datetime import datetime, timedelta from panther import version, status, Panther from panther.app import API from panther.request import Request from panther.response import Response from panther.throttling import Throttling InfoThrottling = Throttling(rate=5, duration=timedelta(minutes=1)) @API() async def hello_world(): return {'detail': 'Hello World'} @API(cache=True, throttling=InfoThrottling) async def info(request: Request): data = { 'panther_version': version(), 'datetime_now': datetime.now().isoformat(), 'user_agent': request.headers.user_agent } return Response(data=data, status_code=status.HTTP_202_ACCEPTED) url_routing = { '': hello_world, 'info': info, } app = Panther(__name__, configs=__name__, urls=url_routing)
-
Run the project:
$ panther run --reload
-
Now you can see these two urls:
Next Step: First CRUD
Real Word Example: Https://GitHub.com/PantherPy/panther-example
Roadmap
If you find this project useful, please give it a star ⭐️.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
panther-3.8.2.tar.gz
(62.0 kB
view hashes)
Built Distribution
panther-3.8.2-py3-none-any.whl
(56.5 kB
view hashes)