Async (ASGI) Python web framework
Project description
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
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
Built Distribution
File details
Details for the file backendpy-0.2.2a1.tar.gz
.
File metadata
- Download URL: backendpy-0.2.2a1.tar.gz
- Upload date:
- Size: 36.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | e841b220d5f02aa59be12c446581e1cb0d2f0399b745db6d29afc9c4d5207d02 |
|
MD5 | b254a4b083dfd1b3ff9d8fc73e7c4ccf |
|
BLAKE2b-256 | 296a611fc3a62a124c829ecb6479b34e40d9bf34f48be17387ee680b577d8a0b |
File details
Details for the file backendpy-0.2.2a1-py3-none-any.whl
.
File metadata
- Download URL: backendpy-0.2.2a1-py3-none-any.whl
- Upload date:
- Size: 44.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0535d74462d93440078fbcc81b284e3e0347aa28d4c249128eb3c9df3fe9f27e |
|
MD5 | 07bab4f0c2a7f82c8e8be98fb029036e |
|
BLAKE2b-256 | 80b67480caf32c76879316057e746174183bfa69f15fa56f4b865049a138cd72 |