🐾 Why Choose Panther?
Panther is designed to be fast, simple, and powerful. Here's what makes it special:
- One of the fastest Python frameworks available (Benchmark)
- File-based database (PantherDB) - No external database setup required
- Document-oriented ODM - Supports MongoDB & PantherDB with familiar syntax
- API caching system - In-memory and Redis support
- OpenAPI - Auto-generated API documentation with multiple UI options
- WebSocket support - Real-time communication out of the box
- Authentication & Permissions - Built-in security features
- Background tasks - Handle long-running operations
- Middleware & Throttling - Extensible and configurable
Quick Start
Installation
pip install panther
- Create a
main.pyfile with one of the examples below.
Your First API
Here's a simple REST API endpoint that returns a "Hello World" message:
from datetime import datetime, timedelta
from panther import status, Panther
from panther.app import GenericAPI
from panther.openapi.urls import url_routing as openapi_url_routing
from panther.response import Response
class HelloAPI(GenericAPI):
# Cache responses for 10 seconds
cache = timedelta(seconds=10)
def get(self):
current_time = datetime.now().isoformat()
return Response(
data={'message': f'Hello from Panther! 🐾 | {current_time}'},
status_code=status.HTTP_200_OK
)
# URL routing configuration
url_routing = {
'/': HelloAPI,
'docs/': openapi_url_routing, # Auto-generated API docs
}
# Create your Panther app
app = Panther(__name__, configs=__name__, urls=url_routing)
WebSocket Echo Server
Here's a simple WebSocket echo server that sends back any message it receives:
from panther import Panther
from panther.app import GenericAPI
from panther.response import HTMLResponse
from panther.websocket import GenericWebsocket
class EchoWebsocket(GenericWebsocket):
async def connect(self, **kwargs):
await self.accept()
await self.send("Connected to Panther WebSocket!")
async def receive(self, data: str | bytes):
# Echo back the received message
await self.send(f"Echo: {data}")
class WebSocketPage(GenericAPI):
def get(self):
template = """
<h2>🐾 Panther WebSocket Echo Server</h2>
<input id="msg"><button onclick="s.send(msg.value)">Send</button>
<ul id="log"></ul>
<script>
const s = new WebSocket('ws://127.0.0.1:8000/ws');
s.onmessage = e => log.innerHTML += `<li><- ${msg.value}</li><li>-> ${e.data}</li>`;
</script>
"""
return HTMLResponse(template)
url_routing = {
'': WebSocketPage,
'ws': EchoWebsocket,
}
app = Panther(__name__, configs=__name__, urls=url_routing)
Run Your Application
-
Start the development server
$ panther run main:app
-
Test your application
- For the API example: Visit http://127.0.0.1:8000/ to see the "Hello World" response
- For the WebSocket example: Visit http://127.0.0.1:8000/ and send a message.
For LLMs and Coding Agents
Start with:
These files are kept focused on current Panther APIs and copyable examples.
🙏 Acknowledgments
⭐️ If you find Panther useful, please give it a star!
Release files for panther 5.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| panther-5.5.0.tar.gz | 143.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| panther-5.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 256.2 kB
Release files / panther-5.5.0.tar.gz
| Download URL | panther-5.5.0.tar.gz |
|---|---|
| Size | 143.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8acc885807128258d0282fad9b9e0098e578198c122f63810af5840d9f554e6f
|
|
BLAKE2b-256 checksum How to use checksums |
1d5f7956e36af0b074eaa7709df6913946be6004bff707c43b4787ffe6dfe5b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Release files / panther-5.5.0-py3-none-any.whl
| Download URL | panther-5.5.0-py3-none-any.whl |
|---|---|
| Size | 113.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4821ce63d001c03f59d8f2c7e5cb3a09d33929510f24ecaa7a8db366ba3d8ad
|
|
BLAKE2b-256 checksum How to use checksums |
02d351976ad97ca5fdd94b858fb064c8fb094a68367fdcdae2dabfef84a123fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|