A developer centric, performant Python web framework
Project description
Introduction
xpresso is an ASGI web framework built on top of Starlette, Pydantic and di, with heavy inspiration from FastAPI.
Some of the standout features are:
- ASGI support for high performance (within the context of Python web frameworks)
- OpenAPI documentation generation
- Automatic parsing and validation of request bodies and parameters, with hooks for custom extractors
- Full support for OpenAPI parameter serialization
- Highly typed and tested codebase with great IDE support
- A powerful dependency injection system, backed by di
Requirements
Python 3.7+
Installation
pip install xpresso
You'll also want to install an ASGI server, such as Uvicorn.
pip install uvicorn
Example
Create a file named example.py
:
from pydantic import BaseModel
from xpresso import App, Path, FromPath, FromQuery
class Item(BaseModel):
item_id: int
name: str
async def read_item(item_id: FromPath[int], name: FromQuery[str]) -> Item:
return Item(item_id=item_id, name=name)
app = App(
routes=[
Path(
"/items/{item_id}",
get=read_item,
)
]
)
Run the application:
uvicorn example:app
For more examples, tutorials and reference materials, see our documentation.
See this release on GitHub: v0.1.2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xpresso-0.1.2.tar.gz
(38.2 kB
view hashes)
Built Distribution
xpresso-0.1.2-py3-none-any.whl
(65.4 kB
view hashes)