Skip to main content

A web framework based on ASGI

Project description


A web framework based on ASGI. This is inspired by the Express framework for node.js.

Current status

Still not production-ready.

This API is currently experimental, and is subject to change at any time.

As such, please don't use this for production applications yet.

However, please do play around with it. Any feedback at this stage is welcome as the API becomes more stable.


Python 3.6+


Via pip

Run the following:

$ pip install nardis

From source

To build from source, clone this repo, and then:

$ python install


Here's a quick example you can use. Create an and copy and paste this:

from nardis.asgi import main
from nardis.routing import Get as get, Post as post
import asyncio

template_start = """
<!doctype html>

template_end = """

async def index(req, res):
    This just demonstrates that you can write async code. Don't actually write this in production.
    await res.send(template_start, more=True)
    for x in range(10, 0, -1):
        await res.send(f"<p>{x}!</p>", more=True)
        await asyncio.sleep(1)
    await res.send("<p>liftoff!</p>", more=True)
    await res.send(template_end)

async def hello(req, res):
    Try going to

    You'll see "Hello, your_name!"
    name = req.params.get('name', 'world')
    await res.send(f"<h1>Hello, {name}!</h1>")

routes = [
    get(r"^/?$", index),
    get(r"^/hello/(?P<name>\w+)/?$", hello),

config = {
    'routes': routes,

app = main(config)  # this is the ASGI application

if __name__ == '__main__':
    from import run
    run(app, '', 8000)

And then:

$ python

Alternatively, you could also do the following:

$ uvicorn application:app

This should start a server on

Using other web servers

Currently, Uvicorn is a dependency of Nardis.

The codebase doesn't actually use Uvicorn, but this dependency allows you to run your application quickly (see above example). This dependency might be removed in the future.

Nardis should also work with other ASGI-based web servers, like Daphne.

To get Daphne working with the example code above, you could do the following:

$ daphne application:app

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for nardis, version 0.0.7
Filename, size File type Python version Upload date Hashes
Filename, size nardis-0.0.7-py3-none-any.whl (7.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size nardis-0.0.7.tar.gz (5.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page