Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

fastapi-pluggable

Make your FastAPI app pluggable with entrypoints.

This module is mainly aimed around monolithic applications where you would install your applications via a package registry, treating each plugin application as a separate repository that imports a core application to use the common functionality like HTML templates, dependencies and more!

Using entry points, we can treat each separate plugin as a separate installable module, here is an example using Poetry with the pyproject.toml,

[tool.poetry.plugins."myapp.plugins"]
plugin_a = 'myapp_plugin_example.main:app'
from fastapi import FastAPI, Request
from pydantic import BaseModel

class Cool(BaseModel):
    yes: bool
    maybe: str

app = FastAPI(root_path="/plugin-a")


@app.get("/hello", response_model=Cool, tags=["Plugin-A"])
async def home(request: Request):
    return Cool(yes=True, maybe="No")

Now we need to ensure we load the plugins for our entrypoint defined in the toml file "myapp.plugins", we can also set a default path for all plugins to be loaded under, here is an example of the core application which will use these plugins.

from fastapi import FastAPI


app = FastAPI()

@app.get("/hello", tags=["Core-App"])
async def hello():
    return "this is the main application ok"


# Register plugins
from fastapi_pluggable import load_plugins

load_plugins(app=app, entrypoint="myapp.plugins", path="/plugins")

Now, plugin-a is reachable via the /plugins/plugin-a endpoint. If you also set merge_docs on the load_plugins function, fastapi_pluggable will attempt to merge the OpenAPI schemas between all the plugins so you can simply visit the /docs endpoint instead of multiple endpoints eg. /docs and /plugins/plugin-a/docs. This is set to False by default so you will have separate plugin openapi schemas unless your plugin disables them when initializing app = FastAPI().

This module is still under heavy work to ensure the best user experience, so expect the logging, openschema merging and some of the other features to not fully work between versions and may even change without backwards compatibility if required. Documentation will also be reworked at some point...

Release files for fastapi-pluggable 0.1.1a1

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

Source distribution (sdist)

Source distribution for fastapi-pluggable 0.1.1a1
File Size Uploaded
fastapi_pluggable-0.1.1a1.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastapi-pluggable 0.1.1a1
File Interpreter ABI Platform
fastapi_pluggable-0.1.1a1-py3-none-any.whl Python 3 none any Details

Total release size:7.7 kB

Release files / fastapi_pluggable-0.1.1a1.tar.gz

Download URL fastapi_pluggable-0.1.1a1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b3ff4e50140a067671626f9d64d6042dc1b74c922fe1316fbdbd63db01041ca7
BLAKE2b-256 checksum
How to use checksums
7776e90e6541d471102ffc778258929dafb0730402f28cf82746202ba534c792
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / fastapi_pluggable-0.1.1a1-py3-none-any.whl

Download URL fastapi_pluggable-0.1.1a1-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fbd3f24be426eb493dd160533f2d53849da84596c54b6ce1bf63b7061d85d8f
BLAKE2b-256 checksum
How to use checksums
88dd2b752fdc9c136b395bd87f41bf5e6a564b4673587b337aaae9b5eb47ca17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.1.1a1 This release

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