Metadata-Version: 2.1
Name: backendpy
Version: 0.1.0a1
Summary: Async (ASGI) Python web framework
Home-page: https://backendpy.savang.com
Author: Savang Co.
Author-email: backendpy@savang.com
License: BSD 3-Clause License
Project-URL: Bug Tracker, https://github.com/savangco/backendpy/issues
Keywords: Backendpy,Web,Framework,Python,Async,ASGI
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiofiles (>=0.8.0)

![alt text](https://github.com/savangco/backend.py/blob/master/assets/backendpy_logo_small.png?raw=true)

# 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
```shell
$ pip3 install backendpy
```
You also need to install an ASGI server such as Uvicorn, Hypercorn or Daphne:
```shell
$ pip3 install uvicorn
```
### Examples
#### Basic usage

*asgi.py*
```python
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:
```shell
$ uvicorn asgi:backendpy
```

#### Application based usage

Example app:

*python_path/hello_app/main.py*
```python
from backendpy.app import App
from .handlers import routes

app = App(
    routes=[routes])
```
*python_path/hello_app/handlers.py*
```python
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*
```python
from backendpy.app import Backendpy

backendpy = Backendpy()
```
*project/config.ini*
```ini
[apps]
active =
    python_path.hello_app
```
Run project with `uvicorn asgi:backendpy`


