Coder Social home page Coder Social logo

sanic's Introduction

Sanic

Join the chat at https://gitter.im/sanic-python/Lobby Build Status PyPI PyPI version

Sanic is a Flask-like Python 3.5+ web server that's written to go fast. It's based on the work done by the amazing folks at magicstack, and was inspired by this article.

On top of being Flask-like, Sanic supports async request handlers. This means you can use the new shiny async/await syntax from Python 3.5, making your code non-blocking and speedy.

Sanic is developed on GitHub. Contributions are welcome!

If you have a project that utilizes Sanic make sure to comment on the issue that we use to track those projects!

Hello World Example

from sanic import Sanic
from sanic.response import json

app = Sanic()

@app.route("/")
async def test(request):
    return json({"hello": "world"})

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8000)

Installation

  • pip install sanic

To install sanic without uvloop or json using bash, you can provide either or both of these environmental variables using any truthy string like 'y', 'yes', 't', 'true', 'on', '1' and setting the NO_X to true will stop that features installation.

  • SANIC_NO_UVLOOP=true SANIC_NO_UJSON=true pip install sanic

Documentation

Documentation on Readthedocs.

Examples

Non-Core examples. Examples of plugins and Sanic that are outside the scope of Sanic core.

Extensions. Sanic extensions created by the community.

Projects. Sanic in production use.

TODO

  • http2

Limitations

  • No wheels for uvloop and httptools on Windows :(

Final Thoughts

▄▄▄▄▄

▀▀▀██████▄▄▄ _______________

▄▄▄▄▄ █████████▄ /

▀▀▀▀█████▌ ▀▐▄ ▀▐█ | Gotta go fast! |

▀▀█████▄▄ ▀██████▄██ | _________________/ ▀▄▄▄▄▄ ▀▀█▄▀█════█▀ |/ ▀▀▀▄ ▀▀███ ▀ ▄▄ ▄███▀▀██▄████████▄ ▄▀▀▀▀▀▀█▌ ██▀▄▄▄██▀▄███▀ ▀▀████ ▄██

▄▀▀▀▄██▄▀▀▌████▒▒▒▒▒▒███ ▌▄▄▀ ▌ ▐▀████▐███▒▒▒▒▒▐██▌ ▀▄▄▄▄▀ ▀▀████▒▒▒▒▄██▀ ▀▀█████████▀ ▄▄██▀██████▀█ ▄██▀ ▀▀▀ █ ▄█ ▐▌ ▄▄▄▄█▌ ▀█▄▄▄▄▀▀▄ ▌ ▐ ▀▀▄▄▄▀ ▀▀▄▄▀

sanic's People

Contributors

seemethere avatar r0fls avatar channelcat avatar yunstanford avatar 38elements avatar messense avatar lixxu avatar zenixls2 avatar ashleysommer avatar kdelwat avatar subyraman avatar antondnepr avatar jpiasetz avatar youknowone avatar agoose77 avatar frzk avatar stopspazzing avatar archelyst avatar sniedes722 avatar jrocketfingers avatar miguelgrinberg avatar qwesda avatar jackfischer avatar monobot avatar kszucs avatar samael500 avatar pahaz avatar webtic avatar seanpar203 avatar argaen avatar

Watchers

James Cloos avatar scfobao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.