Skip to main content

Fast & Friendly, Web Framework For Building Async APIs

Project description

Panther

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

logo

logo Supported by JetBrain

Full Documentation: https://pantherpy.github.io


Why Use Panther?

  • Document-oriented Databases ODM (PantherDB, MongoDB)
  • Visual API Monitoring (In Terminal)
  • Caching for APIs (In Memory, In Redis)
  • Built-in Authentication Classes (Customizable)
  • Built-in Permission Classes (Customizable)
  • Handle Custom Middlewares
  • Handle Custom Throttling

Installation

  • Create a Virtual Environment
    $ python -m venv .venv
  • Active The Environment * Linux & Mac
    $ source .venv/bin/activate
    * Windows
    $ .\.venv\Scripts\activate
  • Install Panther * Normal
    $ pip install panther
    * Include JWT Authentication
    $ 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.py'
    

    core/urls.py:

    from app.urls import urls as app_urls
    
    urls = {
        '/': 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.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)
    
  • Then run ($ panther run) the project, now you can see these two urls:

Writing Your First CRUD: First CRUD


TODOs

  • Base
    • ✅ Start with Uvicorn
    • ✅ Fix URL Routing
    • ✅ Read Configs
    • ✅ Handle Exceptions
    • ✅ Add Custom Logger
    • ✅ Request Class
    • ✅ Response Class
    • ✅ Validate Input
    • ✅ Custom Output Model
    • ✅ Log Queries
    • ✅ Add Package Requirements
    • ✅ Custom Logging
    • ✅ Caching
    • ✅ Handle Path Variable
    • ✅ Handle Simple Form-Data
    • ✅ Handle Throttling
    • ☐ Handle Complex Form-Data
    • ☐ Handle File
    • ☐ Handle Cookie
    • ☐ Handle WS
    • ☐ Handle GraphQL
    • ☐ Handle Testing
    • ☐ Generate Swagger For APIs
    • ☐ Handle ClassBase APIs
  • Database
    • ✅ Structure Of DB Connection
    • ✅ PantherDB Connection
    • ✅ MongoDB Connection
    • ✅ Create Custom BaseModel For All Type Of Databases
    • ✅ Set PantherDB As Default
  • Custom ODM
    • ✅ Find One
    • ✅ Find
    • ✅ Last
    • ✅ Count
    • ✅ Insert One
    • ✅ Insert Many
    • ✅ Delete One
    • ✅ Delete Many
    • ✅ Delete Itself
    • ✅ Update One
    • ✅ Update Many
    • ✅ Update Itself
    • ✅ Find or Insert
    • ✅ Save
    • ☐ Find or Raise
    • ☐ Find with Pagination
    • ☐ Aggregation
    • ☐ Complex Pipelines
    • ☐ ...
  • Middleware
    • ✅ Add Middlewares To Structure
    • ✅ Create BaseMiddleware
    • ✅ Pass Custom Parameters To Middlewares
    • ✅ Handle Custom Middlewares
  • Authentication
    • ✅ JWT Authentication
    • ✅ Separate Auth For Every API
    • ✅ Handle Permissions
    • ☐ Token Storage Authentication
    • ☐ Cookie Authentication
    • ☐ Query Param Authentication
    • ☐ Store JWT After Logout In Redis/ Memory
  • Cache
    • ✅ Add Redis To Structure
    • ✅ Create Cache Decorator
    • ✅ Handle In-Memory Caching
    • ✅ Handle In Redis Caching
    • ☐ Write Async LRU_Caching With TTL (Replace it with in-memory ...)
  • CLI
    • ✅ Create Project
    • ✅ Run Project
    • ✅ Create Project with Options
    • ✅ Monitoring With Textual
    • ✅ Monitor Requests, Response & Time
  • Documentation
    • ✅ Create MkDocs For Project
    • ✅ Benchmarks
    • ✅ Release Notes
    • ✅ Features
    • ☐ Complete The MkDoc
  • Tests
    • ✅ Start Writing Tests For Panther
    • ☐ Test Client

Support

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

Uploaded Source

Built Distribution

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

panther-1.7.21-py3-none-any.whl (40.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for panther-1.7.21.tar.gz
Algorithm Hash digest
SHA256 8a46e2963982802e1fc76906a81fa901960393bfd785d89b6b461a8c12bdadb4
MD5 c905cdd5b909e811fcded5880302906b
BLAKE2b-256 07c42aa5777499e5889809f737c2342d15bb37eb6d50eb9fc41c814682117f42

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for panther-1.7.21-py3-none-any.whl
Algorithm Hash digest
SHA256 e0d7a2b1f855a368a3feff15d9a6df8f0c884ca94ea8997d0a640022a9de7f83
MD5 5f1e7c404c019ce4a3be730fe49a46af
BLAKE2b-256 8054b5c76f51b9fd89ba8dd41382fc512ad72cf7d3924391a8b54e2846a70f3d

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