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('/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.2.7a2.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

backendpy-0.2.7a2-py3-none-any.whl (47.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: backendpy-0.2.7a2.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for backendpy-0.2.7a2.tar.gz
Algorithm Hash digest
SHA256 94c335c8521cf99916bf6b2c83eb3c1d8c78ffe009fd6088e178b9f1f21d2b9f
MD5 09993438e77ae5f19cb7dd6e5877b90e
BLAKE2b-256 297e578417a76d7395452e92ae1e3c86216f6f5c23687292b04ec75235f9f989

See more details on using hashes here.

File details

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

File metadata

  • Download URL: backendpy-0.2.7a2-py3-none-any.whl
  • Upload date:
  • Size: 47.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for backendpy-0.2.7a2-py3-none-any.whl
Algorithm Hash digest
SHA256 5e957cc0c803afe706265c714abebd13f2a45af59303e33a1d190d5585cf0ce6
MD5 517a7d9aaf0c0aadb4c83dd80beaa067
BLAKE2b-256 19b62312a806def171ec294791da0412b03364cb6afe2e75a27a5667314279d9

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