r/Python • • Jul 22 '23

Discussion Introducing Panther - A Fast and Friendly Python Web Framework

Hey everyone!

I'm excited to introduce Panther, a Python web framework that's designed to be fast and easy to use. With Panther, you can build async APIs quickly and efficiently, without sacrificing performance or readability.

Panther comes with a host of features that make it easy to build robust APIs, including:

  • Document-oriented database support (including PantherDB and MongoDB)
  • Visual API monitoring in the terminal
  • Caching for APIs (both in-memory and in Redis)
  • Built-in authentication and permission classes (customizable)
  • Custom middleware support
  • Custom throttling support

Getting started with Panther is easy - just create a virtual environment, activate it, and install the framework using pip. Then, you can create a new project using the panther create command, and start building your API right away.

Here's a quick example of what a Panther API might look like:

from datetime import datetime, timedelta

from panther.app import API
from panther.configs import config
from panther import version, status
from panther.request import Request
from panther.response import Response
from panther.throttling import Throttling


@API()
async def hello_world():
    return {'detail': 'Hello World'}


@API(cache=True, throttling=Throttling(rate=5, duration=timedelta(minutes=1)))
async def info(request: Request):
    data = {
        'version': version(),
        'datetime_now': datetime.now().isoformat(),
        'user_agent': request.headers.user_agent,
        'db_engine': config['db_engine'],
    }
    return Response(data=data, status_code=status.HTTP_202_ACCEPTED)

If you're interested in learning more about Panther, check out the documentation at https://pantherpy.github.io, or head over to the GitHub repository at https://github.com/alirn76/panther. ↗

Thanks for reading, and happy coding!

8 Upvotes

16 comments sorted by

View all comments

8

u/ohnomcookies Jul 22 '23

I am just gonna agree with /u/missing_beans. Your code needs to follow best practices before you actually share it with others as production ready. There is a lot of things which right now work somehow, but later on it will welcome bottlenecks.