Skip to main content

A light and fast ASGI web framework

Project description

virapi 🚀

A lightweight and fast ASGI web framework built from scratch with FastAPI-inspired design.

✨ Features

  • 🔗 FastAPI-Style API: Familiar decorators (@app.get, @app.post) and patterns
  • 🎯 Advanced Routing: Path parameters with type conversion ({id:int}, {name:str})
  • 🔧 Modular Design: Organize code with APIRouter and prefixes
  • 🛠️ Middleware System: Request/response pipeline with built-in middleware
  • 📡 ASGI 3.0 Compatible: Works with uvicorn, hypercorn, and other ASGI servers
  • 🔄 Full Request/Response: JSON, forms, file uploads, cookies, headers
  • 🧪 Testing Framework: Built-in test client for easy endpoint testing
  • 📚 Excellent Documentation: Every component is thoroughly documented

🚀 Quick Start

from virapi import Virapi, json_response

app = Virapi()

@app.get("/")
async def home(request):
    return json_response({"message": "Hello, virapi!"})

@app.get("/users/{user_id:int}")
async def get_user(user_id: int, request):
    return json_response({"user_id": user_id, "type": type(user_id).__name__})

# Run with: uvicorn main:app --reload

🏗️ Architecture Overview

virapi/
├── virapi.py          # Main application class
├── request/             # Request handling & file uploads
├── response.py          # Response building & content types
├── routing/             # Advanced routing system
├── middleware/          # Middleware chain & built-ins
├── testing/             # Test client & utilities
└── status.py           # HTTP status codes

📚 Learn More

🛠️ Installation & Development

# Clone the repository
git clone https://github.com/victorgomez09/virapi.git
cd virapi

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run examples
python examples/complete_example.py

🤝 Contributing

This is an educational project! Contributions that improve code clarity, add educational value, or enhance documentation are especially welcome.

📄 License

MIT License - Feel free to use this code for learning and teaching!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

virapi-0.1.0.tar.gz (33.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

virapi-0.1.0-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file virapi-0.1.0.tar.gz.

File metadata

  • Download URL: virapi-0.1.0.tar.gz
  • Upload date:
  • Size: 33.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for virapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 85960e07fcf7b35400f925597416f06a080aa246d4e7c71cad11c5dc71a1c27d
MD5 478481985c9c026ad3e9280d6b877c8d
BLAKE2b-256 4f0b0e54c9f969ca2f9318cdc191a88ea8886cb6f228120775a5b806f52a3784

See more details on using hashes here.

File details

Details for the file virapi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: virapi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for virapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52c15cd5cb2503615e42667f8918dfddc46d8e75d3837493b35df6840a8a0701
MD5 a5e70c9343da4147099f503428c7c75d
BLAKE2b-256 29f86e5a3f71b7b59eafc01fb57af5ccd3790492d1f08b08883d7b25ab3db17e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page