Contract and dependencies

Every feature declares what it provides, requires, and allows to be overridden, all in pyproject.toml.

Table of contents

Feature contract

[tool.splent.contract]
description = "Authentication feature"

[tool.splent.contract.provides]
routes       = ["/login", "/logout", "/signup/"]
blueprints   = ["auth_bp"]
models       = ["User"]
commands     = []
hooks        = ["layout.anonymous_sidebar"]
services     = ["AuthenticationService"]
signals      = ["user-registered"]
translations = ["es"]
docker       = []

[tool.splent.contract.requires]
features   = []
env_vars   = ["SECRET_KEY"]
signals    = []

The contract is auto-generated by feature:contract --write and updated during feature:release. If config.py is missing, feature:contract --write prompts to run feature:inject-config.


Extension points

Features declare which parts are safe to override.

[tool.splent.contract.extensible]
services   = ["AuthenticationService"]
models     = ["User"]
templates  = ["auth/login_form.html"]
hooks      = ["layout.anonymous_sidebar"]
routes     = true

Auto-inferred from source code during release. See Extension points.


Dependency rules

Features declare dependencies via the UVL model, subject to one fundamental rule.

If A depends on B (A => B), then A may import from B, but B must never import from A.

Allowed Forbidden
profile imports from auth auth imports from profile
confirmemail imports from mail mail imports from confirmemail

For upstream communication, use signals, never direct imports.

Validate with the command below.

splent product:validate

Naming conventions

Element Convention Example
Package name splent_feature_<name> splent_feature_auth
Namespace splent_io splent_io.splent_feature_auth
Blueprint <name>_bp auth_bp
Template dir templates/<name>/ templates/auth/
Bundle file <name>.bundle.js auth.bundle.js
Seeder class <Name>Seeder AuthSeeder
Service class <Name>Service AuthenticationService

Creating a feature

splent feature:create splent-io/splent_feature_notes

Scaffolds the full directory structure. See feature:create.


See also


Back to top

splent. Distributed by an LGPL license v3. Contact us: drorganvidez@us.es