Skip to main content

A dynamic routes includer for FastAPI

Project description

fastapi_dynamic_routers is a Python library that simplifies the management of routes in FastAPI applications. It provides a clean and efficient way to register routes dynamically, enabling you to keep your codebase organized and maintainable, even as your application grows.

Key Features:

  • Simplicity: The library comes with a straightforward implementation that seamlessly integrates with your FastAPI application.
  • Ease of Use: With just a few lines of code, you can include or exclude routes from your application, providing the flexibility you need during development.
  • Organized Codebase: By dynamically registering routes, you can maintain a clean and well-structured codebase, even in large-scale projects.

Usage Example:

# main.py
from fastapi import FastAPI
from fastapi_dynamic_routers import Routers

app = FastAPI()

# List of router modules to include dynamically
URLS = [
    'path.to.APIRouter.instantiate',
    '...'
]

# Initialize the dynamic routers
routers = Routers(app, URLS)()

In this example, simply modify the URLS list to add or remove routes from your FastAPI application. The dynamic routes includer will handle the registration, keeping your main file clean and focused.

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

fastapi_dynamic_routers-0.1.1.tar.gz (2.4 kB view hashes)

Uploaded Source

Supported by

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