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
pip install fastgemini
Quick Start
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
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
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)
Metadata
Release files for fastgemini 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fastgemini-0.1.4.tar.gz | 9.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastgemini-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.4 kB
Release files / fastgemini-0.1.4.tar.gz
| Download URL | fastgemini-0.1.4.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9afabe4936433ceb33416183a3046d831b093661203813ec0b75ae4ffaff6db5
|
|
BLAKE2b-256 checksum How to use checksums |
52c60df08d05425cbd690a775f80e1a728ed8b823800aaee9f459de7ef0eec67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / fastgemini-0.1.4-py3-none-any.whl
| Download URL | fastgemini-0.1.4-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f83af1f98ae808ee273d35522c48cd8ca716c385fc1a9268ed8b21bfefb588eb
|
|
BLAKE2b-256 checksum How to use checksums |
dae7e59c5f0978025456ae9c102a8f261986c1179af43498a7aac65cb8f97b81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for fastgemini 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.