Skip to main content

Fast & Friendly, Web Framework For Building Async APIs

Project description

PyPI PyVersion codecov Downloads license

Panther

Is A Fast & Friendly Web Framework For Building Async APIs With Python 3.11+

logo

logo Supported by JetBrains

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)

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

  • Create a Virtual Environment
    $ python3 -m venv .venv
  • Active The Environment * Linux & Mac
    $ source .venv/bin/activate
    * Windows
    $ .\.venv\Scripts\activate
  • Install Panther * Normal
    $ pip install panther
    * Include MongoDB Requirements
    $ pip install panther[full]

Usage

  • Create Project

    $ panther create <project_name> <directory>
    
  • Run Project

    Panther uses Uvicorn as ASGI (Asynchronous Server Gateway Interface)

    $ panther run 
    
  • Monitoring Requests

    $ panther monitor 
    
  • Python Shell

    Panther Uses bpython for shell

    $ panther shell 
    

Example

  • You can create project with

    $ panther create myproject
    
  • or create it yourself:

    core/configs.py:

    URLs = 'core.urls.url_routing'
    

    core/urls.py:

    from app.urls import urls as app_urls
    
    url_routing = {
        '/': app_urls,
    }
    

    app/urls.py:

    from app.apis import hello_world, info
    
    urls = {
        '': hello_world,
        'info/': info,
    }
    

    app/apis.py:

    from datetime import datetime, timedelta
    
    from panther.app import API
    from panther import version, status
    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)
    
  • Then run the project:

    • $ cd myproject
    • $ panther run or $ panther run --reload

    now you can see these two urls:

Next Step: First CRUD

Real Word Example: Https://GitHub.com/PantherPy/panther-example


roadmap


Support

If you find this project useful, please give it a star ⭐️.

Project details


Release history Release notifications | RSS feed

This version

3.1.1

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.1.1.tar.gz (43.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

panther-3.1.1-py3-none-any.whl (47.6 kB view details)

Uploaded Python 3

File details

Details for the file panther-3.1.1.tar.gz.

File metadata

  • Download URL: panther-3.1.1.tar.gz
  • Upload date:
  • Size: 43.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for panther-3.1.1.tar.gz
Algorithm Hash digest
SHA256 4e80923d53ded16506256e0d692a5abcdcea3b1cfe20496b0df6abc065a247de
MD5 580c12f3438f35ccf3601d04b4064658
BLAKE2b-256 ac69be6e455380178e41abe2ac4db7585fc10b625673b748d4d3ccd6798fc08b

See more details on using hashes here.

File details

Details for the file panther-3.1.1-py3-none-any.whl.

File metadata

  • Download URL: panther-3.1.1-py3-none-any.whl
  • Upload date:
  • Size: 47.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for panther-3.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 94622b31e9ff3de2d0fc340a288211ca714c21ab57979d3ca4cf80521c8b2c51
MD5 c6dd344b8b38323dff283dfb1c7c1988
BLAKE2b-256 13b0ecc9cf674528fcea0a38b82d9bcbd5386626d5d27cb29091eb3325f896f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page