Async (ASGI) Python web framework
Project description
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
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
backendpy-0.1.3a1.tar.gz
(25.0 kB
view details)
Built Distribution
File details
Details for the file backendpy-0.1.3a1.tar.gz
.
File metadata
- Download URL: backendpy-0.1.3a1.tar.gz
- Upload date:
- Size: 25.0 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 | 6d42ede17180d5568313289753d2b9f2b796b0241a2f65d2c05adddad135ad11 |
|
MD5 | 31d227c670445d6736c6f5e577783a7a |
|
BLAKE2b-256 | 8c1c0b27cce8b48f9f7df96ff94f506c9b9072b716be1d055ce4976bf9a037ad |
File details
Details for the file backendpy-0.1.3a1-py3-none-any.whl
.
File metadata
- Download URL: backendpy-0.1.3a1-py3-none-any.whl
- Upload date:
- Size: 30.6 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 | 2bf50fca3f3b8ba19ccba27ab1ff0b82f16d16018e4b517102996c6d2bbc2f4b |
|
MD5 | b33c31a9a0dffa58bc2260b1a7d466f7 |
|
BLAKE2b-256 | 4f8c23d06ab99c143229db633323af249823e9c124d88d2682a9f6517e4b3fc6 |