Metadata-Version: 2.1
Name: xpresso
Version: 0.1.0
Summary: A developer centric, performant Python web framework
Home-page: https://github.com/adriangb/xpresso
License: MIT
Keywords: web-framework,http,openapi
Author: Adrian Garcia Badaracco
Author-email: adrian@adriangb.com
Requires-Python: >=3.7,<4
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Internet
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Dist: anyio (>=3,<4)
Requires-Dist: di (>=0.38,<0.39)
Requires-Dist: importlib-metadata (>=3); python_version < "3.8"
Requires-Dist: pydantic (>=1,<2)
Requires-Dist: starlette (>=0.16.0,<2)
Requires-Dist: typing-extensions (>=3); python_version < "3.9"
Project-URL: Documentation, https://www.adriangb.com/xpresso
Project-URL: Repository, https://github.com/adriangb/xpresso
Description-Content-Type: text/markdown

# xpresso

[![codecov](https://codecov.io/gh/adriangb/xpresso/branch/main/graph/badge.svg?token=A0FXC8B93Y)](https://codecov.io/gh/adriangb/xpresso)
![Test & Release](https://github.com/adriangb/xpresso/actions/workflows/workflow.yaml/badge.svg)

## 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](https://swagger.io/docs/specification/serialization/)
- Highly typed and tested codebase with great IDE support
- A powerful dependency injection system, backed by [di]

## Requirements

Python 3.7+

## Installation

```shell
pip install xpresso
```

You'll also want to install an ASGI server, such as [uvicorn](http://www.uvicorn.org/).

```shell
pip install uvicorn
```

## Example

Create a file named `example.py`:

```python
from typing import List, Optional
from pydantic import BaseModel
from xpresso import App, PathItem, FromPath, FromQuery

class UserModel(BaseModel):
    user_id: str
    age: Optional[int] = None

async def get_users(
    ids: FromPath[List[int]],
    include_age: FromQuery[bool],
) -> List[UserModel]:
    if include_age:
        return [UserModel(user_id=user_id, age=123) for user_id in ids]
    return [UserModel(user_id=user_id) for user_id in ids]

app = App(
    routes=[
        PathItem(
            path="/users/{ids}",
            get=get_users
        )
    ]
)
```

Run the application:

```shell
uvicorn example:app
```

For more examples, tutorials and reference materials, see our [documentation].

[Starlette]: https://github.com/encode/starlette
[Pydantic]: https://github.com/samuelcolvin/pydantic/
[FastAPI]: https://github.com/tiangolo/fastapi
[di]: https://github.com/adriangb/di
[documentation]: https://www.adriangb.com/xpresso/

