Skip to main content

Async (ASGI) Python web framework

Project description

alt text

Backendpy

Async (ASGI) Python web framework for building the backend of your project!

Some features:

  • Application-based architecture and the ability to install third-party applications in a project
  • Support of middlewares for different layers such as Application, Handler, Request or Response
  • Supports events by hook feature
  • Data handler classes, including validators and filters to automatically apply to request input data
  • Supports a variety of responses including JSON, HTML, file and… with various settings such as stream, gzip and…
  • Router with the ability to define urls as Python decorator or as separate files
  • Application-specific error codes
  • Optional default database layer by the Sqlalchemy async ORM with management of sessions for the scope of each request
  • Optional default templates layer by the Jinja template engine

Requirements

Python 3.8+

Installation

$ pip3 install backendpy

Or use the following command to install optional additional libraries:

$ pip3 install backendpy[full]

You also need to install an ASGI server such as Uvicorn, Hypercorn or Daphne:

$ pip3 install uvicorn

Examples

Basic usage

asgi.py

from backendpy.app import Backendpy
from backendpy.response import response

backendpy = Backendpy()

@backendpy.uri(r'^/hello-world$', ['GET'])
async def hello(request):
    return response.Text('Hello, World!')

Run:

$ uvicorn asgi:backendpy

Application based usage

Example app:

python_path/hello_app/main.py

from backendpy.app import App
from .handlers import routes

app = App(
    routes=[routes])

python_path/hello_app/handlers.py

from backendpy.router import Routes
from backendpy.response import response

routes = Routes()

@routes.uri(r'^/hello-world$', ['GET'])
async def hello(request):
    return response.Text('Hello World!')

Example project:

project/asgi.py

from backendpy.app import Backendpy

backendpy = Backendpy()

project/config.ini

[apps]
active =
    python_path.hello_app

Run project with uvicorn asgi:backendpy

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

backendpy-0.1.2a2.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

backendpy-0.1.2a2-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

File details

Details for the file backendpy-0.1.2a2.tar.gz.

File metadata

  • Download URL: backendpy-0.1.2a2.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for backendpy-0.1.2a2.tar.gz
Algorithm Hash digest
SHA256 9dc654169901777c6788620b27b1822587e3c4520b6de0785e0b5d5bf682c4b5
MD5 f26addfa22716491379a821851a4e15e
BLAKE2b-256 49029dff7a2eabba5860a4ddd7d4349f62ad36cfba4f37ec48bcaf5e9ac2fa47

See more details on using hashes here.

File details

Details for the file backendpy-0.1.2a2-py3-none-any.whl.

File metadata

  • Download URL: backendpy-0.1.2a2-py3-none-any.whl
  • Upload date:
  • Size: 30.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for backendpy-0.1.2a2-py3-none-any.whl
Algorithm Hash digest
SHA256 51061b30fffcec480dd8b9b3d04f19b5907bed38a82a063e50977ed1adc73264
MD5 aeb7847f39c65d018fd7d3cb55b7844f
BLAKE2b-256 04011a8d87dbe31204d3810a308cbc8cc9d2cfd6db685e23fb586c05787708e2

See more details on using hashes here.

Supported by

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