Skip to main content

Olympus

Latest Version Downloads Status License: MIT

Olympus is a Python web framework foundation inspired by the rich routing, middleware, and exception handling systems found in Laravel. It provides a clean, extensible base that you can build upon for full-stack applications, whether you're serving HTML, JSON-based APIs, or file downloads. With Olympus, you can define routes using decorators, group them, apply middlewares globally or at the route level, and handle exceptions elegantly.

Click here for the documentation


🚀 Key Features

  • Expressive Routing System: Define routes via decorators, including route groups, URL parameters, and multiple HTTP methods.
  • Advanced Middleware Support: Apply middleware globally, per route, or per group. Handle pre- and post-request logic easily.
  • Exception Handling & Custom 404: Gracefully handle errors and register custom exception handlers, including global 404 responses.
  • HTTPS Enforcement: Force HTTPS globally or on specific routes/groups with a single middleware.
  • CORS Integration: Easily add CORS headers to your responses, handle preflight requests.
  • JSON, File, and HTML Responses: Return JSON APIs, serve files for download, or integrate a templating engine for HTML rendering.
  • Group Prefixes & Middleware Inheritance: Organize routes into groups that share a prefix, middleware stack, or both.
  • Extensible & Composable: Olympus is designed as a foundational layer. Plug in your own ORM, templating engine, or validation library.

🛠️ Getting Started

Step 1: Install Olympus

Install Olympus via pip:

pip install olympus-framework

(Ensure you have Python 3.8+ available.)

Step 2: Define Your First Route

Create a main.py:

from src.server import run_server
from src.routing.decorators import route
from src.routing.response import Response
from src.routing.router import Router
from src.exceptions_manager import ExceptionsManager
from src.routing.exceptions import HttpNotFoundException

router = Router.get_instance()
exceptions_manager = ExceptionsManager()
router.set_exceptions_manager(exceptions_manager)

def handle_not_found(exc, request):
    return Response(status=404, body="Page not found!")
exceptions_manager.register_handler(HttpNotFoundException, handle_not_found)

@route("/hello", methods=["GET"])
def hello_route(request):
    return {"message": "Hello from Olympus!"}

if __name__ == "__main__":
    run_server("0.0.0.0", 8000)

Now, open http://localhost:8000/hello in your browser.

Step 3: Use Middlewares

Add global or route-level middleware:

from altxria.olympus.routing.middleware import Middleware

class LoggingMiddleware(Middleware):
    def handle_pre(self, request):
        print(f"Received request at {request.path}")
        return None

router.use_global_middleware(LoggingMiddleware())

All incoming requests are now logged before being handled.

Step 4: Group Routes & Enforce HTTPS

from altxria.olympus.routing.decorators import group
from altxria.olympus.routing.middleware import HTTPSMiddleware

@group(prefix="/admin", middlewares=[HTTPSMiddleware(enforce=True)])
class AdminGroup:
    @route("/dashboard", methods=["GET"])
    def dashboard(self, request):
        return {"admin": "This area is protected by HTTPS"}

    @route("/settings", methods=["GET"])
    def settings(self, request):
        return {"settings": "admin config"}

🔍 Project Status

Issues Closed Bug Issues Enhancement Issues

Olympus is currently in alpha. Expect frequent changes and improvements as the framework matures.


📜 License and Usage

Olympus is licensed under the MIT License, making it free for personal and commercial use. See the LICENSE file for more details.


🤝 Contributors

Developed and maintained by Altxria Inc. and the open-source community.

Contributors

See All Contributors


❤️ Support Olympus

If you find Olympus useful, consider sponsoring us to support ongoing development and new features!

Sponsor Olympus

ko-fi


Ready to build your next web application with Olympus? Jump right in by exploring the documentation or browsing the code.

Metadata

Release files for olympus-framework 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for olympus-framework 0.1.1
File Size Uploaded
olympus_framework-0.1.1.tar.gz 12.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for olympus-framework 0.1.1
File Interpreter ABI Platform
olympus_framework-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.8 kB

Release files / olympus_framework-0.1.1.tar.gz

Download URL olympus_framework-0.1.1.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6ab7716ff84e7f5f417f662161c31ec6e7cc263e1560661941947f558b52f10f
BLAKE2b-256 checksum
How to use checksums
24880abe09284555763b303af6c805716f8c0ac9da2753cf2f6fa9fc4f221486
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / olympus_framework-0.1.1-py3-none-any.whl

Download URL olympus_framework-0.1.1-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac6df5a3489f64d675eebc5f5feabfd2d367fa28707a903ac23d3753f883e21a
BLAKE2b-256 checksum
How to use checksums
5aeb958b2c7141aec128de439a1f68755b0cec41e62d866696659f04f5a510fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page