Skip to main content

Async (ASGI) Python web framework

Project description

alt text

Backendpy

Python web framework for building the backend of your project!

Some features:

  • Asynchronous programming (ASGI-based projects)
  • 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 and hooks
  • 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 templating layer by the Jinja template engine

Requirements

Python 3.8+

Documentation

Documentation is available at https://backendpy.readthedocs.io.

Quick Start

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

Create Project

project/main.py

from backendpy import Backendpy

bp = Backendpy()

Create Application

project/apps/hello/main.py

from backendpy.app import App
from .handlers import routes

app = App(
    routes=[routes])

project/apps/hello/handlers.py

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

routes = Routes()

@routes.get(r'^/hello-world$')
async def hello(request):
    return Text('Hello World!')

Activate Application

project/config.ini

[networking]
allowed_hosts =
    127.0.0.1:8000

[apps]
active =
    project.apps.hello

Run Project

Inside the project root path:

$ uvicorn main:bp

Command line

The basic structure of a project mentioned above can also be created by commands:

$ backendpy create_project --name myproject

To create a project with more complete sample components:

$ backendpy create_project --name myproject --full

Or to create an application:

$ backendpy create_app --name myapp
$ backendpy create_app --name myapp --full

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.9a2.tar.gz (33.6 kB view details)

Uploaded Source

Built Distribution

backendpy-0.1.9a2-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: backendpy-0.1.9a2.tar.gz
  • Upload date:
  • Size: 33.6 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.9a2.tar.gz
Algorithm Hash digest
SHA256 39fe2efea8c3b6b448234d407cabd2c7d57411d062340f315448531f2500249c
MD5 e9772f88a59a51900184fb5ca976da57
BLAKE2b-256 56b94e7cc2b76fbce81fd83ab17a8259d96b0cebf77b6576fde238aae0b5224e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: backendpy-0.1.9a2-py3-none-any.whl
  • Upload date:
  • Size: 40.8 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.9a2-py3-none-any.whl
Algorithm Hash digest
SHA256 dced38c6e38328df38b59a28a20b660c41180e86ea3b7124c0fd9bd497122078
MD5 c364cd17a2fc34462a891dba766c0e21
BLAKE2b-256 07332e37d116920f54619be4e24532f508d0823d750c9168b508aa1f0f0aa90c

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