Skip to content

Python ASGI framework written as educational project.

License

Notifications You must be signed in to change notification settings

kirillzhosul/smile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smile

Python ASGI framework written as educational project.

Installing.

Currently package is not published as it is written as educational project!

Goal.

As I already said many times, this is educational project, there is no goal to make something very very unique!

Example

from smile import Smile, HTMLResponse

app = Smile()

# Also there is
# from smile import Request
# with argument of that type Smile will auto pass it to your route handler!


@app.route("/html")
async def html_route(optional_query_param: int = 0):
    return HTMLResponse("<h1>Hello world!</h1>", 200)

@app.route("/json")
async def json_response(required_query_param: str):
    return {"q": required_query_param}, 404

Roadmap.

  • ASGI app
  • Route && decorators (with allowed HTTP methods).
  • Params (with special internal types).
  • Error handlers (for code).
  • Templating engine (Jinja2)
  • Rework routing system with more advanced solution.
  • Body data fetching.
  • Exception error handlers.
  • Middlewares
  • Refactor code and internal caused responses.
  • More...

Running with Uvicorn

import uvicorn
from app.app import app

uvicorn.run(app, port=8000)

Releases

No releases published

Languages