Metadata-Version: 2.4
Name: fastgemini
Version: 0.1.3
Summary: FastAPI-style Gemini Protocol Framework
Author: Viktor Tereshchenko
Author-email: Viktor Tereshchenko <m0nochr0me@gmail.com>
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
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: Topic :: Communications :: BBS
Requires-Dist: cffi>=2.0.0
Requires-Dist: cryptography>=46.0.3
Requires-Dist: pydantic>=2.12.5
Requires-Python: >=3.14
Project-URL: Homepage, https://github.com/m0nochr0me/fastgemini
Project-URL: Repository, https://github.com/m0nochr0me/fastgemini
Description-Content-Type: text/markdown

# FastGemini

A FastAPI-style framework for building Gemini protocol servers in Python.

## Features

- 🚀 **FastAPI-style decorators** - Define routes with familiar `@app.route()` syntax
- 📦 **Router support** - Organize routes with `GeminiRouter` (like APIRouter)
- 🔧 **Path parameters** - Extract values from URLs: `/user/{username}`
- ⚡  **Async/await** - Built on asyncio for high-performance async I/O
- 🛡️ **TLS/SSL** - Native client certificate support
- 🎯 **Type hints** - Full Pydantic integration for request/response models

## Installation

```bash
pip install fastgemini
```

## Quick Start

```python
from fastgemini import GeminiApp, success
from fastgemini.schema import GeminiRequest, GeminiResponse

app = GeminiApp(
    certfile="path/to/cert.cer",
    keyfile="path/to/key.key",
)

@app.route("/")
async def index(request: GeminiRequest) -> GeminiResponse:
    return success("# Welcome to Gemini!\n")

@app.route("/hello/{name}")
async def hello(request: GeminiRequest) -> GeminiResponse:
    name = request.path_params["name"]
    return success(f"# Hello, {name}!\n")

if __name__ == "__main__":
    app.run()
```

## Using Routers

```python
from fastgemini import GeminiApp, GeminiRouter, success

app = GeminiApp(
    certfile="path/to/cert.cer",
    keyfile="path/to/key.key",
)
users = GeminiRouter(prefix="/users")

@users.route("/")
async def list_users(request):
    return success("# Users\n=> /users/alice Alice\n")

@users.route("/{username}")
async def get_user(request):
    return success(f"# User: {request.path_params['username']}\n")

app.include_router(users)
```

## Response Helpers

```python
from fastgemini import success, redirect, not_found, input_required, error

# Success with body
success("# Hello World\n")

# Redirects
redirect("/new-location")
redirect("/permanent", permanent=True)

# Errors
not_found("Page not found")
error("Something went wrong")

# Input prompts
input_required("Enter your name:")
input_required("Enter password:", sensitive=True)
```
