Extension points
Every feature declares which parts of itself are safe to override. This is the [tool.splent.contract.extensible] section in pyproject.toml.
Table of contents
What it means
“These parts of my feature can be overridden or extended by a refinement feature.” If a refiner tries to override something not listed here, the framework raises an error at startup.
Example: auth
[tool.splent.contract.extensible]
services = ["AuthenticationService"]
templates = ["auth/login_form.html", "auth/signup_form.html"]
models = ["User"]
hooks = ["layout.anonymous_sidebar", "layout.authenticated_sidebar",
"layout.navbar.anonymous", "layout.navbar.authenticated"]
routes = true
Categories
| Category | Meaning |
|---|---|
services |
Service classes replaceable via the service locator |
templates |
Jinja templates overridable by a refiner’s blueprint |
models |
SQLAlchemy models extendable with mixin columns/methods |
hooks |
Template hooks that can be replaced (not just appended to) |
routes |
If true, refiners can add new routes to this feature’s blueprint |
Auto-inference
feature:contract --write and feature:release auto-generate the extensible section from source code:
- services, models — from class definitions in
services.pyandmodels.py - templates — from HTML files in
templates/ - hooks — from
register_template_hook()calls andget_template_hooks()slots in templates - routes —
trueif the feature defines a blueprint
The section is always regenerated from source. To restrict what can be overridden, remove the code rather than editing the TOML.
See also
- Refinement — how features use extension points
- Validation — guardrails that enforce extension points
feature:contract— generate the extensible contract