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
project/main.py
from backendpy import Backendpy
from backendpy.response import Text
application = Backendpy()
@application.uri(r'^/hello-world$', ['GET'])
async def hello(request):
return Text('Hello, World!')
Run inside the project path:
$ uvicorn main:application
Backendpy app based usage
Example app:
hello_app/main.py
from backendpy.app import App
from .handlers import routes
app = App(
routes=[routes])
hello_app/handlers.py
from backendpy.router import Routes
from backendpy.response import Text
routes = Routes()
@routes.uri(r'^/hello-world$', ['GET'])
async def hello(request):
return Text('Hello World!')
Example project:
project/main.py
from backendpy import Backendpy
application = Backendpy()
project/config.ini
[apps]
active =
app_python_path.hello_app
Run project with uvicorn main:application
Command line
Project creation
$ backendpy create_project --name myproject
And to create a project with more complete sample components:
$ backendpy create_project --name myproject --full
App creation
$ 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
backendpy-0.1.4a2.tar.gz
(24.7 kB
view details)
Built Distribution
File details
Details for the file backendpy-0.1.4a2.tar.gz
.
File metadata
- Download URL: backendpy-0.1.4a2.tar.gz
- Upload date:
- Size: 24.7 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 | 45509f8cb7295ed50b0523bb0e8d3189ab4fbc133b03876c2bb5c77abdd6294c |
|
MD5 | fb61a0203e23d7f277cc67b1c43164e8 |
|
BLAKE2b-256 | 1f79c4b49aae7f86cd27fcf6a57b26d6fa8745d45a604208f71b0918f50e89b3 |
File details
Details for the file backendpy-0.1.4a2-py3-none-any.whl
.
File metadata
- Download URL: backendpy-0.1.4a2-py3-none-any.whl
- Upload date:
- Size: 29.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 | 379e60759ef40af3070969e46105810cbd7d604b2ef0e9684f18444acfe39c6f |
|
MD5 | c0793012f3b0a5c87ce38a0930aad8ad |
|
BLAKE2b-256 | de4b9ed370775cf3907510939a311522c2926faebae4acd710d1f3fb45301218 |