Skip to main content

PROTON : A proton sized web framework

Proton is an Express inspired proton sized web framework for building backend web applications from void. Currently, it has features of adding routes, controllers and sending API responses (Refer the example blog app for reference). Defining models with custom field types is also available but is under development.

Status : Under developement

To run example app

$ pip3 install -r requirements.txt

$ python3 main.py run:<appname>

Documentation

Step 1: Install proton and create folder structure

$ pip3 install proton-py

$ touch models.py
$ touch controllers.py
$ touch routes.py
$ touch main.py

Step 2: Define your models

# models.py
from proton.db import model

class User(model.Model):
    username = model.StringType('username', max_length=50, min_length=4, unique=True, required=True)
    # define your model here

Step 2: Define your controllers

# controllers.py
from proton.handler import Response

def index(req):
    # define your controller here
    return Response(status=200, data={"msg": "message"})

Step 3: create a router and assign controllers with routes

# routes.py
from proton.handler import Router
from .controllers import index

router = Router()
router.get("/", index)

Step 4: create proton app and assemble your router and models

# main.py
from proton import Proton, run
from .routes import router
from .models import User

api = Proton()

api.set_router('/api', router)
api.set_models(User)

run(api)

Step 5: Boot your models to db and run the server

$ python3 main.py run:db
$ python3 main.py run:api

Refer the example blog app for folder structure. Working on a better documentation

Metadata

Release files for void-proton 0.1.0

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

Source distribution (sdist)

Source distribution for void-proton 0.1.0
File Size Uploaded
void-proton-0.1.0.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for void-proton 0.1.0
File Interpreter ABI Platform
void_proton-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.4 kB

Release files / void-proton-0.1.0.tar.gz

Download URL void-proton-0.1.0.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5ebe646251c442c7eb7296827dd8e5af6504b150aee9be735a145cd491d57f28
BLAKE2b-256 checksum
How to use checksums
2897f35ee8e005e12df6f9334665a8c465c62dd0e9ac277ad06176a97c8f0923
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / void_proton-0.1.0-py3-none-any.whl

Download URL void_proton-0.1.0-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f285dbc6952386437aca7c5a81a6946c07b1a88ea34587981e43a3b381b1714c
BLAKE2b-256 checksum
How to use checksums
9cecb33d820d2192fd2d1d42fa492e9ee8df8e2db0760d5ad84bbd7cfd485d17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

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