{"id":29097266,"url":"https://github.com/dymmond/lilya","last_synced_at":"2026-03-04T01:28:35.736Z","repository":{"id":225858313,"uuid":"728789963","full_name":"dymmond/lilya","owner":"dymmond","description":"Yet another ASGI toolkit that delivers","archived":false,"fork":false,"pushed_at":"2026-02-25T23:40:11.000Z","size":2771,"stargazers_count":66,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-02-26T00:54:33.791Z","etag":null,"topics":["async","asyncio","framework","http","python","toolkit","web","websockets"],"latest_commit_sha":null,"homepage":"https://lilya.dev","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dymmond.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["tarsil"]}},"created_at":"2023-12-07T17:43:50.000Z","updated_at":"2026-02-25T23:40:13.000Z","dependencies_parsed_at":"2026-02-08T22:00:54.343Z","dependency_job_id":null,"html_url":"https://github.com/dymmond/lilya","commit_stats":null,"previous_names":["dymmond/lilya"],"tags_count":138,"template":false,"template_full_name":null,"purl":"pkg:github/dymmond/lilya","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dymmond%2Flilya","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dymmond%2Flilya/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dymmond%2Flilya/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dymmond%2Flilya/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dymmond","download_url":"https://codeload.github.com/dymmond/lilya/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dymmond%2Flilya/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30068360,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T01:03:42.280Z","status":"ssl_error","status_checked_at":"2026-03-04T01:03:23.410Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","asyncio","framework","http","python","toolkit","web","websockets"],"created_at":"2025-06-28T13:09:09.842Z","updated_at":"2026-03-04T01:28:35.724Z","avatar_url":"https://github.com/dymmond.png","language":"Python","funding_links":["https://github.com/sponsors/tarsil"],"categories":[],"sub_categories":[],"readme":"# Lilya\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://lilya.dev\"\u003e\u003cimg src=\"https://res.cloudinary.com/dymmond/image/upload/v1707501404/lilya/logo_quiotd.png\" alt='Lilya'\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cem\u003e🚀 Yet another ASGI toolkit that delivers. 🚀\u003c/em\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/dymmond/lilya/actions/workflows/test-suite.yml/badge.svg?event=push\u0026branch=main\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/dymmond/lilya/actions/workflows/test-suite.yml/badge.svg?event=push\u0026branch=main\" alt=\"Test Suite\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://pypi.org/project/lilya\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/lilya?color=%2334D058\u0026label=pypi%20package\" alt=\"Package version\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://pypi.org/project/lilya\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/pyversions/lilya.svg?color=%2334D058\" alt=\"Supported Python versions\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://codspeed.io/dymmond/lilya?utm_source=badge\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/endpoint?url=https://codspeed.io/badge/dymmond/lilya\" alt=\"CodSpeed\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n**Documentation**: [https://lilya.dev](https://lilya.dev) 📚\n\n**Source Code**: [https://github.com/dymmond/lilya](https://github.com/dymmond/lilya)\n\n**The official supported version is always the latest released**.\n\n---\n\n## Motivation\n\nIn the world of ASGI, alternatives are always great to have and no tool serves it all.\nLilya, coming from the great inspirations of the ones who paved the way, its a more simple, accurate\nfast and easy to use Python toolkit/framework that aims for simplicity.\n\nA lot of times you won't be needing a fully fledge Python web framework as it can be overwhelming\nfor some simple tasks, instead you would prefer a simple ASGI toolkit that helps you designing\nproduction ready, fast, elegant, maintainable and modular applications.\n\nThis is where Lilya places itself.\n\nAlmost no hard dependencies, 100% pythonic, fully typed and ready for production.\n\n## What does it bring?\n\nLilya comes bearing fruits.\n\n* A lightweight ASGI toolkit/framework.\n* Support for HTTP/WebSocket.\n* Tasks (in ASGI known as background tasks).\n* Lifespan events (on_startup/on_shutdown and lifespan).\n* Native permission system.\n* Middlewares (Compressor, CSRF, Session, CORS...).\n* A native and **optional** [client](https://lilya.dev/lilya-cli).\n* **Directive management control system** for any custom scripts to run inside the application.\n* Little hard dependencies.\n* Compatibility with `trio` and `asyncio`.\n* Dynamic routing system with the help of the native **Include** and minimum boilerplate.\n* Native settings system. No more bloated instances.\n* Native dependency injection that is extremely scalable, clean and fast.\n* Dynamic, native and fast custom serializers.\n\n## Installation\n\nIf you want just the toolkit/framework.\n\n```shell\n$ pip install lilya\n```\n\nIf you want the Lilya client (for scaffolds, and other useful tools)\n\n```shell\n$ pip install lilya[standard]\n```\n\nIf you wish to use to extra functionalities such as the **shell** or **directives**\n(project scaffold generation to speed up).\n\n```shell\n$ pip install lilya[cli,ipython] # for ipython shell\n$ pip install lilya[cli,ptpython] # for ptpython shell\n```\n\nYou can learn more about the [client](https://lilya.dev/directives/discovery) in the documentation.\n\nOr if you want to install everything that will allow you to use all the resources of Lilya, such\nas some specific middlewares.\n\n```shell\n$ pip install lilya[all]\n```\n\n### Additional\n\nYou would want to install an ASGI server such as [palfrey](https://palfrey.dymmond.com), [uvicorn](https://www.uvicorn.org/) or\n[hypercorn](https://pgjones.gitlab.io/hypercorn/) as well.\n\n## Quickstart\n\nIf you are familiar with other Python frameworks and toolkits, Lilya provides you with the same\nfeeling.\n\nA Lilya also uses a [native settings system](https://lilya.dev/settings) which is something that can be extremely useful\nfor any application.\n\n### The normal way\n\n```python\nfrom lilya.apps import Lilya\nfrom lilya.requests import Request\nfrom lilya.responses import Ok\nfrom lilya.routing import Path\n\n\nasync def welcome():\n    return Ok({\"message\": \"Welcome to Lilya\"})\n\n\nasync def user(user: str):\n    return Ok({\"message\": f\"Welcome to Lilya, {user}\"})\n\n\nasync def user_in_request(request: Request):\n    user = request.path_params[\"user\"]\n    return Ok({\"message\": f\"Welcome to Lilya, {user}\"})\n\n\napp = Lilya(\n    routes=[\n        Path(\"/{user}\", user),\n        Path(\"/in-request/{user}\", user_in_request),\n        Path(\"/\", welcome),\n    ]\n)\n```\n\n### Using Lilya to decorate\n\n```python\nfrom lilya.apps import Lilya\nfrom lilya.requests import Request\nfrom lilya.responses import Ok\n\napp = Lilya()\n\n\n@app.get(\"/\")\nasync def welcome():\n    return Ok({\"message\": \"Welcome to Lilya\"})\n\n\n@app.get(\"/{user}\")\nasync def user(user: str):\n    return Ok({\"message\": f\"Welcome to Lilya, {user}\"})\n\n\n@app.get(\"/in-request/{user}\")\nasync def user_in_request(request: Request):\n    user = request.path_params[\"user\"]\n    return Ok({\"message\": f\"Welcome to Lilya, {user}\"})\n```\n\nIs this simple. Although there is a lot to unwrap here. Did you notice the path `/{user}` not only\ndoes not require a `request` to be declared and instead, receives a `user: str`?\n\nWell, Lilya does a lot of internal magic for you. If you don't declare a `request`, that is not a\nproblem as it will only pass it if its there.\n\nIf you have the path parameter declared in the function handler as well, Lilya will automatically\nsearch for the parameters declared and match them against the path parameters declared in the `Path`\nand inject them for you.\n\nPretty cool, right? This is just scratching the surface.\n\n## Definitions\n\nLilya can be considered a framework or a toolkit and the reasoning for it its because each component\nsuch as middlewares, permissions, Path, Router... can be seen as an independent ASGI application.\n\nIn other words, you can build a [middleware](https://lilya.dev/middleware) or a [permission](https://lilya.dev/permissions) and\nshare those with any other existing ASGI framework out there, meaning, you could design a Lilya\napplication, middlewares, permissions and any other component and re-use them in [Esmerald][esmerald]\nor [FastAPI][fastapi] or any other, really.\n\n**Lilya is not a full-fledge framework like [Esmerald][esmerald] or [FastAPI][fastapi], instead**\n**its a lightweight toolkit/framework that can be used to build those as well as working on its own.**\n\n**Example**\n\n```python\nfrom lilya.exceptions import PermissionDenied\nfrom lilya.protocols.permissions import PermissionProtocol\nfrom lilya.requests import Request\nfrom lilya.types import ASGIApp, Receive, Scope, Send\n\n\nclass AllowAccess(PermissionProtocol):\n    def __init__(self, app: ASGIApp, *args, **kwargs):\n        super().__init__(app, *args, **kwargs)\n        self.app = app\n\n    async def __call__(self, scope: Scope, receive: Receive, send: Send) -\u003e None:\n        request = Request(scope=scope, receive=receive, send=send)\n\n        if \"allow-admin\" in request.headers:\n            await self.app(scope, receive, send)\n            return\n        raise PermissionDenied()\n```\n\n## Run the application\n\nTo run the application from the example.\n\n```shell\n$ palfrey myapp:app\nINFO:     Started server process [140552]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Listening on ('127.0.0.1', 8000)\n```\n\n## Migrating from FastAPI\n\nAre you considering a change from FastAPI? Even being a great framework, you would like not to waste time in the migration process.\nFor this reason, we have created the [Lilya Converter](https://lilya-converter.dymmond.com/) to help you with the process and make it as smooth as possible\nand as clean as possible.\n\n## Powered by\n\nWorth mentioning who is helping us.\n\n**JetBrains**\n\n[![JetBrains logo.](https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg)](https://jb.gg/OpenSourceSupport)\n\n[esmerald]: https://lilya.dev/esmerald\n[fastapi]: https://fastapi.tiangolo.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdymmond%2Flilya","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdymmond%2Flilya","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdymmond%2Flilya/lists"}