Getting Started with Fast Pluggy
This guide will help you get started with Fast Pluggy in your FastAPI application.
Prerequisites
- Python 3.10 or higher
- FastAPI
- Basic knowledge of FastAPI applications
Installation
Install Fast Pluggy using pip:
Basic Setup
1. Import the necessary modules
2. Create your FastAPI application
app = FastAPI(
title="My FastAPI App with Plugins",
description="A FastAPI application with plugin support",
version="0.1.0"
)
3. Initialize Fast Pluggy
# Initialize with default settings
pluggy = FastPluggy(app)
# Or with custom settings
pluggy = FastPluggy(
app,
app_root_dir=".", # Root directory of your application
path_plugins="./plugins", # Directory where plugins are stored
path_modules="./domains" # Directory where domain modules are stored
)
4. Run your application
Complete Example
Here's a complete example of a FastAPI application with Fast Pluggy:
from fastapi import FastAPI
from fastpluggy import FastPluggy
# Create the FastAPI application
app = FastAPI(
title="My FastAPI App with Plugins",
description="A FastAPI application with plugin support",
version="0.1.0"
)
# Initialize Fast Pluggy
# The initialization process happens automatically in the constructor
pluggy = FastPluggy(
app,
app_root_dir=".", # Root directory of your application
path_plugins="./plugins", # Directory where plugins are stored
path_modules="./domains" # Directory where domain modules are stored
)
# Define your routes
@app.get("/")
def read_root():
return {"message": "Welcome to my FastAPI application with plugin support!"}
# Run the application
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
Next Steps
- Learn how to install plugins
- Explore the configuration options
- Check out the API reference for more details