Additives
The module system: the Additive class, its router, the manifest and the registry
helpers that discover and load Additives at startup.
Additive
from webfluid import Additive — a self-contained sub-app. Must live inside the additives package and expose itself as additive.
Additive(import_name, base=None, required_extensions=None)— constructs it from its manifest; pass a base to extend it. A base contributes its own required extensions to the child.api,app,ws— the JSON / HTML / WebSocket routers, mounted under the Additive's prefix.render(template, **ctx)— render within the Additive's template namespace.before_enable(fn)/after_enable(fn)— enable-time hooks (the place to register routes).before_request(fn)/after_request(fn)/context_processor(fn)— scoped request hooks.enable(fluid),install(),configure(config)— lifecycle, dependency resolution plus file/package extraction, and interactive app-config contribution.unique_name(name),version,id,prefix,is_base,manifest,root_path— identity and metadata.versionis a plain attribute holding aVersion.
Router
- An APIRouter variant used by the three Additive routers. It wraps every endpoint so its logs are attributed to the Additive.
http_middleware(fn)— wrap every route of the router with request middleware. The chain is built once, not per request.
Manifest
from webfluid import Manifest — the parsed manifest.json.
- Required fields:
id,version,type(base/default),frontend. Optional:name,description,authors,requires. - Versions accept 1 to 3 numbers (each 0–999) and an optional pre-release stage
a/b/rcwith a build of 1–9 — so1.2.0a1is valid, epochs and dev / post / local segments are not. requiresholdswf(a framework version specifier),additives(a mapping of id to specifier, or a list ofid@specifierstrings) andpackages(pip requirements).check_requirements(additive_root)— validates the framework version and the required Additives, and may be called repeatedly.- Dict-like access:
manifest["id"],get,keys,items, ...
webfluid.utils.additives
register_additives(fluid)— the startup hook that discovers, enables and wires every switched-on Additive.installed_additives(package)/installed_bases(package)— list discovered default / base Additives as(id, version, dirname); results are cached unless you passcache=False.import_base(base_id)— resolve an installed base Additive by id (used when extending).require_extensions(*names)— the decorator that guards an Additive on its required extensions.id_check,version_check,type_check— the manifest field validators.
Continue reading
From here you can continue straight with Utils.