Metadata-Version: 2.2
Name: astraapi
Version: 0.2.1
Summary: AstraAPI framework, high performance, easy to learn, fast to code, ready for production
Author-Email: Rana718 <ranadolui718@gmail.com>
License: MIT
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development
Classifier: Typing :: Typed
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: AsyncIO
Classifier: Framework :: Pydantic
Classifier: Framework :: Pydantic :: 2
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Internet :: WWW/HTTP
Project-URL: Homepage, https://github.com/Lumos-Labs-HQ/Astraapi
Project-URL: Repository, https://github.com/Lumos-Labs-HQ/Astraapi
Project-URL: Issues, https://github.com/Lumos-Labs-HQ/Astraapi/issues
Requires-Python: >=3.14
Requires-Dist: pydantic>=2.7.0
Requires-Dist: typing-extensions>=4.8.0
Requires-Dist: typing-inspection>=0.4.2
Requires-Dist: annotated-doc>=0.0.2
Requires-Dist: uvloop>=0.22.1; sys_platform != "win32"
Requires-Dist: winloop>=0.5.0; sys_platform == "win32"
Requires-Dist: watchfiles>=1.1.1
Requires-Dist: orjson>=3.11.5
Provides-Extra: standard
Requires-Dist: httpx<1.0.0,>=0.23.0; extra == "standard"
Requires-Dist: jinja2>=3.1.5; extra == "standard"
Requires-Dist: python-multipart>=0.0.18; extra == "standard"
Requires-Dist: email-validator>=2.0.0; extra == "standard"
Requires-Dist: pydantic-settings>=2.0.0; extra == "standard"
Requires-Dist: pydantic-extra-types>=2.0.0; extra == "standard"
Provides-Extra: all
Requires-Dist: httpx<1.0.0,>=0.23.0; extra == "all"
Requires-Dist: jinja2>=3.1.5; extra == "all"
Requires-Dist: python-multipart>=0.0.18; extra == "all"
Requires-Dist: itsdangerous>=1.1.0; extra == "all"
Requires-Dist: pyyaml>=5.3.1; extra == "all"
Requires-Dist: ujson>=5.8.0; extra == "all"
Requires-Dist: orjson>=3.9.3; extra == "all"
Requires-Dist: email-validator>=2.0.0; extra == "all"
Requires-Dist: pydantic-settings>=2.0.0; extra == "all"
Requires-Dist: pydantic-extra-types>=2.0.0; extra == "all"
Provides-Extra: dev
Requires-Dist: anyio[trio]<5.0.0,>=3.2.1; extra == "dev"
Requires-Dist: coverage[toml]<8.0,>=6.5.0; extra == "dev"
Requires-Dist: dirty-equals>=0.9.0; extra == "dev"
Requires-Dist: flask<4.0.0,>=3.0.0; extra == "dev"
Requires-Dist: inline-snapshot>=0.21.1; extra == "dev"
Requires-Dist: mypy>=1.14.1; extra == "dev"
Requires-Dist: pwdlib[argon2]>=0.2.1; extra == "dev"
Requires-Dist: pyjwt>=2.9.0; extra == "dev"
Requires-Dist: pytest<9.0.0,>=7.1.3; extra == "dev"
Requires-Dist: pytest-codspeed>=4.2.0; extra == "dev"
Requires-Dist: pyyaml<7.0.0,>=5.3.1; extra == "dev"
Requires-Dist: sqlmodel>=0.0.31; extra == "dev"
Requires-Dist: strawberry-graphql<1.0.0,>=0.200.0; extra == "dev"
Requires-Dist: types-orjson>=3.6.2; extra == "dev"
Requires-Dist: types-ujson>=5.10.0.20240515; extra == "dev"
Requires-Dist: a2wsgi<=2.0.0,>=1.9.0; extra == "dev"
Requires-Dist: starlette<1.0.0,>=0.40.0; extra == "dev"
Requires-Dist: httpx<1.0.0,>=0.23.0; extra == "dev"
Requires-Dist: websockets<15.0,>=12.0; extra == "dev"
Requires-Dist: uvicorn<1.0.0,>=0.30.0; extra == "dev"
Requires-Dist: jinja2>=3.1.5; extra == "dev"
Requires-Dist: python-multipart>=0.0.18; extra == "dev"
Requires-Dist: email-validator>=2.0.0; extra == "dev"
Requires-Dist: pydantic-settings>=2.0.0; extra == "dev"
Requires-Dist: pydantic-extra-types>=2.0.0; extra == "dev"
Description-Content-Type: text/markdown

<p align="center">
  <img src="https://raw.githubusercontent.com/Lumos-Labs-HQ/Astraapi/main/docs/public/icon.png" width="120" height="120" style="border-radius: 24px;" alt="AstraAPI">
</p>

<h1 align="center">AstraAPI</h1>

<p align="center">
  <b>FastAPI-compatible. C++ core. Built-in workers. No gunicorn needed.</b>
</p>

<p align="center">
  <a href="https://pypi.org/project/astraapi"><img src="https://img.shields.io/badge/pypi-v0.2.0-blue?logo=pypi" alt="PyPI"></a>
  <a href="https://github.com/Lumos-Labs-HQ/Astraapi/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="License"></a>
  <img src="https://img.shields.io/badge/python-3.14%2B-blue" alt="Python">
  <img src="https://img.shields.io/badge/C++-20-orange" alt="C++20">
</p>

---

**AstraAPI** is a drop-in replacement for [FastAPI](https://fastapi.tiangolo.com/) with a compiled C++20 core. Same decorators. Same Pydantic models. Same OpenAPI docs. But 5-10x faster — no external server required.

```python
from astraapi import AstraAPI

app = AstraAPI()

@app.get("/")
def hello():
    return {"message": "Hello World"}

if __name__ == "__main__":
    app.run(port=8000, workers=4)
```

Output:
```
C++ HTTP server running on http://127.0.0.1:8000
Press Ctrl+C to stop
```

## Why AstraAPI?

| | FastAPI + Uvicorn | AstraAPI |
|---|---|---|
| HTTP parser | `httptools` (Python) | **llhttp** (C++, Node.js) |
| JSON | `orjson` | **yyjson** + SIMD serializer |
| Workers | gunicorn/uvicorn | **Built-in** fork/spawn |
| Keep-alive | Per-connection timers | **Batch sweep** |
| Compression | zlib | **libdeflate** (2-3x faster) |
| Throughput | ~45k req/s | **~236k req/s** |

## Install

```bash
pip install astraapi
```

Python 3.14+

## Quick Start

```bash
python -m astraapi --help
```

Or write a file:

```python
from astraapi import AstraAPI
from pydantic import BaseModel

app = AstraAPI()

class Item(BaseModel):
    name: str
    price: float

@app.get("/items/{item_id}")
def read_item(item_id: int, q: str | None = None):
    return {"item_id": item_id, "q": q}

@app.post("/items/")
def create_item(item: Item):
    return item

if __name__ == "__main__":
    app.run(port=8000, workers=4)
```

## Features

- **100% FastAPI compatible** — same `@app.get`, `Depends`, `BaseModel`, `Query`, `Path`, `File`, `UploadFile`, `WebSocket`, `BackgroundTasks`
- **Built-in multi-worker server** — `SO_REUSEPORT`, CPU affinity, auto-restart. No gunicorn.
- **C++ HTTP core** — llhttp parser, radix trie router, yyjson, SIMD string escape, ryu float formatting
- **Zero-copy transport** — direct `send()` for small responses, `writev()` for WebSockets
- **Native middleware** — CORS, GZip (libdeflate), TrustedHost, HTTPSRedirect, RateLimiting
- **Real TestClient** — starts actual C++ HTTP server on ephemeral port
- **Hot reload** — `app.run(reload=True)` watches files via `watchfiles`

## Documentation

Visit [https://astraapi.dev](https://astraapi.dev) or the [docs](./docs) folder.

## License

MIT — see [LICENSE](LICENSE).

<p align="center">
  Made with ⚡ by <a href="https://github.com/Lumos-Labs-HQ">Lumos Labs HQ</a>
</p>
