Skip to main content

Maintenance Percentage of issues still open

Ario - Python Lightweight Micro Framework

flask-based framework which is working with jinja2 and wrekzeug

This framework has been developed by Wish Team for web development purpose. This project is maintained by this team and hope make web development easier and faster.

Motivation

The main concept of this framework is like flask. but it's only work like a dispatcher and you could easily use any library you want. you are not dependant to any 3rd specific libraries and also you do not have any regex in matching for your url which may cause ReDos to your system. you could specify the result of your response with just a decorator like @html or @jinja which is help for focusing on your development only.

Instalation

Install and update using pip:

pip install ario

Usage

First of all you should import classes that you want. RouterController, Endpoint, Application should be imported and json, html, setup_jinja, jinja, redirect, forbidden, ok are arbitrary.

from werkzeug.serving import run_simple
from werkzeug.middleware.shared_data import SharedDataMiddleware
from ario import RouterController, Endpoint, Application, json, jinja2
from ario.status import forbidden, ok

For seting up your template:

setup_jinja("./templates")

For instance if we want to define two endpoint that one of them is json and the latter is jinja, we should define them as below:

control = RouterController(debug=True)

@control.route(method=["GET", "POST", "HEAD"], route="/")
class ExampleEndpoint(Endpoint):
    @json
    def get(request, response):
        data = {
            "name": "john",
            "family_name": "doe",
            "age": 21,
            "phone_number": "12345678"
        }
        return data
@control.route(method=["GET", "POST"], route="/user/$id")
class ExampleEndpoint(Endpoint):
    @jinja("base.html")
    def get(request, response, id):
        params = {"my_string": id, "my_list": [0, 1, 2]}
        return params

remeber for using jinja decorator, you should insert a base.html file in template folder After all, we make a socket to our port use werkzeug:

if __name__ == '__main__':
    app = Application(control)
    app = SharedDataMiddleware(app, {
        '/static': os.path.join(os.path.dirname(__file__), 'templates/static')
    })
    print('Demo server started http://localhost:5000')
    run_simple('127.0.0.1', 5000, app, use_debugger=True, use_reloader=True)

You could run your code easily by just typing python yourfile.py

Release files for ario 0.6.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ario 0.6.9
File Size Uploaded
ario-0.6.9.tar.gz 12.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ario 0.6.9
File Interpreter ABI Platform
ario-0.6.9-py3-none-any.whl Python 3 none any Details

Total release size: 27.0 kB

Release files / ario-0.6.9.tar.gz

Download URL ario-0.6.9.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5c11b0057a42a62db87cb5c0b6c81283006fb3728b8c64cae974710dcf4910b6
BLAKE2b-256 checksum
How to use checksums
4a8d758838749915f48f37a64f048c3a85043cc5831aae3a0920edd1c4c23df1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

Release files / ario-0.6.9-py3-none-any.whl

Download URL ario-0.6.9-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d129bb694e2820c77103b2d32c8fa9dc94430ff76b88642fd973ddd50975aaec
BLAKE2b-256 checksum
How to use checksums
032bedc3710a4442451f9447077b0e92bfa6d2661c3085246345e3999d5fa411
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.6.9 This release

2 release files

0.6.8

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.3.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page